# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
975476 | vjudge1 | Trol (COCI19_trol) | C++98 | 1 ms | 584 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int calc(int num){
int ans = 0;
while(num != 0){
ans += num % 10;
num /= 10;
}
return ans;
}
int main(){
int Q, L, R, ans1, ans2, temp;
cin >> Q;
for(int j =0; j<Q; j++){
cin >> L;
ans1 = calc(L);
while(ans1 > 10){
temp = calc(ans1);
ans1 = temp;
}
cin >> R;
ans2 = calc(R);
while(ans2 > 10){
temp = calc(ans2);
ans2 = temp;
}
if(ans1 != ans2){
cout << ans1 << ans2 << endl;
}else{
cout << ans1 << endl;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |