結果
| 問題 | 
                            No.1004 サイコロの実装 (2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bouch
                         | 
                    
| 提出日時 | 2020-03-06 22:46:18 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 912 bytes | 
| コンパイル時間 | 936 ms | 
| コンパイル使用メモリ | 140,544 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-30 16:51:38 | 
| 合計ジャッジ時間 | 1,940 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;
  int c2 = 0;
  m = x;
  rep(i, n){
    m = a * m + b;
    if(i % 2 == 0){
      c1 += m % 6 + 1;
      if(c1%2 == 1){
        ++a1;
      }else{
        ++a2;
      }
    }else{
      c2 += m % 6 + 1;
      if(c2%2 == 1){
        ++b1;
      }else{
        ++b2;
      }
    }
  }
  cout << min(a1, a2) << ' ' << min(b1, b2) << endl;
  return 0;
}
            
            
            
        
            
bouch