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:why wrong,tell me why?In Reply To:why wrong,tell me why? Posted by:chuanda110 at 2009-11-24 14:18:44 > #include<cstdio> > #include<iostream> > using namespace std; > int s[16]={51200,58386,29184,12544,35968,20032,10016,4880,2248,1252,626,305,140,78,39,19}; > int Min; > void search(int i,int result,int t) > { > if(result==0||result==65535) > { > if(Min>t) > Min=t; > return; > } > if(i>15)return; > search(i+1,result^s[i],t+1); > search(i+1,result,t); > } > int main() > { > char s1[10]; > int n=4; > int temp=0; > while(n--) > { > cin>>s1; > for(int i=0;i<4;i++) > { > if(s1[i]=='b') > { temp*=2;temp+=1;} > else > temp*=2; > } > } > Min=20; > search(0,temp,0); > if(Min==20)printf("Impossible\n"); > else > printf("%d\n",Min); > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator