| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
难道木有人这么做?#include<iostream>
#include<string>
using namespace std;
string rep[14][2] =
{
" ","",
"!!","",
"(V)","V",
"(F)","F",
"!V","F",
"!F","V",
"V&V","V",
"V&F","F",
"F&V","F",
"F&F","F",
"V|V","V",
"V|F","V",
"F|V","V",
"F|F","F"
};
string s;
int main()
{
int i,t,count=1;
while(getline(cin,s))
{
while (1)
{
for(i=0;i<14;i++)
if((t=s.find(rep[i][0]))!=string::npos)
{
s.erase(t,rep[i][0].length());
s.insert(t,rep[i][1]);
break;
}
if (i==14) break;
}
cout<<"Expression "<<count++<<": "<<s<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator