Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

难道木有人这么做?

Posted by swgr at 2008-08-13 17:36:44 on Problem 2106
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator