結果

問題 No.648  お や す み 
ユーザー Aquarius
提出日時 2018-11-04 19:09:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,367 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 55,100 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-20 20:03:16
合計ジャッジ時間 31,018 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

long n;
int main() {
	cin >> n;
	n *= 2;
	for (int i = 1; i <= 2000000000; ++i) {
		long k = (long)i * (i + 1);	
    	if (k >= n) {
        	if (k == n) {
            	cout << "YES" << endl;
            	cout << i << endl;
            } else {
				cout << "NO" << endl;
            }
        	return 0;
        }
    }
}
0