結果

問題 No.1330 Multiply or Divide
ユーザー gmm_teagmm_tea
提出日時 2021-01-08 22:07:35
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 26,240 KB
最終ジャッジ日時 2024-04-28 03:15:27
合計ジャッジ時間 7,448 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 159 ms
25,600 KB
testcase_02 AC 76 ms
12,032 KB
testcase_03 AC 76 ms
12,288 KB
testcase_04 AC 76 ms
12,288 KB
testcase_05 AC 78 ms
12,288 KB
testcase_06 AC 161 ms
25,472 KB
testcase_07 WA -
testcase_08 AC 163 ms
25,984 KB
testcase_09 AC 167 ms
25,728 KB
testcase_10 AC 160 ms
25,856 KB
testcase_11 AC 159 ms
25,984 KB
testcase_12 AC 164 ms
25,856 KB
testcase_13 AC 74 ms
12,160 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 75 ms
12,160 KB
testcase_17 WA -
testcase_18 AC 149 ms
25,984 KB
testcase_19 AC 146 ms
25,984 KB
testcase_20 AC 148 ms
26,112 KB
testcase_21 AC 144 ms
25,856 KB
testcase_22 AC 144 ms
25,856 KB
testcase_23 AC 163 ms
26,240 KB
testcase_24 AC 77 ms
12,032 KB
testcase_25 AC 76 ms
12,160 KB
testcase_26 AC 73 ms
12,288 KB
testcase_27 AC 75 ms
12,288 KB
testcase_28 AC 76 ms
12,032 KB
testcase_29 AC 78 ms
12,032 KB
testcase_30 AC 75 ms
12,288 KB
testcase_31 AC 75 ms
12,032 KB
testcase_32 AC 76 ms
12,032 KB
testcase_33 AC 75 ms
12,032 KB
testcase_34 AC 138 ms
22,528 KB
testcase_35 AC 91 ms
14,848 KB
testcase_36 AC 122 ms
21,376 KB
testcase_37 AC 117 ms
20,736 KB
testcase_38 AC 113 ms
17,280 KB
testcase_39 AC 100 ms
15,616 KB
testcase_40 AC 102 ms
16,256 KB
testcase_41 AC 85 ms
14,080 KB
testcase_42 AC 116 ms
19,968 KB
testcase_43 AC 118 ms
21,120 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n,m,q=gets.split.map(&:to_i)
m+=1
a=gets.split.map(&:to_i)
if a.max>=m
  puts 1
  exit
end
mq=0
nq=0
a.each do |aa|
  if aa%q==0
    mq=aa if mq<aa
  else
    nq=aa if nq<aa
  end
end
c=0
if mq>0&&mq>nq
  m=(m-1)/mq+1
  c=1
end
if m>1&&nq<=1
  puts "-1"
  exit
end
x=1
while x<m
  x*=nq
  c+=1
end
puts c
0