結果

問題 No.1004 サイコロの実装 (2)
ユーザー sitihisitihi
提出日時 2020-03-06 23:31:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 577 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 163,740 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-22 10:39:28
合計ジャッジ時間 5,496 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,880 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:25: warning: overflow in conversion from 'double' to 'unsigned int' changes value from '4.294967296e+9' to '4294967295' [-Woverflow]
    7 |     unsigned int m = pow(2, 32);
      |                      ~~~^~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    unsigned int a, b, xo, n; 
    int i, tk_b=0, tk_w=0, ak_b=0, ak_w=0, tk=0, ak=0;
    unsigned int m = pow(2, 32); 
    cin >> a >> b >> xo >> n;
    for(i=0; i<n; i++){
      xo = a*xo + b; 
      xo = xo%m;
      tk += xo%6 + 1;
      tk = tk%6;
      if(tk%2 == 0) tk_w++;
      else tk_b++;
      xo = a*xo + b; 
      xo = xo%m;
      ak += xo%6 + 1;
      ak = ak%6;
      if(ak%2 == 0) ak_w++;
      else ak_b++;
    }
    a = min(tk_w, tk_b);
    b = min(ak_w, ak_b);
    cout << a << " " << b << endl;

}
0