結果

問題 No.1256 連続整数列
ユーザー Kak1_n0_taneKak1_n0_tane
提出日時 2020-08-26 18:06:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,438 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 91,888 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-28 06:45:08
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,504 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
//typedef long long ll;
//typedef long double ld;
//typedef unsigned long long ull;
//typedef unsigned long double uld;
typedef pair<int,int> P;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
//struct area

//function area

//main area
int main(){
    int a;
    cin >> a;
    bool res = false;
    for(int k=3; k<=1e4; k++){
        if(k%2==0){
            if(a%k * 2 == a){
                res = true;
            }
        }
        else{
            if(a%k == 0){
                res = true;
            }
        }
    }
    cout << (res ? "YES" : "NO") << endl;
}
/*

奇数の場合
奇数(2a+1, 0<a)個連続する整数の和として表される → その奇数で割り切れる
具体的に、akだったら、kを中心とする連続するa個の整数の和で表される

偶数の場合
2nとすると、n(mod2n)であればよい

普通に全探索で良さそうです。

一応、偶数の場合は2の累乗だけ見ればよいです。

*/
0