結果
| 問題 | No.1330 Multiply or Divide |
| コンテスト | |
| ユーザー |
👑 Nachia
|
| 提出日時 | 2021-01-08 21:38:46 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 507 bytes |
| 記録 | |
| コンパイル時間 | 1,326 ms |
| コンパイル使用メモリ | 208,484 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-16 10:47:52 |
| 合計ジャッジ時間 | 3,078 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 WA * 13 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
ULL N,M,P;
ULL maxA,maxB;
int main(){
scanf("%llu%llu%llu",&N,&M,&P);
maxA=1; maxB=1;
rep(i,N){
ULL a; scanf("%llu",&a);
maxA=max(maxA,a);
while(a%P==0) a/=P;
maxB=max(maxB,a);
}
ULL x=1;
if(maxA>=M){ printf("1\n"); return 0; }
if(maxB==1){ printf("-1\n"); return 0; }
ULL ans=1;
while(x*maxA<M){ x*=maxB; ans++; }
printf("%llu\n",ans);
return 0;
}
Nachia