結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
ikd
|
| 提出日時 | 2017-04-21 23:57:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 453 bytes |
| コンパイル時間 | 471 ms |
| コンパイル使用メモリ | 59,364 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-07-21 06:10:44 |
| 合計ジャッジ時間 | 3,921 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | -- * 29 |
ソースコード
#include<iostream>
#include<vector>
using namespace std;
#define repeat(i,n) for(int i=0;i<(n);i++)
int N;
vector<int> a;
int r;
void rec(int i, int s){
if(i==N){
r=max(r, s);
return;
}
rec(i+1, s+a[i]);
rec(i+1, s-a[i]);
rec(i+1, s*a[i]);
if(a[i]) rec(i+1, s/a[i]);
}
int main(){
cin>> N;
repeat(i, N){
int _;
cin>> _;
a.push_back(_);
}
rec(1, a[0]);
cout<< r<< endl;
return 0;
}
ikd