#include<stdio.h> int main() { int n,i,j,k; int a[27][51],b[51],temp[51]; int s; scanf("%d",&n); for(;n;n--) { for(j=0;j<=50;j++) b[j]=temp[j]=0; for(i=1;i<=26;i++){ scanf("%d",&a[i][0]); for(j=1;j<=50;j++) a[i][j]=0; for(j=1;j<=a[i][0]&&j*i<=50;j++) a[i][j*i]=1; } for(i=1;i<=26;i++){ for(k=i;k<=50;k+=i) temp[k]+=a[i][k]; for(j=1;j<=50;j++) for(k=1;k<=a[i][0]&&k*i<=50;k++) temp[k*i+j]+=a[i][k*i]*b[j]; for(j=1;j<=50;j++) b[j]=temp[j]; } s=b[1]; for(j=2;j<=50;j++) s+=b[j]; printf("%d\n",s); } return 0; }
原文地址:https://www.cnblogs.com/lhl2019/p/12109120.html
时间: 2024-11-09 02:11:17