結果

問題 No.1004 サイコロの実装 (2)
ユーザー totori_nyaa
提出日時 2020-03-06 21:30:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 166,472 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-10-14 04:15:47
合計ジャッジ時間 5,222 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    unsigned int a,b,x;
    ll n;
    cin>>a>>b>>x>>n;
    int t=0,v=0;
    unsigned int bl[2]={},w[2]={};
    for(unsigned int i=0;i<n;i++){
        x = a*x+b;
        t += x;
        x = a*x+b;
        v+=x;
        if(t&1)bl[0]++;
        else w[0]++;
        if(v&1)bl[1]++;
        else w[1]++;
    }
    cout << min(bl[0],w[0]) << " " << min(bl[1],w[1]) << endl;
    
}
0