zoukankan      html  css  js  c++  java
  • 火柴棒等式

    ```cpp
    #include<bits/stdc++.h>
    using namespace std;
    int ax[]={6,2,5,5,4,5,6,3,7,6};//先给每个数需要的火柴预处理。
    int n,sum,ans,z,h,k;
    int js(int x)//组成的数可能有多位。
    {
      int y=0;
      if(x==0) y=ax[0];
      while(x){
        y+=ax[x%10];
        x/=10;
      }
      return y;
    }
    int main()
    {
      cin>>n;
      n-=4;//我们还需要减去加号和等于号需要的火柴数
      for(int i=0;i<=1000;i++)
        for(int j=0;j<=1000;j++)
        {
          int x=i+j;
          z=js(i),h=js(j),k=js(x);
          if((z+h+k)==n)
          ans++;
        }
      cout<<ans;
      return 0;
    }
    //完美撒花。
    ```

  • 相关阅读:
    What Kind of Friends Are You? ZOJ 3960
    博弈随笔(未完待续)
    Mergeable Stack ZOJ
    LIS ZOJ
    差分约束 HDU
    How far away ? HDU
    wya费用流
    不知道说些什么
    ext大法好啊
    bzoj2348
  • 原文地址:https://www.cnblogs.com/20020219-liu/p/11264885.html
Copyright © 2011-2022 走看看