Submission #975932

# Submission time Handle Problem Language Result Execution time Memory
975932 2024-05-06T03:36:06 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    long long n, l, r;
    cin >> n;
    long long ans1, ans2, ans; 
    for(int i = 0; i < n; i++){
        cin >> l >> r;
        ans = l - r + 1;
        if(l == r){
            cout << ans1 << endl;
        }
        else{
            l = l % 9;
            r = r % 9;
            if(ans > 9){
            ans1 = 45 * (ans / 9);
            }else if(l == 0){
                l = 9;
            }else if(r == 0){
                r = 9;
            }else if(l == 9){
                ans1 += 9;
                for(int i = 0; i <= r; i++){
                    ans1 += i;
                }
            }
        }cout << ans1 << endl;
        
    }
}

Compilation message

trol.cpp: In function 'int main()':
trol.cpp:7:21: warning: unused variable 'ans2' [-Wunused-variable]
    7 |     long long ans1, ans2, ans;
      |                     ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct