| ||||||||||
| 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 | |||||||||
...WHY TLE???help~~~#include<iostream>
#include<string>
using namespace std;
int main(){
string no,w,b;
char qizi[8][8]={
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x'};
int i,j,k,m,n;
cin>>no;
cin>>w;
i=0;
while(w[i]!='\0'){
if(w[i]>=65&&w[i]<=90){
m=8-int(w[i+2]-48);
n=int(w[i+1]-97);
qizi[m][n]=w[i];
i+=4;
}
else if(w[i]>=97&&w[i]<=122){
m=8-int(w[i+1]-48);
n=int(w[i]-97);
qizi[m][n]='P';
i+=3;
}
}
cin>>no;
cin>>b;
i=0;
while(b[i]!='\0'){
if(b[i]>=65&&b[i]<=90){
m=8-int(b[i+2]-48);
n=int(b[i+1]-97);
qizi[m][n]=b[i]+32;
i+=4;
}
else if(b[i]>=97&&b[i]<=122){
m=8-int(b[i+1]-48);
n=int(b[i]-97);
qizi[m][n]='p';
i+=3;
}
}
cout<<"+---+---+---+---+---+---+---+---+"<<endl;
for(i=0;i<8;i++){
for(j=0;j<8;j++){
if((i+j)%2==0){
if(qizi[i][j]=='x')
qizi[i][j]='.';
cout<<"|"<<"."<<qizi[i][j]<<".";
}
else{
if(qizi[i][j]=='x')
qizi[i][j]=':';
cout<<"|"<<":"<<qizi[i][j]<<":";
}
}
cout<<"|"<<endl;
cout<<"+---+---+---+---+---+---+---+---+"<<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