# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
106171 | 2019-04-17T02:25:59 Z | sofhiasouza | Sequence (BOI14_sequence) | C++14 | 41 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; int main() { int k, a; string s; cin >> k; for(int i = 0 ; i < k ; i++) cin >> a; k--; stringstream ans; ans << k; ans >> s; if(k == 0 and a != 0) cout << a << endl; else if(a == 0) { long long int p = 0; for(int i = 1 ; i <= s.size() ; i++) p += (long long int)pow(10, s.size() - i); if(k == 0) cout << 10 << endl; else if(p >= k+1) cout << (long long int)pow(10, s.size()) << endl; else cout << (long long int)pow(10, s.size()+1) << endl; } else if(a == 9) { long long int p = 0, p2 = 0; p2 += (long long int)pow(10, s.size() - 1); for(int i = 2 ; i <= s.size() ; i++) p += (long long int)pow(10, s.size() - i); p2 += p; if(s.size() == 1) cout << 89 << endl; else if((long long int)p + (long long int)pow(10, s.size()-1) >= k+1) cout << (long long int)pow(10, s.size()-1)*9 - p << endl; else cout << (long long int)pow(10, s.size())*9 - p2 << endl; } else cout << (long long int)pow(10, s.size())*a << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 17 ms | 380 KB | Output is correct |
8 | Correct | 15 ms | 384 KB | Output is correct |
9 | Correct | 21 ms | 512 KB | Output is correct |
10 | Correct | 41 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |