結果

問題 No.1943 消えたAGCT(1)
ユーザー ks2mks2m
提出日時 2022-05-20 23:48:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 4,375 ms
コンパイル使用メモリ 74,008 KB
実行使用メモリ 60,532 KB
最終ジャッジ日時 2023-10-20 14:43:33
合計ジャッジ時間 11,265 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,368 KB
testcase_01 AC 128 ms
57,700 KB
testcase_02 AC 129 ms
57,352 KB
testcase_03 AC 128 ms
57,628 KB
testcase_04 AC 128 ms
55,620 KB
testcase_05 AC 125 ms
57,284 KB
testcase_06 AC 127 ms
57,836 KB
testcase_07 AC 115 ms
56,196 KB
testcase_08 AC 125 ms
57,256 KB
testcase_09 AC 241 ms
60,380 KB
testcase_10 AC 241 ms
60,320 KB
testcase_11 AC 246 ms
60,384 KB
testcase_12 AC 244 ms
60,256 KB
testcase_13 AC 223 ms
59,848 KB
testcase_14 AC 143 ms
57,536 KB
testcase_15 AC 234 ms
60,404 KB
testcase_16 AC 225 ms
60,312 KB
testcase_17 AC 231 ms
60,416 KB
testcase_18 AC 226 ms
60,332 KB
testcase_19 AC 236 ms
60,368 KB
testcase_20 AC 238 ms
60,532 KB
testcase_21 AC 240 ms
60,420 KB
testcase_22 AC 240 ms
60,400 KB
testcase_23 AC 233 ms
60,352 KB
testcase_24 AC 249 ms
60,296 KB
testcase_25 AC 250 ms
60,284 KB
testcase_26 AC 244 ms
60,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		sc.close();

		for (int i = n - 1; i >= 0; i--) {
			if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') {
				System.out.println(i + 1);
				return;
			}
		}
		System.out.println(0);
	}
}
0