답안 #160334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
160334 2019-10-27T02:55:55 Z model_code Trol (COCI19_trol) C++17
30 / 50
1000 ms 376 KB
#include <cstdio>

using namespace std;

typedef long long llint;

int q;

int value(llint x) {
  if (x < 10) return (int) x;
  llint sum = 0;
  while (x) {
    sum += (llint) (x % 10);
    x /= 10;
  }
  return value(sum);
}

int main(void) {
  scanf("%d", &q);
  while (q--) {
    llint l, r;
    scanf("%lld%lld", &l, &r);
    int sol = 0;
    for (llint i = l; i <= r; ++i) {
      sol += value(i);
    }
    printf("%d\n", sol);
  }
  return 0;
}

Compilation message

trol.cpp: In function 'int main()':
trol.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &q);
   ~~~~~^~~~~~~~~~
trol.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld", &l, &r);
     ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Execution timed out 1077 ms 376 KB Time limit exceeded
5 Execution timed out 1078 ms 376 KB Time limit exceeded