結果
問題 | No.1035 Color Box |
ユーザー | simoji |
提出日時 | 2020-04-26 19:06:47 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,110 bytes |
コンパイル時間 | 1,634 ms |
コンパイル使用メモリ | 167,244 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-04-28 22:01:35 |
合計ジャッジ時間 | 5,342 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
10,624 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; long mod = 0; int getDublicatedPatterns(int cubes, int colors); int main(){ int n,m; cin >> n; cin >> m; //cout << "n " << n << " m " << m << endl; int numInkBottol = m; int numWanabePainted =n; long patterns = 1; mod = (long)pow(10,9)+7; if (numWanabePainted > numInkBottol) { patterns = getDublicatedPatterns(numWanabePainted,numInkBottol); }else{ //インクの種類が十分多い //順番にインクのバケツにいれる。 for (int i = numInkBottol; i > 0; i--){ patterns = patterns * i; patterns = patterns % mod; } } cout << patterns << endl; } int getDublicatedPatterns(int cubes, int colors){ int ret = 1; for(int i = cubes;i>0;i--){ ret = ret*colors; ret = ret % mod; } //cout << "colors " <<colors << " ret " << ret << endl; if(colors > 0){ ret = ret - (colors * getDublicatedPatterns(cubes,colors - 1)); } //cout << "colors " <<colors << " ret " << ret << endl; return ret; }