結果

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

テストケース

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

ソースコード

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