Submission #371031

#TimeUsernameProblemLanguageResultExecution timeMemory
371031FatihSolakSavrsen (COCI17_savrsen)C++17
0 / 120
1353 ms39660 KiB
#include <bits/stdc++.h> #define N 10000005 using namespace std; int arr[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int a,b; cin >> a >> b; long long sum = 0; for(int i=1;i<N;i++){ for(int j=i+i;j<N;j+=i){ arr[j] -= i; } arr[i]+=i; } for(int i=a;i<=b;i++){ sum += abs(arr[i]); } cout << sum; }

Compilation message (stderr)

savrsen.cpp: In function 'int main()':
savrsen.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    8 |  freopen("in.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
savrsen.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  freopen("out.txt","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...