結果

問題 No.1219 Mancala Combo
ユーザー tentententen
提出日時 2021-11-05 19:04:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 1,393 bytes
コンパイル時間 2,250 ms
コンパイル使用メモリ 77,100 KB
実行使用メモリ 47,344 KB
最終ジャッジ日時 2024-04-24 03:08:07
合計ジャッジ時間 7,324 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
37,296 KB
testcase_01 AC 53 ms
37,008 KB
testcase_02 AC 51 ms
36,600 KB
testcase_03 AC 53 ms
36,932 KB
testcase_04 AC 54 ms
36,636 KB
testcase_05 AC 52 ms
37,168 KB
testcase_06 AC 52 ms
36,912 KB
testcase_07 AC 54 ms
36,800 KB
testcase_08 AC 54 ms
36,636 KB
testcase_09 AC 52 ms
37,008 KB
testcase_10 AC 54 ms
36,828 KB
testcase_11 AC 53 ms
37,132 KB
testcase_12 AC 51 ms
36,996 KB
testcase_13 AC 54 ms
37,064 KB
testcase_14 AC 53 ms
37,120 KB
testcase_15 AC 54 ms
37,060 KB
testcase_16 AC 53 ms
37,036 KB
testcase_17 AC 196 ms
44,888 KB
testcase_18 AC 209 ms
45,396 KB
testcase_19 AC 193 ms
44,408 KB
testcase_20 AC 222 ms
45,412 KB
testcase_21 AC 181 ms
44,000 KB
testcase_22 AC 205 ms
45,108 KB
testcase_23 AC 215 ms
45,632 KB
testcase_24 AC 196 ms
44,652 KB
testcase_25 AC 195 ms
44,304 KB
testcase_26 AC 216 ms
44,968 KB
testcase_27 AC 226 ms
46,892 KB
testcase_28 AC 273 ms
47,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int[] values = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            values[i] = sc.nextInt();
        }
        long count = 0;
        for (int i = n; i >= 1; i--) {
            if (values[i] > i || (values[i] + count) % i > 0) {
                System.out.println("No");
                return;
            }
            count += (values[i] + count) / i;
        }
        System.out.println("Yes");
    }
}
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 nextLine() throws Exception {
        return br.readLine();
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0