結果

問題 No.22 括弧の対応
ユーザー カニ戯(ryカニ戯(ry
提出日時 2015-02-26 17:02:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 291 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 71,884 KB
実行使用メモリ 56,704 KB
最終ジャッジ日時 2023-09-27 12:50:44
合計ジャッジ時間 5,019 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,960 KB
testcase_01 AC 112 ms
56,080 KB
testcase_02 AC 116 ms
55,920 KB
testcase_03 AC 131 ms
55,668 KB
testcase_04 AC 128 ms
56,704 KB
testcase_05 AC 130 ms
55,824 KB
testcase_06 AC 129 ms
55,904 KB
testcase_07 AC 135 ms
56,056 KB
testcase_08 AC 134 ms
56,064 KB
testcase_09 AC 133 ms
55,952 KB
testcase_10 AC 129 ms
55,916 KB
testcase_11 AC 124 ms
56,032 KB
testcase_12 AC 131 ms
55,780 KB
testcase_13 AC 127 ms
55,900 KB
testcase_14 AC 125 ms
55,868 KB
testcase_15 AC 128 ms
56,084 KB
testcase_16 AC 129 ms
56,384 KB
testcase_17 AC 112 ms
56,028 KB
testcase_18 AC 110 ms
55,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main {
	public static void main(String[] a) {
		Scanner s=new Scanner(System.in);
		s.nextInt();
		int K=s.nextInt()-1,i,D,L=1;
		String P=s.next();
		D=81-2*P.charAt(K);
		for(i=K+D;0!=(L+=D*(81-2*P.charAt(i)));i+=D);
		System.out.println(i+1);
	}
}
0