結果

問題 No.1665 quotient replace
ユーザー merlinmerlin
提出日時 2021-09-03 21:56:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 702 ms / 3,000 ms
コード長 865 bytes
コンパイル時間 2,996 ms
コンパイル使用メモリ 77,896 KB
実行使用メモリ 112,472 KB
最終ジャッジ日時 2024-05-09 03:39:17
合計ジャッジ時間 17,757 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
42,152 KB
testcase_01 AC 83 ms
41,836 KB
testcase_02 AC 84 ms
42,180 KB
testcase_03 AC 94 ms
42,212 KB
testcase_04 AC 97 ms
42,436 KB
testcase_05 AC 90 ms
42,272 KB
testcase_06 AC 123 ms
43,484 KB
testcase_07 AC 93 ms
42,348 KB
testcase_08 AC 105 ms
43,000 KB
testcase_09 AC 181 ms
45,884 KB
testcase_10 AC 417 ms
67,528 KB
testcase_11 AC 581 ms
95,096 KB
testcase_12 AC 248 ms
53,160 KB
testcase_13 AC 692 ms
111,724 KB
testcase_14 AC 697 ms
111,368 KB
testcase_15 AC 689 ms
111,968 KB
testcase_16 AC 685 ms
112,444 KB
testcase_17 AC 702 ms
112,472 KB
testcase_18 AC 84 ms
41,988 KB
testcase_19 AC 85 ms
42,144 KB
testcase_20 AC 85 ms
42,132 KB
testcase_21 AC 83 ms
42,164 KB
testcase_22 AC 83 ms
41,720 KB
testcase_23 AC 83 ms
41,776 KB
testcase_24 AC 83 ms
42,020 KB
testcase_25 AC 83 ms
42,092 KB
testcase_26 AC 97 ms
42,412 KB
testcase_27 AC 123 ms
43,352 KB
testcase_28 AC 184 ms
46,280 KB
testcase_29 AC 226 ms
49,760 KB
testcase_30 AC 419 ms
86,892 KB
testcase_31 AC 493 ms
95,856 KB
testcase_32 AC 562 ms
93,224 KB
testcase_33 AC 388 ms
64,488 KB
testcase_34 AC 490 ms
86,264 KB
testcase_35 AC 474 ms
85,480 KB
testcase_36 AC 489 ms
86,792 KB
testcase_37 AC 483 ms
85,492 KB
testcase_38 AC 549 ms
88,212 KB
testcase_39 AC 461 ms
83,732 KB
testcase_40 AC 461 ms
84,464 KB
testcase_41 AC 453 ms
83,840 KB
testcase_42 AC 84 ms
42,032 KB
testcase_43 AC 85 ms
42,180 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