Submission #82798

#TimeUsernameProblemLanguageResultExecution timeMemory
82798xiaowuc1Pot (COCI15_pot)C++14
50 / 50
2 ms588 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll powpow(ll b, ll e) { ll r = 1; while(e) { if(e%2) { r *= b; } b *= b; e /= 2; } return r; } int main() { int n; cin >> n; ll ret = 0; while(n--) { string s; cin >> s; int x = 0; for(int i = 0; i < s.size()-1; i++) { x *= 10; x += s[i] - '0'; } int y = s[s.size()-1] - '0'; ret += powpow(x, y); } printf("%lld\n", ret); }

Compilation message (stderr)

pot.cpp: In function 'int main()':
pot.cpp:27:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < s.size()-1; i++) {
                  ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...