結果
| 問題 |
No.648 お や す み
|
| コンテスト | |
| ユーザー |
Kutimoti_T
|
| 提出日時 | 2018-05-27 10:11:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 439 bytes |
| コンパイル時間 | 1,392 ms |
| コンパイル使用メモリ | 157,180 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 18:24:37 |
| 合計ジャッジ時間 | 3,046 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 79 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
i64 n;
int main(){
cin >> n;
i64 l = 1;
i64 r = (i64)1e9 + 1e5;
while(r - l > 1){
i64 m = (l + r) / 2;
if((m) * (m + 1) / 2 > n){
r = m;
}
else{
l = m;
}
}
if(l * (l + 1) / 2 == n){
cout << "YES" << endl << l << endl;
}
else{
cout << "NO" << endl;
}
}
Kutimoti_T