# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
216523 | vonatlus | Trol (COCI19_trol) | C++14 | 1092 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/// wa ^3^
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;
template<typename T> istream
&operator>>(istream &a, vector<T> &v) {
for (auto& x : v) a >> x; return a; }
void stndrtn() {
#ifdef accepted
freopen(".in", "r", stdin);
#endif
}
const bool flag = 0;
int f(ll x) {
int sum = 0;
for (; x; x /= 10ll)
sum += x%10;
if (sum > 9)
sum = f(sum);
return sum;
}
void maincode() {
int q;
cin >> q;
for (ll l, r; q--;) {
cin >> l >> r;
int sum = 0;
for (ll i = l; i <= r; ++i)
sum += f(i);
cout << sum << "\n";
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr), stndrtn();
int ts = 1;
if (flag)
cin >> ts;
while (ts--)
maincode();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |