結果

問題 No.1971 Easy Sudoku
ユーザー tentententen
提出日時 2022-06-13 11:02:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 1,218 bytes
コンパイル時間 2,874 ms
コンパイル使用メモリ 77,724 KB
実行使用メモリ 53,852 KB
最終ジャッジ日時 2023-10-25 09:23:54
合計ジャッジ時間 4,585 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,220 KB
testcase_01 AC 56 ms
53,236 KB
testcase_02 AC 61 ms
53,228 KB
testcase_03 AC 59 ms
53,236 KB
testcase_04 AC 65 ms
53,228 KB
testcase_05 AC 56 ms
51,196 KB
testcase_06 AC 57 ms
53,228 KB
testcase_07 AC 80 ms
53,852 KB
testcase_08 AC 57 ms
52,240 KB
testcase_09 AC 57 ms
53,232 KB
testcase_10 AC 61 ms
53,240 KB
testcase_11 AC 55 ms
53,224 KB
testcase_12 AC 56 ms
52,184 KB
testcase_13 AC 72 ms
53,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (j > 0) {
                    sb.append(" ");
                }
                sb.append((i + j) % n + 1);
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0