結果

問題 No.481 1から10
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-09-16 15:01:14
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 3,183 ms
コンパイル使用メモリ 74,596 KB
実行使用メモリ 50,192 KB
最終ジャッジ日時 2024-11-08 01:32:34
合計ジャッジ時間 4,317 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No481 {
	public static void main(String[] args) throws IOException, NumberFormatException{
		
		BufferedReader br = new BufferedReader( new InputStreamReader(System.in) );
		String [] str = br.readLine().split(" ");
		int [] InputNum = new int [str.length];  //入力した分と同じ分の配列を用意
		int[] num = {1,2,3,4,5,6,7,8,9}; //検証用
		
		for(int i=0; i<str.length; i++){
			InputNum[i] = Integer.parseInt(str[i]);  //入力した文字としての数字を数値に変換
		}
		
		int count = 0;
		for(int k=0; k<InputNum.length; k++){
			if( num[k]- InputNum[k] != 0 ){ //1~8まで比較して差があれば、それを出力して終了
				System.out.println(k+1);
				break;
			}
			count++;
			if( count == InputNum.length ){  //1~8まで比較しても同じなら、9を書き忘れ
				System.out.println(9);
			}
		}
		
	}
}
0