Task: | Ruudukko |
Sender: | Luukasa |
Submission time: | 2019-10-02 16:58:37 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <iostream> #include <string> using namespace std; int main() { int num; cin >> num; int a[num], b[num]; for(int i = 0; i < num; i++) { cin >> a[i] >> b[i]; } for(int i = 0; i < num; i++) // Loops through all the pairs of numbers { int ans = 0; for(int c = b[i]; c >= a[i]; c--) // Goes through all the numbers between a and b checking if the number only has 1's and 0̈́'s in it. { bool check = false; string s = to_string(c); for(unsigned int n = 0; n < s.size(); n++) { if(s[n] != '1' && s[n] != '0') { check = true; break; } } if(!check) { ans++; } } cout << ans << endl; } return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
1 0 |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 |
correct output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
user output |
---|
(empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |