답안 #1007320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007320 2024-06-24T15:42:10 Z vjudge1 Trol (COCI19_trol) C++17
20 / 50
1000 ms 348 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
  int q; cin >> q;
  while(q--){
    int l, r; cin >> l >> r;
    ll ans = 0;
    for(int i = l; i <= r; i++){
      int num = i;
      while(num >= 10){
        int temp = 0;
        while(num > 0){
          temp += num % 10;
          num /= 10;
        };
        num = temp;
      };
      ans += num;
    };
    cout << ans << endl;
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Execution timed out 1080 ms 348 KB Time limit exceeded
5 Incorrect 1 ms 348 KB Output isn't correct