답안 #147586

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147586 2019-08-30T07:39:16 Z Ruxandra985 Savrsen (COCI17_savrsen) C++14
75 / 120
1954 ms 78648 KB
#include <cstdio>
#include <iostream>
#define MAXI 10000000
using namespace std;
long long perf[MAXI];
int main()
{
    //freopen ("a.in" , "r" , stdin);
    //freopen ("a.out" , "w" , stdout);
    int a, b , i , j;
    long long sol;
    scanf ("%d%d",&a,&b);
    for (i=1;i<=b/2;i++){
        for (j = 2 * i ; j<=b ; j+=i)
            perf[j]+=i;
    }
    sol = 0;
    for (i=a;i<=b;i++)
        sol = sol + max (i - perf[i] , perf[i] - i);
    printf ("%lld",sol);
    return 0;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:12:11: 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 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 6 ms 1144 KB Output is correct
4 Incorrect 1845 ms 78648 KB Output isn't correct
5 Incorrect 1925 ms 78632 KB Output isn't correct
6 Incorrect 1954 ms 78556 KB Output isn't correct
7 Correct 1781 ms 72568 KB Output is correct
8 Correct 227 ms 20216 KB Output is correct