답안 #20399

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20399 2017-02-11T01:56:16 Z KEIST(#40, keist99) 채점 시스템 (OJUZ11_judge) C++
78 / 100
1000 ms 1116 KB
#include<stdio.h>
int findjari(int x, int jari)
{
	if (x==0) return jari;
	return findjari(x/10, jari+1);
}
int main()
{
	int query;
	scanf("%d", &query);
	while(query--)
	{
		int correct, score;
		scanf("%d %d", &score, &correct);
		
		int jari=findjari(score, 0);
		if (jari==0) jari++;
		
		int defaultJari=1;
		for (int i=1; i<=jari; i++) {
			defaultJari*=10;
		}
		
		int cnt=0;
		while(1)
		{
			if ((score+defaultJari)>correct) {
				printf("%d\n", cnt);
				break;
			}
			
			cnt++;
			defaultJari*=10;
		}
	}
	return 0;
}

Compilation message

judge.cpp: In function 'int main()':
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:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &score, &correct);
                                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1116 KB Output is correct
2 Correct 36 ms 1116 KB Output is correct
3 Correct 29 ms 1116 KB Output is correct
4 Correct 33 ms 1116 KB Output is correct
5 Correct 33 ms 1116 KB Output is correct
6 Correct 33 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1116 KB Output is correct
2 Correct 36 ms 1116 KB Output is correct
3 Correct 29 ms 1116 KB Output is correct
4 Correct 33 ms 1116 KB Output is correct
5 Correct 33 ms 1116 KB Output is correct
6 Correct 33 ms 1116 KB Output is correct
7 Execution timed out 1000 ms 1116 KB Execution timed out
8 Execution timed out 1000 ms 1116 KB Execution timed out
9 Execution timed out 1000 ms 1116 KB Execution timed out
10 Execution timed out 1000 ms 1116 KB Execution timed out
11 Execution timed out 1000 ms 1116 KB Execution timed out