結果
| 問題 | No.10 +か×か |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-17 16:03:56 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 502 bytes |
| 記録 | |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 66,688 KB |
| 実行使用メモリ | 9,984 KB |
| 最終ジャッジ日時 | 2026-06-06 04:45:08 |
| 合計ジャッジ時間 | 7,581 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 1 -- * 8 |
ソースコード
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;
void dfs(int total,int cur,vector<int> &v,string s){
if(s.size()==v.size()-1){
if(cur==total){
puts(s.c_str());
exit(0);
}
return;
}
if(cur>total)return;
dfs(total,cur+v[s.size()+1],v,s+'+');
dfs(total,cur*v[s.size()+1],v,s+'*');
}
int main(){
int n,total;
scanf("%d%d",&n,&total);
vector<int>v(n);
for(int i=0;i<n;i++)scanf("%d",&v[i]);
dfs(total,v[0],v,"");
}