結果

問題 No.1665 quotient replace
ユーザー merlinmerlin
提出日時 2021-09-03 21:56:10
言語 Java19
(openjdk 21)
結果
AC  
実行時間 629 ms / 3,000 ms
コード長 865 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 74,644 KB
実行使用メモリ 123,144 KB
最終ジャッジ日時 2023-08-21 21:31:42
合計ジャッジ時間 15,890 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
55,076 KB
testcase_01 AC 66 ms
55,480 KB
testcase_02 AC 66 ms
55,020 KB
testcase_03 AC 75 ms
55,368 KB
testcase_04 AC 75 ms
55,512 KB
testcase_05 AC 70 ms
55,312 KB
testcase_06 AC 114 ms
56,396 KB
testcase_07 AC 76 ms
55,292 KB
testcase_08 AC 86 ms
56,300 KB
testcase_09 AC 162 ms
59,684 KB
testcase_10 AC 366 ms
77,712 KB
testcase_11 AC 515 ms
106,132 KB
testcase_12 AC 223 ms
62,288 KB
testcase_13 AC 598 ms
122,828 KB
testcase_14 AC 628 ms
122,812 KB
testcase_15 AC 614 ms
123,144 KB
testcase_16 AC 629 ms
123,088 KB
testcase_17 AC 614 ms
122,860 KB
testcase_18 AC 66 ms
54,968 KB
testcase_19 AC 65 ms
55,248 KB
testcase_20 AC 66 ms
55,352 KB
testcase_21 AC 66 ms
55,000 KB
testcase_22 AC 65 ms
55,024 KB
testcase_23 AC 66 ms
55,104 KB
testcase_24 AC 66 ms
55,168 KB
testcase_25 AC 66 ms
55,088 KB
testcase_26 AC 79 ms
55,472 KB
testcase_27 AC 103 ms
56,420 KB
testcase_28 AC 163 ms
59,348 KB
testcase_29 AC 203 ms
59,684 KB
testcase_30 AC 363 ms
97,928 KB
testcase_31 AC 436 ms
108,152 KB
testcase_32 AC 510 ms
103,936 KB
testcase_33 AC 346 ms
74,624 KB
testcase_34 AC 431 ms
98,164 KB
testcase_35 AC 420 ms
98,028 KB
testcase_36 AC 428 ms
98,236 KB
testcase_37 AC 436 ms
98,088 KB
testcase_38 AC 486 ms
98,808 KB
testcase_39 AC 414 ms
97,112 KB
testcase_40 AC 412 ms
97,364 KB
testcase_41 AC 413 ms
97,164 KB
testcase_42 AC 66 ms
55,156 KB
testcase_43 AC 65 ms
55,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.math.BigInteger;
import java.util.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int N=1000000,i,j,p[]=new int[N+1];
        for(i=2;i<=N;i++)
        if(p[i]==0)
        for(j=i;j<=N;j+=i) p[j]=i;

        int n=Integer.parseInt(bu.readLine()),xor=0;
        String s[]=bu.readLine().split(" ");
        for(i=0;i<n;i++)
        {
            int x=Integer.parseInt(s[i]);
            int c=0,pr;
            while(x!=1)
            {
                pr=p[x];
                while(x%pr==0) {x/=pr; c++;}
            }
            xor^=c;
        }

        if(xor==0) sb.append("black\n");
        else sb.append("white\n");
        System.out.print(sb);
    }
}

0