# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1039371 | 2024-07-30T19:18:44 Z | 7again | Savrsen (COCI17_savrsen) | C++17 | 679 ms | 78684 KB |
#include <bits/stdc++.h> #define int long long #define FAST ios::sync_with_stdio(0);cout.tie(0);cin.tie(0) using namespace std ; void slv() { int l , r ; cin >> l >> r ; vector <int> sum(1e7+1 , 0) ; for(int i = 2 ; i <= 1e7 ; i++) { for(int j = 2*i ; j <= 1e7 ; j += i) sum[j] += i ; } sum[1] = 1 ; for(int i = 2 ; i <= 1e7 ; i++) { sum[i] = abs(i - (sum[i] + 1)) ; sum[i] += sum[i - 1] ; } cout << sum[r] - sum[l - 1] ; } main() { FAST ; slv() ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 655 ms | 78684 KB | Output is correct |
2 | Correct | 673 ms | 78676 KB | Output is correct |
3 | Correct | 668 ms | 78672 KB | Output is correct |
4 | Correct | 679 ms | 78672 KB | Output is correct |
5 | Correct | 672 ms | 78684 KB | Output is correct |
6 | Correct | 665 ms | 78520 KB | Output is correct |
7 | Correct | 625 ms | 78672 KB | Output is correct |
8 | Correct | 632 ms | 78580 KB | Output is correct |