結果
問題 |
No.648 お や す み
|
ユーザー |
![]() |
提出日時 | 2019-03-22 10:01:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 385 bytes |
コンパイル時間 | 512 ms |
コンパイル使用メモリ | 60,152 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 02:17:14 |
合計ジャッジ時間 | 3,040 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 84 |
ソースコード
#include <iostream> #include <math.h> using ll = long long; #define MOD 1000000007 using namespace std; int main(){ ll n,x; cin >> n; x = (ll)(sqrtl(2 * n + 0.25L) - 0.5); for(ll i = 0; i < 10; i++) { if (n == (x+i)*(x+i+1)/2) { cout << "YES" << endl << x << endl; return 0; } } cout << "NO" << endl; return 0; }