結果

問題 No.501 穴と文字列
ユーザー shinwisteria
提出日時 2017-04-08 10:56:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 3,670 ms
コンパイル使用メモリ 75,380 KB
実行使用メモリ 41,956 KB
最終ジャッジ日時 2024-12-14 16:30:34
合計ジャッジ時間 7,822 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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