結果
問題 | No.8081 HQ9+ |
ユーザー |
![]() |
提出日時 | 2021-04-01 20:22:48 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 193 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-12-18 02:03:00 |
合計ジャッジ時間 | 2,600 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
コンパイルメッセージ
Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
n=gets.to_i s=gets.chomp q=s.count(?Q) w=(q**0.5).to_i if q==0 || q!=w**2 || n%w>0 ||s[/[H9]/] puts -1 exit end t=s.scan(/.{1,#{n/w}}/).sort if t[0]!=t[t.size-1] puts -1 else puts t[0] end