View Code of Problem 1044

#include <cstdio>
#include <cstring>
int b[182];//最多有180分
int a[63]={0,1,2,2,3,3,4,4,5,6,6,6,7,8,8,9,9,10,10,11,12,12,12,13,14,14,15,15,16,16,17,18,18,18,19,20,20,
21,22,24,24,26,27,28,30,30,32,33,34,36,36,38,39,40,42,45,48,51,54,57,60,50,25};
//20个原数字,前10个的2倍,3倍的数字,后10个的2倍,3倍的数字,50,25见题目
int main()
{
    int t,cnt=0,i,j,k,n,l;
    scanf("%d",&t);
	memset(b,0,sizeof(b));
    for(i=0;i<=180;i++)   //枚举得到每个分数的种数
    {
        for(j=0;j<63;j++)
            for(k=j;k<63;k++)
                for(l=k;l<63;l++)
					if(i==a[j]+a[k]+a[l])
						b[i]++;
    }
    while(t--)
    {
        scanf("%d",&n);
        printf("Scenario #%d:\n%d\n",++cnt,b[n]);
        if(t)
            printf("\n");
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 1044