結果
問題 | No.1256 連続整数列 |
ユーザー |
|
提出日時 | 2020-10-16 21:59:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,183 bytes |
コンパイル時間 | 1,966 ms |
コンパイル使用メモリ | 190,952 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 01:24:07 |
合計ジャッジ時間 | 2,850 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 4 |
ソースコード
#define _GLIBCXX_DEBUG#include<bits/stdc++.h>#include<algorithm>//next_permutation#define rep(i,n) for (int i = 0;i < (n);i++)#define all(v) v.begin(),v.end()#define dec(n) cout << fixed << setprecision(n);#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"#define small "abcdefghijklmnopqrstuvwxyz"using namespace std;using ll = long long;using P = pair<ll,ll>;using vl = vector<ll>;using vvl = vector<vl>;ll gcd(ll a,ll b){if(b == 0) return a;return gcd(b , a % b);}const ll MOD = 1000000007;const ll MAX = 2000001;ll mod(ll a){return a % MOD;}ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}vector<pair<ll,ll>> prime_factorize(ll n){vector<pair<ll,ll>> res;for(ll i=2; i*i <= n; i++){if(n % i != 0) continue;ll ex = 0;while(n % i == 0){ex++;n /= i;}res.push_back({i,ex});}if(n != 1) res.push_back({n,1});return res;}int main(){ll a; cin >> a;for(ll i=3; i <= a; i++){if(i*(i+1)/2 > a){cout << "NO" << endl;return 0;}if((a-i*(i+1)/2) % i == 0){cout << "YES" << endl;return 0;}}cout << "NO" << endl;}