记录编号 |
93520 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2008]火柴棒等式 |
最终得分 |
100 |
用户昵称 |
devil |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.014 s |
提交时间 |
2014-03-26 20:45:56 |
内存使用 |
0.32 MiB |
显示代码纯文本
- #include <iostream>
- #include <cstdio>
- #include <cstring>
-
- using namespace std;
-
- int match[1800];
-
- void getmatches();
- int main()
- {
- freopen("matches.in","r",stdin);
- freopen("matches.out","w",stdout);
- getmatches();
- int n;
- int cnt=0;
- cin>>n;
- for(int i=0;i<900;i++)
- for(int j=0;j<900;j++)
- {
- if(match[i]+match[j]+match[i+j]==(n-4)) cnt++;
- }
- cout<<cnt<<endl;
- return 0;
- }
- void getmatches()
- {
- match[0]=6;
- match[1]=2;
- match[2]=5;
- match[3]=5;
- match[4]=4;
- match[5]=5;
- match[6]=6;
- match[7]=3;
- match[8]=7;
- match[9]=6;
- for(int i=1;i<180;i++)
- for(int j=0;j<10;j++)
- {
- if(i<10) match[10*i+j]=match[i]+match[j];
- else
- {
- match[10*i+j]=match[i/10]+match[i%10]+match[j];
- }
- }
- }