Submission #106115

# Submission time Handle Problem Language Result Execution time Memory
106115 2019-04-16T15:02:55 Z sofhiasouza Sequence (BOI14_sequence) C++14
0 / 100
6 ms 384 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)
	{
		string ss;
		stringstream aux;
		aux << k-1;
		aux >> ss;
		if(k == 0) cout << 10 << endl;
		else if(ss.size() != s.size()) cout << pow(10, s.size()) << endl;
		else cout << pow(10, s.size()+1) << endl;
	}
	else if(a == 9)
	{
		int t = pow(10, s.size()-2);
		if(t == 1) t = 0;
		if(s.size() == 1) cout << 89 << endl;
		else if(t+1 + pow(10, s.size()-1) > k) cout << pow(10, s.size()-1)*9 - t-1 << endl; 
		else cout << pow(10, s.size())*9 - pow(10, s.size()-1)-1 << endl;
	}
	else cout << pow(10, s.size())*a << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -