結果
| 問題 |
No.1004 サイコロの実装 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-06 18:51:29 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 2,000 ms |
| コード長 | 632 bytes |
| コンパイル時間 | 2,217 ms |
| コンパイル使用メモリ | 83,756 KB |
| 実行使用メモリ | 41,688 KB |
| 最終ジャッジ日時 | 2024-10-14 03:03:52 |
| 合計ジャッジ時間 | 8,946 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 38 |
ソースコード
// 制約の確認
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run() {
Scanner sc=new Scanner(System.in);
long a=sc.nextLong();
long b=sc.nextLong();
long x0=sc.nextLong();
long N=sc.nextLong();
if(!(0<=a&&0<=b&&0<=x0&&0<=N&&a<(1L<<32)&&b<(1L<<32)&&x0<(1L<<32)&&N<(1L<<32)))throw new AssertionError();
if(!(a%4==1&&b%2==1))throw new AssertionError();
long x1=(a*x0+b)%6+1;
System.out.println(x1%2==0?(0+" "+N/2):(N/2+" "+0));
}
void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}