結果

問題 No.1004 サイコロの実装 (2)
ユーザー ks2mks2m
提出日時 2020-03-06 22:43:34
言語 Java19
(openjdk 21)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 3,562 ms
コンパイル使用メモリ 77,144 KB
実行使用メモリ 56,784 KB
最終ジャッジ日時 2023-08-04 12:20:52
合計ジャッジ時間 10,352 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
56,020 KB
testcase_01 AC 133 ms
55,904 KB
testcase_02 AC 135 ms
56,368 KB
testcase_03 AC 132 ms
56,692 KB
testcase_04 AC 136 ms
55,860 KB
testcase_05 AC 136 ms
55,800 KB
testcase_06 AC 136 ms
56,144 KB
testcase_07 AC 133 ms
56,144 KB
testcase_08 AC 135 ms
56,120 KB
testcase_09 AC 134 ms
56,764 KB
testcase_10 AC 132 ms
56,480 KB
testcase_11 AC 131 ms
55,928 KB
testcase_12 AC 132 ms
56,176 KB
testcase_13 AC 131 ms
55,628 KB
testcase_14 AC 131 ms
55,776 KB
testcase_15 AC 132 ms
56,672 KB
testcase_16 AC 129 ms
56,148 KB
testcase_17 AC 132 ms
56,252 KB
testcase_18 AC 132 ms
56,116 KB
testcase_19 AC 134 ms
55,936 KB
testcase_20 AC 128 ms
56,212 KB
testcase_21 AC 130 ms
56,188 KB
testcase_22 AC 129 ms
56,096 KB
testcase_23 AC 130 ms
56,208 KB
testcase_24 AC 131 ms
55,900 KB
testcase_25 AC 134 ms
55,828 KB
testcase_26 AC 133 ms
55,936 KB
testcase_27 AC 132 ms
56,224 KB
testcase_28 AC 132 ms
55,888 KB
testcase_29 AC 131 ms
55,932 KB
testcase_30 AC 132 ms
56,124 KB
testcase_31 AC 132 ms
55,956 KB
testcase_32 AC 134 ms
56,072 KB
testcase_33 AC 132 ms
55,900 KB
testcase_34 AC 134 ms
56,104 KB
testcase_35 AC 133 ms
56,784 KB
testcase_36 AC 135 ms
56,144 KB
testcase_37 AC 133 ms
56,260 KB
testcase_38 AC 139 ms
55,888 KB
testcase_39 AC 136 ms
56,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long[] x = new long[7];
		x[0] = sc.nextLong();
		long n = sc.nextLong();
		sc.close();

		long m = 1L << 32;
		for (int i = 1; i < x.length; i++) {
			x[i] = toBI(a).multiply(toBI(x[i - 1])).mod(toBI(m)).longValue();
			x[i] += b;
			x[i] %= m;
		}
		for (int i = 1; i < x.length; i++) {
			x[i]++;
		}

		if (x[1] % 2 == 1) {
			System.out.println(n / 2 + " 0");
		} else {
			System.out.println("0 " + n / 2);
		}
	}

	static BigInteger toBI(long x) {
		return BigInteger.valueOf(x);
	}
}
0