# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
689639 | 2023-01-29T03:46:13 Z | Warinchai | Trol (COCI19_trol) | C++14 | 1 ms | 212 KB |
#include<bits/stdc++.h> using namespace std; int main(){ int q; cin>>q; long long sum=0; for(int i=0;i<q;i++){ int a,b; cin>>a>>b; sum=0; int da=a%9; int db=b%9; int dif=b-a+1; int ddd=dif/9; sum+=ddd*45; for(int i=a+ddd*9;i<=b;i++){ int x=i%9; if(x==0){ x=9; } sum+=x; } cout<<sum<<endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | Output isn't correct |