| ||||||||||
| 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 | |||||||||
Re:和你一样崩溃中In Reply To:Re:和你一样崩溃中 Posted by:acmpeishuai at 2008-07-27 17:37:39 > #include<iostream>
> using namespace std;
> #include<fstream>
>
> void shaixuan(int & m,int& n,int c,char op,int & x)
> {
> if(op=='AND'&&c==1)
> {
> if(m==-1&&n==-1)
> {
> m=n=1; x=-1;
> }
> else if(m==0||n==0)
> {
> cout<<"NO"<<endl; exit(0);
> }
> }//-----------------------------------------------------------
> if(op=='OR'&&c==0)
> {
> if(m==-1&&n==-1)
> {
> m=n=0; x=-1;
> }
> else if(m==1||n==1)
> {
> cout<<"NO"<<endl; exit(0);
> }
> }//----------------------------------------------------------
> if(op=='XOR'&&c==0)
> {
> if(m==1&&n==0||m==0&&n==1)
> {
> cout<<"NO"<<endl; exit(0);
> }
> if(m==1&&n==-1)
> {
> n=1; x=-1;
> }
>
> else if(m==0&&n==-1)
> {
> n=0; x=-1;
> }
>
> else if(m==-1&&n==1)
> {
> m=1; x=-1;
> }
>
> else if(m==-1&&n==0)
> {
> m=0; x=-1;
> }
>
>
> }
> if(op=='XOR'&&c==1)
> {
> if(m==1&&n==1||m==0&&n==0)
> {
> cout<<"NO"<<endl;
> }
> else if(m==1&&n==-1)
> { n=0; x=-1;}
> else if(m==0&&n==-1)
> { n=1;x=-1;}
>
> else if(m==-1&&n==1)
> { m=0; x=-1;}
> else if(m==-1&&n==0)
> { m=1;x=-1;}
>
> }
> }
>
> struct info
> {
> int m;
> int n;
> int c;
> char op;
> int flag;
> } ;
>
>
> int main()
> {
> ifstream fin("11.in");
> struct info edge[10000];
> int i;
> int x[1000];
> int n,m;
> fin>>n>>m;
> for(i=0;i<m;i++)
> {
> fin>>edge[i].m>>edge[i].n>>edge[i].c>>edge[i].op;
> edge[i].flag =0;
> shaixuan ( x[edge[i].m] , x[edge[i].n] , edge[i].c ,edge[i].op ,edge[i].flag );
> }
>
> cout<<"YES"<<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