結果

問題 No.1764 Square
ユーザー merlinmerlin
提出日時 2021-11-26 22:25:09
言語 Java19
(openjdk 21)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 75,240 KB
実行使用メモリ 49,908 KB
最終ジャッジ日時 2023-09-12 05:07:28
合計ジャッジ時間 3,187 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,604 KB
testcase_01 AC 41 ms
49,440 KB
testcase_02 AC 41 ms
49,668 KB
testcase_03 AC 41 ms
49,524 KB
testcase_04 AC 42 ms
48,080 KB
testcase_05 AC 42 ms
49,908 KB
testcase_06 AC 42 ms
49,588 KB
testcase_07 AC 42 ms
49,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine());
        Queue<Character> q[]=new LinkedList[4];
        int i;
        for(i=0;i<4;i++) q[i]=new LinkedList<>();
        q[0].add('A'); q[0].add('E');
        q[1].add('B'); q[2].add('C'); q[3].add('D');
        for(i=0;i<n;i++)
        q[(i+1)%4].add(q[i%4].poll());

        for(i=0;i<4;i++)
        {
            while(!q[i].isEmpty()) sb.append(q[i].poll());
            sb.append("\n");
        }
        System.out.print(sb);
    }
}
0