結果
問題 |
No.10 +か×か
|
ユーザー |
👑 |
提出日時 | 2020-01-21 20:33:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 722 bytes |
コンパイル時間 | 822 ms |
コンパイル使用メモリ | 78,836 KB |
実行使用メモリ | 817,456 KB |
最終ジャッジ日時 | 2024-07-06 04:46:12 |
合計ジャッジ時間 | 4,481 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 MLE * 1 -- * 8 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; int n,z; int a[50]; struct dta{ string A; int nw; }; int main(){ cin>>n>>z; for(int i = 0; n > i; i++){ cin>>a[i]; } queue<dta> Z; Z.push({"",a[0]}); while(!Z.empty()){ dta T = Z.front();Z.pop(); //cout << T.A << " " << T.nw << endl; if(T.A.size() == n-1 && T.nw == z){ cout << T.A << endl; return 0; }else if(T.A.size() == n-1){ continue; } if(T.nw+a[T.A.size()+1] <= z){ Z.push({T.A+"+",T.nw+a[T.A.size()+1]}); } if(T.nw*a[T.A.size()+1] <= z){ Z.push({T.A+"*",T.nw*a[T.A.size()+1]}); } } }