結果

問題 No.1256 連続整数列
ユーザー rogi52
提出日時 2020-11-14 01:01:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 1,797 ms
コンパイル使用メモリ 165,600 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-22 22:31:52
合計ジャッジ時間 4,511 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    int A; cin >> A;
    if(A <= 5){
        cout << "NO" << endl;
        return 0;
    }
    int l = 1, r = 2;
    int now = 3;
    while(r < A){
        if(now == A){
            cout << "YES" << endl;
            return 0;
        }else if(now > A){
            now -= l;
            l++;
        }else if(now < A){
            r++;
            now += r;
        }
    }

    cout << "NO" << endl;
}
0