結果
| 問題 | No.648 お や す み |
| コンテスト | |
| ユーザー |
sewoiwataki
|
| 提出日時 | 2018-02-17 01:29:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 296 bytes |
| コンパイル時間 | 644 ms |
| コンパイル使用メモリ | 59,088 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 21:10:12 |
| 合計ジャッジ時間 | 2,653 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 84 |
ソースコード
#include<iostream>
#include<math.h>
using namespace std;
// N=n(n+1)/2
// 2N=n(n+1)
// -->(int)√N * (int)√N +1 ?
int main(){
long long n;
cin>>n;
if((long long)sqrt(2*n)*((long long)sqrt(2*n)+1)==2*n) cout<<"YES"<<endl<<(long long)sqrt(2*n)<<endl;
else cout<<"NO"<<endl;
}
sewoiwataki