记录编号 |
91111 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2008]火柴棒等式 |
最终得分 |
100 |
用户昵称 |
HouJikan |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.143 s |
提交时间 |
2014-03-11 22:11:54 |
内存使用 |
0.28 MiB |
显示代码纯文本
- #include <cstdio>
- #include <cstring>
- #include <iostream>
- using namespace std;
- int chan[10]={6,2,5,5,4,5,6,3,7,6};
- int cnt(int n)
- {
- if (n==0) return 6;
- int k=n;
- int sum=0;
- while (k!=0)
- {
- sum+=chan[k%10];
- k=k/10;
- }
- return sum;
- }
- int main()
- {
- freopen("matches.in","r",stdin);
- freopen("matches.out","w",stdout);
- int n;
- scanf("%d",&n);
- if (n<10)
- {
- printf("0");
- return 0;
- }
- n=n-4;
- int time=0;
- for(int a=0;a<=800;a++)
- {
- for(int b=0;b<=800;b++)
- {
- int k=a+b;
- int o=cnt(a),p=cnt(b),q=cnt(k);
- if (o+p+q==n)
- time++;
- }
- }
- printf("%d",time);
- //system("pause");
- return 0;
- }