Submission #210441

# Submission time Handle Problem Language Result Execution time Memory
210441 2020-03-17T11:21:20 Z ZwariowanyMarcin Savrsen (COCI17_savrsen) C++14
120 / 120
1140 ms 39544 KB
#include <bits/stdc++.h>
#define LL long long
#define LD long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep2(i, j, n) for (LL i = j; i <= n; ++i)
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define boost cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(), x.end()
#define bignum vector <int>

using namespace std;

const int N = 1e7 + 100;

int a, b;
int sum[N];

int main() {
	scanf ("%d%d", &a, &b);
	rep(i, 1, N / 2)
		for (int j = i + i; j < N; j += i)
			sum[j] += i;
	LL ans = 0;
	rep(i, a, b) ans += abs(i - sum[i]);
	printf ("%lld", ans);
	
	return 0;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d%d", &a, &b);
  ~~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1104 ms 39404 KB Output is correct
2 Correct 1140 ms 39416 KB Output is correct
3 Correct 1109 ms 39500 KB Output is correct
4 Correct 1071 ms 39416 KB Output is correct
5 Correct 1108 ms 39416 KB Output is correct
6 Correct 1082 ms 39544 KB Output is correct
7 Correct 1124 ms 39416 KB Output is correct
8 Correct 1082 ms 39416 KB Output is correct