标签:return ring string iostream print cst pen for sprint
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char s[20];
int n,tot;
int a[10]={6,2,5,5,4,5,6,3,7,6};
bool b[1120];
int cola(int x){
int ans=0;
sprintf(s,"%d",x);
for(int i=0;i<strlen(s);i++) ans+=a[s[i]-48];
return ans;
}
int main()
{
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
scanf("%d",&n);
n-=4;
for(int i=0;i<=1117;i++){
if(cola(i)>=n){
// b[i]=1;
continue;
}
for(int j=0;j<=1110;j++){
// if(b[j]) continue;
int k=i+j;
if(cola(i)+cola(j)+cola(k)==n) tot++;
}
}
printf("%d",tot);
return 0;
}
标签:return ring string iostream print cst pen for sprint
原文地址:http://www.cnblogs.com/Bear-Child/p/5997701.html