結果

問題 No.1943 消えたAGCT(1)
ユーザー simansiman
提出日時 2022-05-21 00:15:58
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 245 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 82,940 KB
最終ジャッジ日時 2023-10-20 15:10:40
合計ジャッジ時間 12,892 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
16,084 KB
testcase_01 AC 88 ms
16,080 KB
testcase_02 AC 86 ms
16,084 KB
testcase_03 AC 86 ms
16,084 KB
testcase_04 AC 88 ms
16,084 KB
testcase_05 AC 87 ms
16,084 KB
testcase_06 AC 86 ms
16,080 KB
testcase_07 AC 90 ms
16,084 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 680 ms
82,940 KB
testcase_11 AC 564 ms
82,940 KB
testcase_12 AC 569 ms
82,940 KB
testcase_13 AC 347 ms
40,552 KB
testcase_14 AC 99 ms
16,964 KB
testcase_15 AC 465 ms
81,912 KB
testcase_16 AC 390 ms
51,396 KB
testcase_17 AC 424 ms
76,516 KB
testcase_18 AC 466 ms
81,892 KB
testcase_19 AC 464 ms
81,864 KB
testcase_20 AC 464 ms
81,932 KB
testcase_21 AC 463 ms
81,908 KB
testcase_22 AC 580 ms
78,360 KB
testcase_23 AC 574 ms
78,360 KB
testcase_24 AC 546 ms
82,940 KB
testcase_25 AC 547 ms
82,940 KB
testcase_26 AC 648 ms
82,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
S = gets.chomp

cnt = S.chars.count { |s| s =~ /[AGCT]/ }
f_idx = S.chars.index { |s| s =~ /[AGCT]/ }
l_idx = S.chars.rindex { |s| s =~ /[AGCT]/ }

if cnt == 0
  puts 0
elsif cnt <= l_idx
  puts l_idx + 1
else
  puts f_idx + 1
end
0