#include<bits/stdc++.h> using namespace std; int ans,n;//定义 int f(int s){//定义整形 f(int s) if(s==1){//如果到达目标{ return n;// 返回 n; }else{//} 否则 return f(s-1)*10+n;//返回 f(s-1)*10+n; } } int main(){ cin>>n;// 输入 for(int i=1;i<=n;i++){// 循环n次{ ans+=f(i);//将ans加f(i); } cout<<ans;// 输出 return 0; } /************************************************************** Problem: 1245 User: zzz Language: C++ Result: Accepted Time:8 ms Memory:2072 kb ****************************************************************/