# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
564293 | faruk | Savrsen (COCI17_savrsen) | C++17 | 825 ms | 39468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define ll long long
#define ld long double
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int b, a;
cin >> a >> b;
vector<int> sito(b + 1, 0);
sito[1] = 1;
for (int i = 2; i <= b; i++) {
if (sito[i] != 0)
continue;
sito[i] = i + 1;
for (int j = i * 2; j <= b; j += i) {
int t = 0;
int s = j;
while (s % i == 0)
s /= i, t++;
if (sito[j / i] == 0 || sito[s] == 0)
continue;
sito[j] = sito[j / i] + sito[s] * (j / s);
}
}
ll out = 0;
for (int i = a; i <= b; i++)
out += abs(i - (sito[i] - i));
cout << out << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |