AtCoder Beginner Contest 012

Submission #3979557

Source codeソースコード

import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        final String s;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            s = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(s);

        int[][] tbl = new int[9][9];

        int sum = 0;

        // 0-indexed
        for (int i = 0; i < tbl.length; i++) {
            for (int j = 0; j < tbl[i].length; j++) {
                tbl[i][j] = (i + 1) * (j + 1);
                sum += tbl[i][j];
            }
        }

        int x = sum - N;

        for (int i = 0; i < tbl.length; i++)
            for (int j = 0; j < tbl[i].length; j++)
                if (tbl[i][j] == x) out.println((i + 1) + " x " + (j + 1));

        out.flush();
    }
}

Submission

Task問題 C - 九九足し算
User nameユーザ名 ShinjiSHIBATA
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1087 Byte
File nameファイル名
Exec time実行時間 73 ms
Memory usageメモリ使用量 20564 KB

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 sample_01.txt,sample_02.txt,test_1953.txt,test_1971.txt,test_1977.txt,test_1983.txt,test_1989.txt,test_1990.txt,test_1993.txt,test_1995.txt,test_1997.txt,test_1998.txt,test_2001.txt,test_2009.txt,test_2013.txt,test_2017.txt,test_2019.txt,test_2020.txt,test_2022.txt,test_2024.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 71 ms 18260 KB
sample_02.txt AC 72 ms 19156 KB
test_1953.txt AC 71 ms 16852 KB
test_1971.txt AC 70 ms 19540 KB
test_1977.txt AC 70 ms 19284 KB
test_1983.txt AC 72 ms 18644 KB
test_1989.txt AC 70 ms 20564 KB
test_1990.txt AC 69 ms 19284 KB
test_1993.txt AC 70 ms 19152 KB
test_1995.txt AC 72 ms 19028 KB
test_1997.txt AC 71 ms 19924 KB
test_1998.txt AC 70 ms 20180 KB
test_2001.txt AC 72 ms 19284 KB
test_2009.txt AC 73 ms 18772 KB
test_2013.txt AC 71 ms 18516 KB
test_2017.txt AC 70 ms 17876 KB
test_2019.txt AC 72 ms 19028 KB
test_2020.txt AC 70 ms 19284 KB
test_2022.txt AC 72 ms 17492 KB
test_2024.txt AC 73 ms 18132 KB