供参考:
#include<stdio.h> int main() { int a,n,k=0,s=0; scanf("%d%d",&a,&n); while(n--) { k = k*10 + a; s += k; } printf("%d",s); return 0; }