답안 #152365

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152365 2019-09-07T19:20:47 Z sofhiasouza Uzastopni (COCI17_uzastopni) C++14
80 / 80
38 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int maxi = 2e5;

int main()
{
	ll n;

	cin >> n;

	for(int i = 2 ; i <= maxi and i <= n ; i++)
	{
		ll ini = i, fim = n;
		while(ini <= fim)
		{
			ll meio = (ini+fim)/2;
			double r = (meio+(meio-i+1))*i/2;
			if(r == n)
			{
				cout << meio-i+1 << ' ' << meio << "\n";
				break;
			}
			else if(r < n) ini = meio+1;
			else fim = meio-1;
		} 
	}	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 8 ms 376 KB Output is correct
5 Correct 14 ms 376 KB Output is correct
6 Correct 18 ms 256 KB Output is correct
7 Correct 20 ms 504 KB Output is correct
8 Correct 23 ms 256 KB Output is correct
9 Correct 28 ms 376 KB Output is correct
10 Correct 38 ms 256 KB Output is correct