#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(a) (int)a.size()
#define _3Pxrs5V ios::sync_with_stdio(0),cin.tie(0)
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
//e
signed main(){
_3Pxrs5V;
int n;
cin>>n;
int ans=0;
rep(i,n){
string s;
cin>>s;
int ch=s.back()-'0';
int v=0;
rep(i,sz(s)-1){
v=v*10+s[i]-'0';
}
// print(v);
int val=1;
rep(i,ch){
val*=v;
}
ans+=val;
}
print(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
320 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |