結果

問題 No.481 1から10
ユーザー tsunabittsunabit
提出日時 2018-04-15 13:37:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,137 bytes
コンパイル時間 3,242 ms
コンパイル使用メモリ 72,172 KB
実行使用メモリ 56,680 KB
最終ジャッジ日時 2023-09-09 05:43:00
合計ジャッジ時間 5,351 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,024 KB
testcase_01 AC 120 ms
55,664 KB
testcase_02 AC 118 ms
55,972 KB
testcase_03 AC 119 ms
56,176 KB
testcase_04 AC 118 ms
55,908 KB
testcase_05 AC 121 ms
56,680 KB
testcase_06 AC 121 ms
55,456 KB
testcase_07 AC 120 ms
55,928 KB
testcase_08 AC 119 ms
55,864 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


// 問題文
// A君は左から右に1から10までの数を書くことを試みました。
// しかし、A君は書いた数が9個しかないことに気づきました。
// どうやら書くべき数を1つ書かなかったようです。
// A君が書かなかった数は何でしょうか?
// ***
// 入力
// B1 B2 … B9
// 入力される数の個数はちょうど9個。
// Biは左からi番目の整数。1≤Bi≤10。
// Biの値はすべて異なり、左から右に昇順である。
// ***
// 出力
// 答えとなる数を1行で出力し最後に改行せよ。

public class No489 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        int temp = 0;
        int input;
        for(int i = 0; i < 9; i++) {
            input = sc.nextInt();
            if(temp + 1 != input) {
                temp += 1;
                break;
            }else {
                temp = input;
            }
        }
        System.out.println(temp);
    }
}
0