結果
問題 | No.1256 連続整数列 |
ユーザー |
![]() |
提出日時 | 2020-08-26 18:06:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,438 bytes |
コンパイル時間 | 640 ms |
コンパイル使用メモリ | 92,016 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 01:08:07 |
合計ジャッジ時間 | 1,330 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 4 |
ソースコード
#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 areaint 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の累乗だけ見ればよいです。*/