結果

問題 No.501 穴と文字列
ユーザー shinwisteriashinwisteria
提出日時 2017-04-08 10:56:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 3,696 ms
コンパイル使用メモリ 72,652 KB
実行使用メモリ 56,284 KB
最終ジャッジ日時 2023-08-21 07:14:44
合計ジャッジ時間 7,652 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,732 KB
testcase_01 AC 132 ms
55,460 KB
testcase_02 AC 119 ms
56,284 KB
testcase_03 AC 119 ms
55,780 KB
testcase_04 AC 119 ms
55,624 KB
testcase_05 AC 121 ms
55,732 KB
testcase_06 AC 120 ms
55,672 KB
testcase_07 AC 119 ms
55,768 KB
testcase_08 AC 119 ms
55,412 KB
testcase_09 AC 121 ms
55,584 KB
testcase_10 AC 124 ms
55,904 KB
testcase_11 AC 122 ms
55,748 KB
testcase_12 AC 120 ms
55,864 KB
testcase_13 AC 120 ms
55,640 KB
testcase_14 AC 119 ms
55,836 KB
testcase_15 AC 124 ms
55,660 KB
testcase_16 AC 122 ms
55,712 KB
testcase_17 AC 120 ms
55,504 KB
testcase_18 AC 135 ms
55,728 KB
testcase_19 AC 133 ms
55,692 KB
testcase_20 AC 134 ms
55,680 KB
testcase_21 AC 136 ms
55,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class AnatoMojiretsu {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int N = s.nextInt() , D = s.nextInt();
		s.close();
		StringBuilder str = new StringBuilder();
		while(N != 0){
			if(D == 2*N){
				str.append("B");
				D -= 2;
				N--;
			}else if(D != 0){
				str.append("A");
				D--;
				N--;
			}else{
				str.append("C");
				N--;
			}
		}
		System.out.println(str);

	}

}
0