제출 #975197

#제출 시각아이디문제언어결과실행 시간메모리
975197vjudge1Trol (COCI19_trol)C++17
0 / 50
1 ms604 KiB
// أَعُوذُ بِاللَّهِ مِنَ الشَّيْطَانِ الرَّجِيمِ #include <bits/stdc++.h> #define bismillah ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long using namespace std; int kecilkan(int a){ int b = 0; while(a > 0){ b += a%10; a/=10; } if(b>9){ kecilkan(b); }else{ return b; } } int main(){ bismillah int q; cin >> q; int hasil; while(q--){ int l, r; cin >> l >> r; if(l > 9){ l = kecilkan(l); } if(r > 9){ r = kecilkan(r); } hasil = 0; for(int i = l; i <= r; i++){ hasil += i; } cout << hasil; } }

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

trol.cpp: In function 'int kecilkan(int)':
trol.cpp:15:17: warning: control reaches end of non-void function [-Wreturn-type]
   15 |         kecilkan(b);
      |         ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...