#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
long long ans = 0;
vector<int> d(b-1);
for(int i=0;i<b-1;i++){
d[i] = a%(i+1);
}
long long curr = 0;
for(int i=a;i<=b;i++){
curr = i;
if(i!=1){
for(int j=0;j<i-1;j++){
if(d[j]==0) curr -= j+1;
}
}
ans += abs(curr);
for(int k=0;k<b-1;k++){
d[k] = (d[k]+1)%(k+1);
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
7 ms |
436 KB |
Output is correct |
3 |
Execution timed out |
3084 ms |
604 KB |
Time limit exceeded |
4 |
Execution timed out |
3058 ms |
39516 KB |
Time limit exceeded |
5 |
Execution timed out |
3033 ms |
39512 KB |
Time limit exceeded |
6 |
Execution timed out |
3018 ms |
39512 KB |
Time limit exceeded |
7 |
Execution timed out |
3040 ms |
36440 KB |
Time limit exceeded |
8 |
Execution timed out |
3049 ms |
10332 KB |
Time limit exceeded |