답안 #86449

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86449 2018-11-26T10:28:05 Z Pluton Savrsen (COCI17_savrsen) C++14
60 / 120
3000 ms 504 KB
#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define sz size()
#define all(xx) xx.begin(),xx.end()
#define pb push_back
#define in insert
#define er erase
#define S second
#define F first
#define pii pair <int, int>
#define to_be continue
#define mp make_pair
#define stop exit (0)
#define fname ""
#define speed ios_base::sync_with_stdio(0);cin.tie(0)
#define input freopen (fname".in", "r", stdin)
#define output freopen (fname".out", "w", stdout)
#define int ll
#define N 10200000

using namespace std;

const int inf = 1e9 + 123;
const ll INF = 1e18 + 123;
const double pi = acos (-1.0);
const ld eps = 1e-3;

ll a, b, ans, sum;

main ()
{
	speed;
	cin >> a >> b;            
	for (int i = a; i <= b; i ++)
	{
		sum = i;
		if (i != 1)
			sum --;
		for (int j = 2; j * j <= i; j ++)
		{
			if (i % j == 0)
			{
				sum -= j + (i / j);
				if (i / j == j)
					sum += j;
			} 
		}
		sum = abs (sum);
		//cout << sum << endl;
		ans += sum;
	}
	cout << ans;
}
//Coded by A....

Compilation message

savrsen.cpp:32:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main ()
       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 282 ms 500 KB Output is correct
4 Correct 41 ms 500 KB Output is correct
5 Execution timed out 3038 ms 504 KB Time limit exceeded
6 Execution timed out 3039 ms 504 KB Time limit exceeded
7 Execution timed out 3042 ms 504 KB Time limit exceeded
8 Execution timed out 3029 ms 504 KB Time limit exceeded