結果
問題 | No.501 穴と文字列 |
ユーザー |
![]() |
提出日時 | 2019-11-17 20:58:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 620 bytes |
コンパイル時間 | 2,247 ms |
コンパイル使用メモリ | 74,720 KB |
実行使用メモリ | 56,112 KB |
最終ジャッジ日時 | 2024-09-25 06:08:56 |
合計ジャッジ時間 | 6,340 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int d = sc.nextInt(); StringBuilder sb = new StringBuilder(); if (d > n) { for (int i = 0; i < n; i++) { if (i < n - (d - n)) { sb.append("A"); } else { sb.append("B"); } } } else { for (int i = 0; i < n; i++) { if (i < d) { sb.append("A"); } else { sb.append("C"); } } } System.out.println(sb); } }