結果

問題 No.501 穴と文字列
ユーザー akitsu818akitsu818
提出日時 2017-04-30 19:11:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 400 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 71,508 KB
実行使用メモリ 65,116 KB
最終ジャッジ日時 2023-08-21 07:20:38
合計ジャッジ時間 7,452 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 376 ms
65,020 KB
testcase_01 AC 375 ms
64,944 KB
testcase_02 AC 120 ms
55,784 KB
testcase_03 AC 122 ms
56,228 KB
testcase_04 AC 118 ms
55,956 KB
testcase_05 AC 120 ms
55,548 KB
testcase_06 AC 121 ms
55,536 KB
testcase_07 AC 121 ms
56,104 KB
testcase_08 AC 121 ms
55,952 KB
testcase_09 AC 119 ms
55,748 KB
testcase_10 AC 122 ms
56,032 KB
testcase_11 AC 121 ms
55,744 KB
testcase_12 AC 121 ms
55,988 KB
testcase_13 AC 119 ms
56,152 KB
testcase_14 AC 124 ms
55,844 KB
testcase_15 AC 123 ms
55,720 KB
testcase_16 AC 127 ms
55,856 KB
testcase_17 AC 125 ms
56,080 KB
testcase_18 AC 400 ms
65,116 KB
testcase_19 AC 393 ms
64,720 KB
testcase_20 AC 380 ms
64,988 KB
testcase_21 AC 386 ms
64,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner cin = new Scanner(System.in);

		int size = cin.nextInt();
		int hole = cin.nextInt();
                cin.close();
		if(hole == 2*size){
			for(int i=0;i<size;i++){
				System.out.print("B");
			}
		}else{
			for(int j=0;j<size;j++){
				if(hole == 2*(size-j)){
					System.out.print("B");
					hole-=2;
				}else if(hole > 0){
					System.out.print("A");
					hole--;
				}else{
					System.out.print("C");
				}
			}
		}
		System.out.println("");
	}
}
0