답안 #40985

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40985 2018-02-10T18:59:36 Z Hassoony Savrsen (COCI17_savrsen) C++14
120 / 120
1511 ms 39716 KB
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef double D;
const ll inf=(1ll<<61);
const int mod=1e9+7;
const int MX=1e7+9;
const int SQ=350;
int A,B,F[MX];
int main(){
    scanf("%d%d",&A,&B);
    for(int i=1;i<=B;i++){
        for(int j=i+i;j<=B;j+=i)
            F[j]+=i;
    }
    ll ans=0;
    for(int i=A;i<=B;i++){
        ans+=(abs(i-F[i]));
    }
    cout<<ans<<endl;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:12:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&A,&B);
                        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 252 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 4 ms 796 KB Output is correct
4 Correct 1511 ms 39456 KB Output is correct
5 Correct 1465 ms 39716 KB Output is correct
6 Correct 1475 ms 39716 KB Output is correct
7 Correct 1240 ms 39716 KB Output is correct
8 Correct 138 ms 39716 KB Output is correct