AtCoder Regular Contest 082

Submission #1591925

Source codeソースコード

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner read=new Scanner(System.in);
        int num=read.nextInt();
        int count=0;
        int i;
        for(i=1; i<num; i++){
            int a=read.nextInt();

            if (a==i){
                count++;
            i++;
            a=read.nextInt();

            }

        }
        if(i!=num+1) {
            int last = read.nextInt();
            if (last == num) {
                count++;
            }
        }

        System.out.println(count);
    }
}

Submission

Task問題 D - Derangement
User nameユーザ名 lucy2903
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 AC
Score得点 400
Source lengthソースコード長 602 Byte
File nameファイル名
Exec time実行時間 434 ms
Memory usageメモリ使用量 48084 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_000.txt,0_001.txt,0_002.txt,0_003.txt
All 400 / 400 0_000.txt,0_001.txt,0_002.txt,0_003.txt,1_004.txt,1_005.txt,1_006.txt,1_007.txt,1_008.txt,1_009.txt,1_010.txt,1_011.txt,1_012.txt,1_013.txt,1_014.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_000.txt AC 98 ms 22740 KB
0_001.txt AC 91 ms 19796 KB
0_002.txt AC 91 ms 18388 KB
0_003.txt AC 91 ms 18644 KB
1_004.txt AC 102 ms 18644 KB
1_005.txt AC 421 ms 46912 KB
1_006.txt AC 431 ms 42100 KB
1_007.txt AC 397 ms 48084 KB
1_008.txt AC 381 ms 46452 KB
1_009.txt AC 434 ms 43276 KB
1_010.txt AC 402 ms 47104 KB
1_011.txt AC 405 ms 42108 KB
1_012.txt AC 407 ms 42804 KB
1_013.txt AC 417 ms 45096 KB
1_014.txt AC 400 ms 44508 KB