标签:des style blog color os strong io for
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 3394 | Accepted: 2172 |
Description
Input
Output
Sample Input
+---+---+---+---+---+---+---+---+ |.r.|:::|.b.|:q:|.k.|:::|.n.|:r:| +---+---+---+---+---+---+---+---+ |:p:|.p.|:p:|.p.|:p:|.p.|:::|.p.| +---+---+---+---+---+---+---+---+ |...|:::|.n.|:::|...|:::|...|:p:| +---+---+---+---+---+---+---+---+ |:::|...|:::|...|:::|...|:::|...| +---+---+---+---+---+---+---+---+ |...|:::|...|:::|.P.|:::|...|:::| +---+---+---+---+---+---+---+---+ |:P:|...|:::|...|:::|...|:::|...| +---+---+---+---+---+---+---+---+ |.P.|:::|.P.|:P:|...|:P:|.P.|:P:| +---+---+---+---+---+---+---+---+ |:R:|.N.|:B:|.Q.|:K:|.B.|:::|.R.| +---+---+---+---+---+---+---+---+
Sample Output
White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4 Black: Ke8,Qd8,Ra8,Rh8,Bc8,Ng8,Nc6,a7,b7,c7,d7,e7,f7,h7,h6
Source
#include<cstdio> #include<string.h> using namespace std; char str[100][100]; char s[100]; int main() { int i,j; int first=1; for(i=0; i<8; i++) { scanf("%s",s); getchar(); scanf("%s",s); for(j=0; j<8; j++) str[i][j]=s[j*4+2]; } printf("White: "); for(i=7; i>=0; i--) for(j=0; j<8; j++) { if(str[i][j]==‘K‘) { if(first==1) { printf("K%c%d",‘a‘+j,8-i); first=0; } else printf(",K%c%d",‘a‘+j,8-i); } } for(i=7; i>=0; i--) for(j=0; j<8; j++) { if(str[i][j]==‘Q‘) { if(first==1) { printf("Q%c%d",‘a‘+j,8-i); first=0; } else printf(",Q%c%d",‘a‘+j,8-i); } } for(i=7; i>=0; i--) for(j=0; j<8; j++) { if(str[i][j]==‘R‘) { if(first==1) { printf("R%c%d",‘a‘+j,8-i); first=0; } else printf(",R%c%d",‘a‘+j,8-i); } } for(i=7; i>=0; i--) for(j=0; j<8; j++) { if(str[i][j]==‘B‘) { if(first==1) { printf("B%c%d",‘a‘+j,8-i); first=0; } else printf(",B%c%d",‘a‘+j,8-i); } } for(i=7; i>=0; i--) for(j=0; j<8; j++) { if(str[i][j]==‘N‘) { if(first==1) { printf("N%c%d",‘a‘+j,8-i); first=0; } else printf(",N%c%d",‘a‘+j,8-i); } } for(i=7; i>=0; i--) for(j=0; j<8; j++) { if(str[i][j]==‘P‘) { if(first==1) { printf("%c%d",‘a‘+j,8-i); first=0; } else printf(",%c%d",‘a‘+j,8-i); } } first=1; printf("\n"); printf("Black: "); for(i=0; i<=7; i++) for(j=0; j<8; j++) { if(str[i][j]==‘k‘) { if(first==1) { printf("K%c%d",‘a‘+j,8-i); first=0; } else printf(",K%c%d",‘a‘+j,8-i); } } for(i=0; i<=7; i++) for(j=0; j<8; j++) { if(str[i][j]==‘q‘) { if(first==1) { printf("Q%c%d",‘a‘+j,8-i); first=0; } else printf(",Q%c%d",‘a‘+j,8-i); } } for(i=0; i<=7; i++) for(j=0; j<8; j++) { if(str[i][j]==‘r‘) { if(first==1) { printf("R%c%d",‘a‘+j,8-i); first=0; } else printf(",R%c%d",‘a‘+j,8-i); } } for(i=0; i<=7; i++) for(j=0; j<8; j++) { if(str[i][j]==‘b‘) { if(first==1) { printf("B%c%d",‘a‘+j,8-i); first=0; } else printf(",B%c%d",‘a‘+j,8-i); } } for(i=0; i<=7; i++) for(j=0; j<8; j++) { if(str[i][j]==‘n‘) { if(first==1) { printf("N%c%d",‘a‘+j,8-i); first=0; } else printf(",N%c%d",‘a‘+j,8-i); } } for(i=0; i<=7; i++) for(j=0; j<8; j++) { if(str[i][j]==‘p‘) { if(first==1) { printf("%c%d",‘a‘+j,8-i); first=0; } else printf(",%c%d",‘a‘+j,8-i); } } return 0; }
暴力枚举——Help Me with the Game,布布扣,bubuko.com
标签:des style blog color os strong io for
原文地址:http://www.cnblogs.com/angledamon/p/3873910.html