您的位置:首页 > 编程语言 > C语言/C++

【C++心路历程11】火柴棒等式1182,打表!

2017-07-14 20:11 295 查看
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int a[25]={0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,8,9,6,9,29,39,38,65,88,128};
int main()
{
int n;
scanf("%d",&n);
cout<<a
;
return 0;
}

/*#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int a[10]={6,2,5,5,4,5,6,3,7,6};
char b[10];

int gun(int x)
{
int c[10];
int ans=0,k=0;
if(x==0) return 6;
while(x>0)
{
c[k]=x%10;
x=x/10;
k++;
}
for(int i=0;i<k;i++)
{
ans+=a[c[i]];
}
memset(c,0,sizeof(c));
k=0;
return ans;
}

int main()
{
freopen("out.txt","w",stdout);
int cnt=0,n;
for(int i=1;i<=24;i++)
{
for(int A=0;A<=1112;A++)
for(int B=0;B<=1112;B++)
{
int C=A+B;
if(gun(A)+gun(B)+gun(C)+4==i)
cnt++;
}
printf("%d,",cnt);
cnt=0;
}

return 0;
}
*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: