結果

問題 No.1835 Generalized Monty Hall Problem
ユーザー akasinnakasinn
提出日時 2022-02-11 21:40:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 1,000 ms
コード長 449 bytes
コンパイル時間 1,457 ms
コンパイル使用メモリ 165,048 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 01:26:36
合計ジャッジ時間 2,458 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 12 ms
4,380 KB
testcase_02 AC 12 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 4 ms
4,384 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 15 ms
4,376 KB
testcase_07 AC 12 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 15 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 AC 3 ms
4,384 KB
testcase_14 AC 12 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
const int mod=2147483647;//pow(2,31)-1

int main(){
  ll n,m,k;
  cin>>n>>m>>k;
  ll q=n*(n-k-1);
  for(int i=2;i<=m;i++){
    BACK1:
    if(m%i==0 && q%i==0){
      m/=i;
      q/=i;
      goto BACK1;
    }
  }
  n--;
  for(int i=2;i<=n;i++){
    BACK2:
    if(n%i==0 && q%i==0){
      n/=i;
      q/=i;
      goto BACK2;
    }
  }
  ll p=n*m;
  cout<<p<<' '<<q<<endl;
  return 0;
}
0