답안 #20445

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20445 2017-02-11T14:46:35 Z mistake(#47, aloshipda) 채점 시스템 (OJUZ11_judge) C++14
78 / 100
1000 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) {
    int P, T;
    scanf("%d %d", &P, &T);
    if (P == 0) {
      int ans = 0;
      while (T) {
        ++ans;
        T /= 10;
      }
      printf("%d\n", ans - 1);
      continue;
    }
    int ans = 0;
    int 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:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &P, &T);
                           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 2020 KB Output is correct
2 Correct 39 ms 2020 KB Output is correct
3 Correct 36 ms 2020 KB Output is correct
4 Correct 33 ms 2020 KB Output is correct
5 Correct 36 ms 2020 KB Output is correct
6 Correct 36 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 2020 KB Output is correct
2 Correct 39 ms 2020 KB Output is correct
3 Correct 36 ms 2020 KB Output is correct
4 Correct 33 ms 2020 KB Output is correct
5 Correct 36 ms 2020 KB Output is correct
6 Correct 36 ms 2020 KB Output is correct
7 Execution timed out 1000 ms 2020 KB Execution timed out
8 Execution timed out 1000 ms 2020 KB Execution timed out
9 Execution timed out 1000 ms 2020 KB Execution timed out
10 Execution timed out 1000 ms 2020 KB Execution timed out
11 Execution timed out 1000 ms 2020 KB Execution timed out