답안 #86508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86508 2018-11-26T11:44:29 Z Azamat_Murat Savrsen (COCI17_savrsen) C++14
120 / 120
2235 ms 78880 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define ll long long
//#define int long long
using namespace std;
void boost()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}
void free()
{
	freopen("A.in", "r", stdin);
	freopen("A.out", "w", stdout);
}
ll sum[10000001];
main()
{
	//free();
	boost();
	int a, b;
	cin >> a >> b;
	sum[1] = 1;
	for(int i = 2; i <= 10000000; i++)
		for(int j = i + i; j <= 10000000; j += i)
			sum[j] += i;
	ll ans = 0;
	for(int i = a; i <= b; i++)
		ans += abs(i - sum[i] - 1);
	cout << ans, exit(0);	
}

Compilation message

savrsen.cpp:21:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
savrsen.cpp: In function 'void free()':
savrsen.cpp:17:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("A.in", "r", stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
savrsen.cpp:18:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("A.out", "w", stdout);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2119 ms 78712 KB Output is correct
2 Correct 2061 ms 78712 KB Output is correct
3 Correct 2055 ms 78728 KB Output is correct
4 Correct 2164 ms 78872 KB Output is correct
5 Correct 2193 ms 78872 KB Output is correct
6 Correct 2127 ms 78872 KB Output is correct
7 Correct 2235 ms 78872 KB Output is correct
8 Correct 2142 ms 78880 KB Output is correct