#include<stdio.h>
int main() { int sum,a,n; int san(int a,int n); scanf("%d %d",&a,&n); sum=san(a,n); printf("%d",sum); return 0; } int san(int a, int n) { int sum,team; sum=team=a; for(int i=1;i<n;i++) { team=team*10+a; sum+=team; } return sum; }
求Sn=a+aa+aaa+...+aaaa..a是一位数字,n代表a的位数
原文:https://www.cnblogs.com/1ybs/p/14437504.html