結果
問題 | No.1250 汝は倍数なりや? |
ユーザー | _umbrella_kasa |
提出日時 | 2021-07-03 10:06:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 76 ms / 1,000 ms |
コード長 | 492 bytes |
コンパイル時間 | 1,299 ms |
コンパイル使用メモリ | 166,316 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 02:59:59 |
合計ジャッジ時間 | 3,543 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; long int H; cin >> N >> H; long int A[N]; for (int i=0; i<N; i++) { cin >> A[i]; if (A[i]>=0) { A[i]=A[i]%H; } else { A[i]=(1000000000*H-A[i])%H; } } long int a=1; for (int i=0; i<N; i++) { a*=A[i]; a=a%H; } if (a==0) { cout << "YES" << endl; } else { cout << "NO" << endl; } }