#include<stdio.h>
#include<stdlib.h>
int main()
{
int a = 0, i=0, Sn = 0,tmp=0;
scanf_s("%d", &a);
tmp = a;
Sn = 2;
for (i = 0; i <4; i++)
{
a = a * 10 + tmp;
Sn = Sn + a;
}
printf("%d\n", Sn);
system("pause");
return 0;
}
拓展:求Sn = a + aa + aaa + aaaa + aaaaa的前n项和