結果
| 問題 |
No.648 お や す み
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-10 00:54:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 261 bytes |
| コンパイル時間 | 648 ms |
| コンパイル使用メモリ | 64,000 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 09:09:06 |
| 合計ジャッジ時間 | 2,603 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 69 WA * 15 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
long n,f,l;
main()
{
cin>>n;l=n;
for(int i=0;i<99;i++)
{
long m=f+l>>1;
if(m*(m+1)/2<0)continue;
else if(m*(m+1)/2<n)f=m;
else l=m;
}
if(l*(l+1)/2==n)
{
cout<<"YES\n"<<l<<endl;
}
else cout<<"NO"<<endl;
}