Submission #20401

# Submission time Handle Problem Language Result Execution time Memory
20401 2017-02-11T02:00:23 Z KEIST(#40, keist99) 채점 시스템 (OJUZ11_judge) C++
100 / 100
46 ms 1116 KB
#include<stdio.h>
long long findjari(long long x, long long jari)
{
	if (x==0) return jari;
	return findjari(x/10, jari+1);
}
int main()
{
	long long query;
	scanf("%d", &query);
	while(query--)
	{
		long long correct, score;
		scanf("%lld %lld", &score, &correct);
		
		long long jari=findjari(score, 0);
		if (jari==0) jari++;
		
		long long defaultJari=1;
		for (long long i=1; i<=jari; i++) {
			defaultJari*=10;
		}
		
		long long cnt=0;
		while(1)
		{
			if ((score+defaultJari)>correct) {
				printf("%lld\n", cnt);
				break;
			}
			
			cnt++;
			defaultJari*=10;
		}
	}
	return 0;
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:10:20: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
  scanf("%d", &query);
                    ^
judge.cpp:10:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &query);
                     ^
judge.cpp:14:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld", &score, &correct);
                                       ^
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1116 KB Output is correct
2 Correct 36 ms 1116 KB Output is correct
3 Correct 39 ms 1116 KB Output is correct
4 Correct 36 ms 1116 KB Output is correct
5 Correct 36 ms 1116 KB Output is correct
6 Correct 33 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1116 KB Output is correct
2 Correct 36 ms 1116 KB Output is correct
3 Correct 39 ms 1116 KB Output is correct
4 Correct 36 ms 1116 KB Output is correct
5 Correct 36 ms 1116 KB Output is correct
6 Correct 33 ms 1116 KB Output is correct
7 Correct 43 ms 1116 KB Output is correct
8 Correct 43 ms 1116 KB Output is correct
9 Correct 46 ms 1116 KB Output is correct
10 Correct 36 ms 1116 KB Output is correct
11 Correct 33 ms 1116 KB Output is correct