結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
![]() |
提出日時 | 2020-10-09 23:55:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 1,000 ms |
コード長 | 2,545 bytes |
コンパイル時間 | 1,722 ms |
コンパイル使用メモリ | 196,564 KB |
最終ジャッジ日時 | 2025-01-15 05:59:41 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 |
ソースコード
#include <bits/stdc++.h> #include <algorithm> // #include <atcoder/all> #include <functional> #include <map> #include <queue> #include <set> #include <stack> using namespace std; // using namespace atcoder; using ll = long long; using ull = unsigned long long; #define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i) #define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i) #define rep(i, n) REP(i, 0, n) #define rep2(i, n) REP2(i, 0, n) #define drep(i, n) for (ll(i) = (ll)(n); i >= 0; i--) #define all(hoge) (hoge).begin(), (hoge).end() #define rall(hoge) (hoge).rbegin(), (hoge).rend() #define en '\n' // using Edge = pair<ll, ll>; // using Graph = vector<vector<Edge>>; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<vector<vector<ll>>> vvvl; typedef vector<string> vs; typedef vector<vector<string>> vvs; typedef pair<ll, ll> P; constexpr long long INF = 1LL << 30; constexpr int INF_INT = 1 << 25; constexpr long long MOD = (ll)1e9 + 7; // constexpr long long MOD = 998244353LL; using ld = long double; static const ld pi = 3.141592653589793L; template <class T> inline void print(T x) { cout << x << '\n'; } template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; } long long lcm(long long x, long long y) { return x / gcd(x, y) * y; } // ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~ // for (int i = 0; i < n; ++i) // cout << res << endl; // cout << res << '\n'; // int型の2次元配列(h×w要素の)の宣言 // vector<vector<int>> data(h, vector<int>(w)); // rotate(s.begin(), s.begin() + 1, s.end()); // sort(all(a),greater<int>()); // s.substr(0,2) 先頭から2文字切り出す // for (auto it = mp.rbegin();it != mp.rend(); ++it) vector<pair<long long, long long> > prime_factorize(long long N) { vector<pair<long long, long long> > res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n,h; cin >> n >> h; ll x = 1; rep(i, n) { ll a; cin >> a; x = (x * a) % h; } if (x == 0)cout << "YES\n"; else cout << "NO\n"; return 0; }