結果
問題 |
No.554 recurrence formula
|
ユーザー |
![]() |
提出日時 | 2017-11-23 23:00:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 526 bytes |
コンパイル時間 | 1,318 ms |
コンパイル使用メモリ | 159,588 KB |
実行使用メモリ | 18,112 KB |
最終ジャッジ日時 | 2024-11-27 05:59:28 |
合計ジャッジ時間 | 35,190 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 4 TLE * 11 |
ソースコード
#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; }