結果
| 問題 | No.554 recurrence formula |
| コンテスト | |
| ユーザー |
hamray
|
| 提出日時 | 2017-11-23 23:00:16 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 526 bytes |
| 記録 | |
| コンパイル時間 | 1,496 ms |
| コンパイル使用メモリ | 176,684 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-05-21 12:32:52 |
| 合計ジャッジ時間 | 5,048 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 4 TLE * 1 -- * 10 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int odd(int n){
int temp = 0;
if(n == 1) return 1;
for(int i = n-1; i >=1; i -= 2){
temp += odd(i);
}
return temp * n;
}
int even(int n){
int temp = 0;
if(n == 2) return n * 1;
for(int i = n-1; i>=1; i -= 2){
temp += even(i);
}
return temp * n;
}
int main(){
int n; cin >> n;
int ans = 0;
if(n % 2 == 0){
ans += odd(n);
}else{
ans += even(n);
}
cout << ans << endl;
return 0;
}
hamray