大家都學過了布林表示式的翻譯,其中有乙個拉鍊-回填技術,這次我們就練習這個技術。
input
多組輸入,首先輸入乙個整數t,代表資料組數。
接下來每組輸入為一行字串,例如: a < b or c < d and e < f
每個符號都用空格間隔。
output
假鏈跳到0,真鏈跳到1,表示式序號從100開始排。
sample input
1
a < b or c < d and e < f
sample output
100(j<,a,b,1)
101(j,_,_,102)
102(j<,c,d,104)
103(j,_,_,0)
104(j<,e,f,100)
105(j,_,_,103)
hint
source
#include using namespace std;
string a,x;
vectord;
int main()
printf("%d(j%s,%s,%s,%d)\n",id,d[n-2].c_str(),d[n-3].c_str(),d[n-1].c_str(),yes);
yes=id++;//記住,下一次回填
printf("%d(j,_,_,%d)\n",id,no);
id++;
d.clear();
if(x=="ed")break;
}else if(x=="and")no+=2;//每geand有兩條語句
else d.push_back(x);//遇到表示式就入棧
}return 0;
}
翻譯布林表示式
翻譯布林表示式time limit 1000 ms memory limit 65536 kib problem description 大家都學過了布林表示式的翻譯,其中有乙個拉鍊 回填技術,這次我們就練習這個技術。input 多組輸入,每組輸入為一行字串,例如 a b or c d and e ...
翻譯布林表示式
time limit 1000 ms memory limit 65536 kib submit statistic problem description 大家都學過了布林表示式的翻譯,其中有乙個拉鍊 回填技術,這次我們就練習這個技術。input 多組輸入,首先輸入乙個整數t,代表資料組數。接下來...
翻譯布林表示式
problem description 大家都學過了布林表示式的翻譯,其中有乙個拉鍊 回填技術,這次我們就練習這個技術。input 多組輸入,首先輸入乙個整數t,代表資料組數。接下來每組輸入為一行字串,例如 a b or c d and e f 每個符號都用空格間隔。output 假鏈跳到 真鏈跳到...