Submission #20445

#TimeUsernameProblemLanguageResultExecution timeMemory
20445mistake (#35)채점 시스템 (OJUZ11_judge)C++14
78 / 100
1000 ms2020 KiB
#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 (stderr)

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);
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...