Submission #147589

#TimeUsernameProblemLanguageResultExecution timeMemory
147589Ruxandra985Savrsen (COCI17_savrsen)C++14
120 / 120
2008 ms78712 KiB
#include <cstdio> #include <iostream> #define MAXI 10000010 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<=MAXI/2;i++){ for (j = 2 * i ; j<=MAXI ; j+=i) perf[j]+=i; } sol = 0; for (i=a;i<=b;i++) sol = sol + max ((long long)i - perf[i] , perf[i] - (long long)i); printf ("%lld",sol); return 0; }

Compilation message (stderr)

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);
     ~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...