12203 | 2024-12-09 12:06:59 | Csongi | Számjegycsere | cpp17 | Wrong answer 0/100 | 172ms | 784 KiB |
#include <bits/stdc++.h>
using namespace std;
bool ketnulla(const string& str)
{
int szam = 0;
for (char c : str)
{
if (c==0)
{
szam++;
}
if (szam == 2)
{
return true;
}
}
return false;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
for (int i = 0; i < n; i++)
{
string be; cin >> be;
//string be = to_string(be);
if ((be[be.size()-1]=='0' && be[be.size()-2]=='0') || (be[be.size()-1]=='5' && be[be.size()-2]=='2') || (be[be.size()-1]=='5' && be[be.size()-2]=='7') || (be[be.size()-1]=='0' && be[be.size()-2]=='5'))
{
cout << "0" << endl;
}
else if (be[be.size()-1]=='0')
{
string str = be; str.pop_back();
if (str.find("0") != string::npos || str.find("5") != string::npos)
{
cout << "1" << endl;
}
else
{
cout << "-1" << endl;
}
}
else if (be[be.size()-1]=='5')
{
string str = be; str.pop_back();
if (str.find("7") != string::npos || str.find("2") != string::npos)
{
cout << "1" << endl;
}
else if (ketnulla(str))
{
cout << "2" << endl;
}
else
{
cout << "-1" << endl;
}
}
else if ((be.find("7") != string::npos && be.find("5") != string::npos) || (be.find("2") != string::npos && be.find("5") != string::npos) || (be.find("5") != string::npos && be.find("0") != string::npos) || ketnulla(be))
{
cout << "2" << endl;
}
else
{
cout << "-1" << endl;
}
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 0/21 | ||||||
2 | Wrong answer | 46ms | 456 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Wrong answer | 172ms | 568 KiB | ||||
4 | Wrong answer | 163ms | 688 KiB | ||||
5 | Wrong answer | 170ms | 672 KiB | ||||
6 | Wrong answer | 163ms | 644 KiB | ||||
7 | Wrong answer | 162ms | 440 KiB | ||||
8 | Wrong answer | 160ms | 624 KiB | ||||
9 | Wrong answer | 167ms | 452 KiB | ||||
10 | Wrong answer | 166ms | 640 KiB | ||||
11 | Wrong answer | 164ms | 568 KiB | ||||
12 | Wrong answer | 164ms | 464 KiB | ||||
13 | Wrong answer | 167ms | 508 KiB | ||||
14 | Wrong answer | 167ms | 568 KiB | ||||
15 | Wrong answer | 164ms | 508 KiB | ||||
16 | Wrong answer | 168ms | 556 KiB | ||||
17 | Wrong answer | 167ms | 464 KiB | ||||
18 | Wrong answer | 162ms | 452 KiB | ||||
19 | Wrong answer | 163ms | 568 KiB | ||||
20 | Wrong answer | 168ms | 568 KiB | ||||
21 | Wrong answer | 164ms | 456 KiB | ||||
22 | Wrong answer | 168ms | 444 KiB | ||||
23 | Wrong answer | 138ms | 784 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Accepted | 1ms | 320 KiB | ||||
25 | Accepted | 1ms | 320 KiB | ||||
26 | Accepted | 1ms | 320 KiB | ||||
27 | Accepted | 1ms | 320 KiB | ||||
28 | Accepted | 1ms | 320 KiB | ||||
29 | Accepted | 1ms | 320 KiB | ||||
30 | Accepted | 1ms | 320 KiB | ||||
31 | Accepted | 1ms | 508 KiB | ||||
32 | Accepted | 1ms | 320 KiB | ||||
33 | Wrong answer | 1ms | 320 KiB | ||||
34 | Accepted | 1ms | 320 KiB | ||||
35 | Accepted | 1ms | 332 KiB | ||||
36 | Accepted | 3ms | 500 KiB | ||||
37 | Accepted | 14ms | 444 KiB | ||||
38 | Accepted | 1ms | 320 KiB | ||||
39 | Accepted | 1ms | 320 KiB | ||||
40 | Accepted | 1ms | 320 KiB | ||||
41 | Accepted | 1ms | 320 KiB | ||||
42 | Accepted | 2ms | 320 KiB | ||||
43 | Accepted | 2ms | 320 KiB | ||||
44 | Accepted | 2ms | 320 KiB | ||||
45 | Accepted | 2ms | 320 KiB | ||||
46 | Wrong answer | 1ms | 320 KiB | ||||
47 | Wrong answer | 2ms | 340 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Wrong answer | 3ms | 440 KiB | ||||
49 | Wrong answer | 2ms | 676 KiB | ||||
50 | Wrong answer | 159ms | 456 KiB | ||||
51 | Wrong answer | 2ms | 468 KiB | ||||
52 | Wrong answer | 32ms | 428 KiB | ||||
53 | Accepted | 3ms | 320 KiB | ||||
54 | Accepted | 4ms | 448 KiB | ||||
55 | Accepted | 20ms | 444 KiB | ||||
56 | Accepted | 172ms | 720 KiB | ||||
57 | Accepted | 2ms | 768 KiB | ||||
58 | Accepted | 3ms | 588 KiB | ||||
59 | Accepted | 3ms | 756 KiB | ||||
60 | Accepted | 4ms | 320 KiB | ||||
61 | Accepted | 4ms | 320 KiB | ||||
62 | Accepted | 4ms | 320 KiB | ||||
63 | Accepted | 4ms | 320 KiB | ||||
64 | Accepted | 159ms | 704 KiB | ||||
65 | Accepted | 171ms | 712 KiB | ||||
66 | Accepted | 150ms | 568 KiB |