关于经典题目火柴棒等式

这道题很难,但是我把它写出来了,虽然代码可读性不大,但是我还是要交上来。

题目地址:https://www.luogu.org/problem/show?pid=1149

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<queue>
 4 using namespace std;
 5 int __[15]={ 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 };
 6 int _,___=0,________;
 7 int ____(int _____)
 8 {
 9    if(_____==0)return __[0];
10    int _________=0;
11    while(_____){
12       _________+=__[_____%10];
13       _____=_____/10;
14    }
15    return _________;
16 }
17 int main()
18 {
19    cin>>________;
20    ________=________-4;
21    for(int ______=0;______<=999;______++){
22       for(int _______=0;_______<=999;_______++){
23          _=______+_______;
24          if(________==( ____(_______)+____(______)+____(_) )){
25             ___++;
26             //printf("%d %d %d\n",i,j,_);
27          }
28       }
29    }
30    printf("%d",___);
31   // system("pause");
32    return 0;
33 }

 

posted on 2016-10-18 12:57  fuyun_boy  阅读(198)  评论(2编辑  收藏  举报

导航