結果
問題 | No.1004 サイコロの実装 (2) |
ユーザー |
![]() |
提出日時 | 2020-03-06 22:26:59 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 872 bytes |
コンパイル時間 | 931 ms |
コンパイル使用メモリ | 140,928 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 16:51:25 |
合計ジャッジ時間 | 1,904 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 32 |
ソースコード
#include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <string> #include <vector> #include <limits> #include <algorithm> #include <utility> #include <sstream> #include <numeric> #include <iterator> using namespace std; #define repd(i,a,b) for (int i=(a);i<(b);++i) #define rep(i,n) repd(i,0,n) typedef long long ll; typedef pair<int, int> P; int main(int argc, const char * argv[]) { unsigned int n; unsigned int m; int a, b, x; cin >> a >> b >> x >> n; int a1 = 0; int a2 = 0; int b1 = 0; int b2 = 0; int c1 = 0; m = x; rep(i, n){ m = a * m + b; c1 += m % 6 + 1; if(i % 2 == 0){ if(c1%2 == 1){ ++a1; }else{ ++a2; } }else{ if(c1%2 == 1){ ++b1; }else{ ++b2; } } } cout << min(a1, a2) << ' ' << min(b1, b2) << endl; return 0; }