# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
66519 | 2018-08-11T09:31:40 Z | KLPP | Savrsen (COCI17_savrsen) | C++14 | 2379 ms | 78916 KB |
#include<iostream> #include<vector> #include<queue> #include<algorithm> #include<stdio.h> using namespace std; int abs(int x){ if(x>0)return x; return -x; } int main(){ int a,b; scanf("%d %d",&a,&b); long long int arr[b]; for(int i=0;i<b;i++)arr[i]=0; for(int i=1;i<=b;i++){ for(int j=i;j<=b;j+=i){ arr[j-1]+=i; } } long long int ans=0; for(int i=0;i<b;i++){ if(i>=a-1){arr[i]=abs(arr[i]-2*(i+1)); ans+=arr[i]; } }printf("%lld\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 8 ms | 1396 KB | Output is correct |
4 | Correct | 2371 ms | 78876 KB | Output is correct |
5 | Correct | 2352 ms | 78912 KB | Output is correct |
6 | Correct | 2379 ms | 78916 KB | Output is correct |
7 | Correct | 2206 ms | 78916 KB | Output is correct |
8 | Correct | 472 ms | 78916 KB | Output is correct |