# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
90719 | Ahmad_Elsisy | Uzastopni (COCI17_uzastopni) | C++14 | 3 ms | 760 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
using namespace std;
typedef long long ll;
int dx[] = {0 , 0 , 1 , -1 , 1 , 1 , -1 , -1};
int dy[] = {1 ,-1 , 0 , 0 , -1 , 1 , 1 , -1};
int main() {
ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
ll N;
cin >> N;
vector<pair<ll , ll> > res;
for(ll cur = 2 ; cur * (cur + 1) / 2 <= N ; ++cur){
if((N * 2) % cur == 0){
ll s = N * 2 / cur;
ll y = (s + cur - 1) / 2;
ll x = y - cur + 1;
if((x + y) * cur / 2 == N)res.pb({x , y});
}
}
for(auto e : res)
cout << e.first << ' ' << e.second << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |