結果
| 問題 |
No.1330 Multiply or Divide
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-01-08 22:15:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 507 bytes |
| コンパイル時間 | 1,742 ms |
| コンパイル使用メモリ | 190,900 KB |
| 最終ジャッジ日時 | 2025-01-17 12:26:35 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 39 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%llu%llu%llu",&N,&M,&P);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | ULL a; scanf("%llu",&a);
| ~~~~~^~~~~~~~~~~
ソースコード
#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