Submission #991227

#TimeUsernameProblemLanguageResultExecution timeMemory
991227vjudge1Trol (COCI19_trol)C++17
0 / 50
1090 ms604 KiB
#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 g(int l, int r){ int ans = 0; for(int i = l; l<=r; i++){ ans+=f(i); } return ans; } int main(){ int q; cin >> q; while(q--){ int l,r; cin >> l >> r; cout << g(l,r) << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...