結果

問題 No.1004 サイコロの実装 (2)
ユーザー batsumarubatsumaru
提出日時 2020-03-06 22:52:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 1,601 ms
コンパイル使用メモリ 170,588 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-10-14 09:17:52
合計ジャッジ時間 6,766 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 9 RE * 9 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll a, b, x, n;
  cin >> a >> b >> x >> n;
  ll m = 1LL<<32;
  vector<vector<ll>> cnt(2, vector<ll>(2,0));
  REP(i,n){
    x = a*x % m +b % m;
    cnt[i%2][x%2]++;
  }
  cout << min(cnt[0][0], cnt[0][1]) << " " << min(cnt[1][0], cnt[1][1]) << endl;
}
0