CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:Luukasa
Submission time:2019-10-02 16:58:37 +0300
Language:C++11
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#20.01 sdetails
#3--details
#4--details
#5--details
#6--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

user output
1

Test 2

Verdict:

input
2

correct output
1 2 
2 1 

user output
1
0

Test 3

Verdict:

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:

input
42

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 5

Verdict:

input
99

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 6

Verdict:

input
100

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)