結果
問題 | No.501 穴と文字列 |
ユーザー |
|
提出日時 | 2017-04-09 11:15:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 151 ms / 2,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 3,669 ms |
コンパイル使用メモリ | 74,972 KB |
実行使用メモリ | 54,280 KB |
最終ジャッジ日時 | 2024-12-14 16:31:07 |
合計ジャッジ時間 | 7,636 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
import java.io.*;import java.util.*;public class Main_yukicoder501 {private static Scanner sc;private static Printer pr;private static void solve() {int n = sc.nextInt();int d = sc.nextInt();int b = Math.max(0, d - n);int a = d - 2 * b;int c = n - (a + b);StringBuilder ret = new StringBuilder();while (a-- > 0) {ret.append('A');}while (b-- > 0) {ret.append('B');}while (c-- > 0) {ret.append('C');}pr.println(ret);}// ---------------------------------------------------public static void main(String[] args) {sc = new Scanner(System.in);pr = new Printer(System.out);solve();pr.close();sc.close();}private static class Printer extends PrintWriter {Printer(PrintStream out) {super(out);}}}