Submission #20548

#TimeUsernameProblemLanguageResultExecution timeMemory
20548후시기다네가후시기다네 (#35)채점 시스템 (OJUZ11_judge)C++98
100 / 100
156 ms2020 KiB
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void)
{
	int n; cin >> n;
	char buff[100];
	string a, b;

	while (n--)
	{
		scanf("%s", buff);
		a = buff;
		scanf("%s", buff);
		b = buff;


		if (a.size() >= b.size())
		{
			cout << 0 << endl;
			continue;
		}
		
		int cnt = b.size() - a.size() - 1;

		for (int i = 0; i < cnt; i ++)
			a.insert(0, 1, '0');
		a.insert(0, 1, '1');

		if (a > b)
			cout << cnt << endl;
		else
			cout << cnt + 1 << endl;



	}
}

Compilation message (stderr)

judge.cpp: In function 'int main()':
judge.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", buff);
                    ^
judge.cpp:17:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", buff);
                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...