제출 #975930

#제출 시각아이디문제언어결과실행 시간메모리
975930vjudge1Trol (COCI19_trol)C++17
컴파일 에러
0 ms0 KiB
#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; } l = l % 9; r = r % 9; else{ 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; } }

컴파일 시 표준 에러 (stderr) 메시지

trol.cpp: In function 'int main()':
trol.cpp:16:9: error: 'else' without a previous 'if'
   16 |         else{
      |         ^~~~
trol.cpp:7:21: warning: unused variable 'ans2' [-Wunused-variable]
    7 |     long long ans1, ans2, ans;
      |                     ^~~~