scanf("%d %d", &a, &n); printf("fn(%d, %d) = %d\n", a, n, fn(a,n)); printf("s = %d\n", SumA(a,n));
return0; }
/* 你的代码将被嵌在这里 */
关键代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14
intfn( int a, int n ){ int num =0; for(int i=0;i<n;i++){ num = num*10+a; } return num; } intSumA( int a, int n ){ int res=0; for(int i = 1;i<=n;i++){ res += fn(a,i); } return res; }