結果
| 問題 |
No.389 ロジックパズルの組み合わせ
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-07-09 00:20:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 496 bytes |
| コンパイル時間 | 510 ms |
| コンパイル使用メモリ | 61,556 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-13 07:48:51 |
| 合計ジャッジ時間 | 3,498 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 59 WA * 40 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(){
int m;
cin >> m;
int k;
int cnt = 0;
long long int sum = 0;
double res = 1;
while (cin >> k) {
if (k == 0) {
cout << "1" << endl;
return 0;
}
sum += k;
cnt++;
}
m = m - sum - cnt + 1;
if (m < 0) {
cout << "NA" << endl;
return 0;
}
else {
for (int i = 1; i <= cnt; i++) {
res = (i + m)*(res/i);
}
}
cout << (long long int)fmod(res,1000000007) << endl;
return 0;
}
kurenai3110