#include<bits/stdc++.h> using namespace std; int main(){ int a,b = 0,n,sum = 0,op = 1; cin>>a>>n; int tmp = a; while(n--){ tmp = a * op + b; b = tmp; sum = sum + tmp; op*=10; } cout<<sum; return 0; }
Double click to view unformatted code.