結果
| 問題 |
No.648 お や す み
|
| コンテスト | |
| ユーザー |
kotamanegi
|
| 提出日時 | 2018-02-09 22:35:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,299 bytes |
| コンパイル時間 | 1,084 ms |
| コンパイル使用メモリ | 114,436 KB |
| 最終ジャッジ日時 | 2025-01-05 08:13:02 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 79 WA * 5 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#define EVAL 1
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
#define PI 3.1415926535
using namespace std;
long long n;
long long solve(long long now){
if(n > now*(now+1LL)) return 0;
return 1;
}
int main(){
cin >> n;
n *= 2LL;
long long top = sqrt(800000000000000000LL) + 1LL;
long long bot = 0LL;
while(top - bot > 1LL){
long long mid=(top+bot)/2LL;
if(solve(mid) == 0LL){
bot = mid;
}else top = mid;
}
if(top*(top+1LL) == n){
cout << "YES" << endl;
cout << top << endl;
}else if(bot * (bot+1LL) == n){
cout << "YES" << endl;
cout << bot << endl;
}else cout << "NO" << endl;
}
kotamanegi