結果

問題 No.1828 Except 3
ユーザー ripityripity
提出日時 2022-03-16 22:24:36
言語 Java
(openjdk 23)
結果
AC  
実行時間 408 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 74,240 KB
実行使用メモリ 48,104 KB
最終ジャッジ日時 2024-09-25 01:22:22
合計ジャッジ時間 6,074 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    
    public static Scanner sc = new Scanner(System.in);
    public static PrintWriter pw = new PrintWriter(System.out);
    
    public static void main(String[] args) {
        
        int t = 1;
        while( t > 0 ) {
            solve();
            t--;
        }
        
        pw.flush();
        
    }
    
    static void solve() {
        
        int N = sc.nextInt();
        long ans = 1;
        
        for( long i = 0, cnt = 0; i < 3*N; i++ ) {
            int x = sc.nextInt();
            if( x%3 != 0 ) cnt++;
            if( i%N == N-1 ) {
                ans *= cnt;
                cnt = 0;
            }
        }
        
        pw.println(ans);
        
    }
    
}
0