結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
ku_material_ro
|
| 提出日時 | 2016-10-23 19:42:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 583 bytes |
| コンパイル時間 | 641 ms |
| コンパイル使用メモリ | 70,744 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 02:04:42 |
| 合計ジャッジ時間 | 2,296 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 RE * 1 |
| other | AC * 5 WA * 10 RE * 5 |
ソースコード
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
int kaijo(int n){
long long ans = 1;
if (n != 0){
for (int i = 0; i < n; i++){
ans *= (n - i);
}
}
else{
ans = 1;
}
return ans;
}
int main(){
int n;
int cnt1 = 0;
int cnt2 = 0;
long long cntp = 0;
cin >> n;
cnt2 = n / 2;
if ((n / 2) * 2 == n){
cnt1 = 0;
}
else{
cnt1 = 1;
}
while (1){
if (cnt2 == 0) {
cntp += 1;
break;
}
cntp += kaijo(cnt2 + cnt1) / (kaijo(cnt1)*kaijo(cnt2));
cnt2 -= 1;
cnt1 += 2;
}
cout << cntp << endl;
return 0;
}
ku_material_ro