Submission #20635

#TimeUsernameProblemLanguageResultExecution timeMemory
20635?? (#35)채점 시스템 (OJUZ11_judge)C++11
0 / 100
266 ms2020 KiB
#include <bits/stdc++.h>
using namespace std;

int T, A, B;
string ar[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};

int main() {
    scanf("%d", &T);
    for(int i=0; i<T; i++) {
        scanf("%d %d", &A, &B);
        string s, t;
        while(A) s = ar[A % 10] + s, A /= 10;
        while(B) t = ar[B % 10] + t, B /= 10;
        int ans = 0;
        for(int i=0;; i++) {
            string u = s;
            for(int j=0; j<i; j++) u = "0" + u;
            if(u.length() >= t.length()) {ans = i; break;}
            u = "1" + u;
            if(u.length() == t.length() && u > t) {ans = i; break;}
        }
        printf("%d\n", ans);
    }
}

Compilation message (stderr)

judge.cpp: In function 'int main()':
judge.cpp:8:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &T);
                    ^
judge.cpp:10:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &A, &B);
                               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...