結果
問題 | No.501 穴と文字列 |
ユーザー |
![]() |
提出日時 | 2018-02-13 23:06:31 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 154 ms / 2,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 2,239 ms |
コンパイル使用メモリ | 75,292 KB |
実行使用メモリ | 41,676 KB |
最終ジャッジ日時 | 2024-12-14 09:47:35 |
合計ジャッジ時間 | 5,944 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
import java.util.*;public class Main {static Scanner sc = new Scanner(System.in);public static void main(String[] args) {int leng = sc.nextInt();int hole_num = sc.nextInt();StringBuilder sb = new StringBuilder();if (hole_num==0) {for (int i=0; i<leng; i++) {sb.append("C");}}else if (hole_num <= leng) {for (int i=0; i<leng; i++) {if (hole_num > 0) {sb.append("A");hole_num--;}else {sb.append("C");}}}else {int b_num = hole_num - leng;int a_num = leng - b_num;for (int i=0; i<a_num; i++) {sb.append("A");}for (int i=0; i<b_num; i++) {sb.append("B");}}System.out.println(sb);}}