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:试一下用cin.In Reply To:试一下用cin. Posted by:keeng2008 at 2008-03-29 13:56:35 #include <iostream> using namespace std; int main() { char ch; int t,i,j,n,m,k; int h,v,d; cin>>t; for(k=0;k<t;k++) { cin>>n>>m; int count=0,flag=1; while(cin>>ch&&ch=='.'&&count<(m*n-1)) count++; count++; if(ch=='-'&&count!=n*m) { cin>>ch; count++; if(count%m!=0) { for(i=count%m;i<m;i++,count++) { cin>>ch; if(ch!='.'&&ch!='-') flag=0; } } for(i=count;i<n*m;i++) { cin>>ch; if(ch!='.') flag=0; } } else if(ch=='|'&&count!=m*n) { v=count; while(count<m*n) { cin>>ch; count++; if(ch=='|') { if((count-v)%m!=0) flag=0; } else if(ch!='.') flag=0; } } else if(ch=='\\'&&count!=n*m) { d=count; while(count<n*m) { cin>>ch; count++; if(ch=='\\') { if(count!=d) flag=0; else d+=(m+1); } else if(ch!='.') flag=0; if(count%m==0) d+=(m+1); } } else if(ch=='/'&&count!=m*n) { h=count; if(count%m==0) h+=(m-1); while(count<n*m) { cin>>ch; count++; if(ch=='/') { if(count!=h) flag=0; else h+=m-1; } else if(ch!='.') flag=0; if(count%m==0) h+=(m-1); } } else if(count!=n*m) flag=0; if(flag) cout<<"CORRECT"<<endl; else cout<<"INCORRECT"<<endl; } } 不行啊,好心人来瞧瞧 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator