답안 #250581

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
250581 2020-07-18T12:45:46 Z REALITYNB Trol (COCI19_trol) C++14
20 / 50
1000 ms 376 KB
#include <bits/stdc++.h> 
#define endl '\n'
using namespace std ; 
int countt(int x ){
	int sum = 0 ; 
	while(x){
		sum += x%10 ; 
		x/=10 ; 
	}
	if(sum>=10) return countt(sum) ; 
	return sum ; 
}
int main(){
	int q ; 
	cin>> q ; 
	while(q--){
		int l ,r ;  
		cin>>l>>r ; 
		int sum = 0 ;
		for(int i=l;i<=r;i++){
			sum += countt(i) ; 
		}  
		cout << sum << endl ; 
	}
	return 0 ; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Execution timed out 1086 ms 376 KB Time limit exceeded
5 Incorrect 0 ms 256 KB Output isn't correct