답안 #20446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20446 2017-02-11T14:47:49 Z mistake(#47, aloshipda) 채점 시스템 (OJUZ11_judge) C++14
100 / 100
43 ms 2020 KB
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iostream>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <complex>

#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define pf(a) push_font((a))
#define rb() pop_back()
#define rf() pop_front()
#define sz(a) ((int)a.size())

using namespace std;
 
typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
typedef pair<lld, int> pli;
typedef pair<int, lld> pil;
typedef vector<vector<int>> Matrix;
typedef vector<vector<int>> Adj;
typedef vector<int> Row;
typedef complex<double> Complex;
typedef vector<Complex> Vcomplex;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const lld LINF = 1e18;
const double FINF = 1e15;
const double EPS = 1e-9;
const double PI = 2.0 * acos(0.0);


int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    lld P, T;
    scanf("%lld %lld", &P, &T);
    if (P == 0) {
      int ans = 0;
      while (T) {
        ++ans;
        T /= 10;
      }
      printf("%d\n", ans - 1);
      continue;
    }
    int ans = 0;
    lld t = 1;
    while (t <= P) t *= 10;
    while (true) {
      bool ok = true;
      for (int j = 1; j <= 9; ++j) {
        if (t * j + P <= T) {
          ok = false;
          break;
        }
      }
      if (ok) break;
      t *= 10;
      ++ans;
    }
    printf("%d\n", ans);
  }
}

Compilation message

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