답안 #976699

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976699 2024-05-07T03:17:38 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1000 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

int f(int x){
	while (x > 9) {
		int cur = x;
		int sum = 0;
		while (cur != 0){
			sum += cur % 10;
			cur /= 10;
		}
		x = sum;
	}
	return x;
}

int calc(int l, int r) {
	int ret = 0;
	for (int i = l; i <= r; i++){
		ret += f(i);
	}
	return ret;
}

int main() {
for (int i = 1; i <= 100; i++) cout << f(i) << " ";
	int Q;
	cin >> Q;
	while (Q--){
		int l, r;
		cin >> l >> r;
		cout << calc(l,r) << endl;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Execution timed out 1092 ms 348 KB Time limit exceeded
5 Incorrect 0 ms 348 KB Output isn't correct