답안 #30851

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
30851 2017-07-27T23:11:18 Z okaybody10 채점 시스템 (OJUZ11_judge) C++
100 / 100
53 ms 1116 KB
#include <stdio.h>

int wkfltn(int n)
{
    int cnt=0;
    if(n==0)
        return 1;
    while(n)
    {
        n/=10;
        cnt++;
    }
    return cnt;
}

int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int S,P;
        scanf("%d %d",&P,&S);
        int wkfl=wkfltn(P); // O(P의 자리수)
        long long int tenpow=1;
        for(int i=1;i<=wkfl;i++)
            tenpow*=10;
        int zerocount=0;
        while(1)
        {
            if(tenpow+P>S)
                break;
            zerocount++;
            tenpow*=10;
        }
        printf("%d\n",zerocount);
    }
    return 0;
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:19:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&T);
                   ^
judge.cpp:23:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&P,&S);
                             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1116 KB Output is correct
2 Correct 46 ms 1116 KB Output is correct
3 Correct 36 ms 1116 KB Output is correct
4 Correct 43 ms 1116 KB Output is correct
5 Correct 36 ms 1116 KB Output is correct
6 Correct 39 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1116 KB Output is correct
2 Correct 46 ms 1116 KB Output is correct
3 Correct 36 ms 1116 KB Output is correct
4 Correct 43 ms 1116 KB Output is correct
5 Correct 36 ms 1116 KB Output is correct
6 Correct 39 ms 1116 KB Output is correct
7 Correct 46 ms 1116 KB Output is correct
8 Correct 43 ms 1116 KB Output is correct
9 Correct 53 ms 1116 KB Output is correct
10 Correct 49 ms 1116 KB Output is correct
11 Correct 46 ms 1116 KB Output is correct