POJ 2996-Help Me with the Game(模拟)
来源:互联网 发布:新韩顺平php全套视频 编辑:程序博客网 时间:2024/06/07 19:23
题目地址:POJ 2996
题意:给你一个棋盘,白棋用大写字母表示,黑棋用小写字母表示。让你按照K,Q,R,B,N,P的方式输出棋子,K,Q,R,B,N输出的格式为字母+位置,P输出的格式仅为位置。白棋的位置输出方式是列由大到小,行由小到大。黑棋的位置输出方式是列和行都是由小到大。
#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include <iostream>#include <sstream>#include <algorithm>#include <set>#include <queue>#include <stack>#include <map>using namespace std;typedef long long LL;const int inf=0x3f3f3f3f;const double pi= acos(-1.0);const double esp=1e-6;char str[40][40];int main(){ for(int i=0; i<17; i++) scanf("%s",&str[i]); printf("White: "); for(int i=15; i>=1; i-=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='K') printf("K%c%d",'a'+j/4,8-i/2); for(int i=15; i>=1; i-=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='Q') printf(",Q%c%d",'a'+j/4,8-i/2); for(int i=15; i>=1; i-=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='R') printf(",R%c%d",'a'+j/4,8-i/2); for(int i=15; i>=1; i-=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='B') printf(",B%c%d",'a'+j/4,8-i/2); for(int i=15; i>=1; i-=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='N') printf(",N%c%d",'a'+j/4,8-i/2); for(int i=15; i>=1; i-=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='P') printf(",%c%d",'a'+j/4,8-i/2); puts(""); printf("Black: "); for(int i=1; i<=15; i+=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='k') printf("K%c%d",'a'+j/4,8-i/2); for(int i=1; i<=15; i+=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='q') printf(",Q%c%d",'a'+j/4,8-i/2); for(int i=1; i<=15; i+=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='r') printf(",R%c%d",'a'+j/4,8-i/2); for(int i=1; i<=15; i+=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='b') printf(",B%c%d",'a'+j/4,8-i/2); for(int i=1; i<=15; i+=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='n') printf(",N%c%d",'a'+j/4,8-i/2); for(int i=1; i<=15; i+=2) for(int j=2; j<=30; j+=4) if(str[i][j]=='p') printf(",%c%d",'a'+j/4,8-i/2); puts(""); return 0;}
1 0
- POJ 2996 Help Me with the Game 大模拟
- poj 2996 Help Me with the Game(模拟)
- POJ 2996:Help Me with the Game 模拟题
- POJ 2996 Help Me with the Game (模拟)
- POJ 2996 Help Me with the Game 模拟
- poj 2996 Help Me with the Game(模拟)
- poj-2996-2993-Help Me with the Game-模拟法
- POJ 2996-Help Me with the Game(模拟)
- POJ 2996 Help Me with the Game 国际象棋,模拟
- POJ 2996Help Me with the Game(模拟)
- POJ 2996 Help Me with the Game(模拟)
- POJ 2996 Help Me with the Game(模拟)
- 模拟 Help Me with the Game 2996
- Poj 2996 Help Me with the Game
- POJ 2996 Help Me with the Game
- poj 2996 Help Me with the Game
- poj 2996 Help Me with the Game
- POJ 2996 Help Me with the Game
- 大讲台分享:关于MapReduce常见的问题及解决方案
- activiti入门3排他网关,并行网管,包含网关,事件网关
- 警告: 现有列的 ANSI_PADDING 设置为 “off”。将以 ANSI_PADDING 为 “on” 的设置创建新列。
- Deep Learning
- 处理百万级以上的数据提高查询速度的方法
- POJ 2996-Help Me with the Game(模拟)
- android Looper Handler机制
- DB2 ODBC简介
- Android 目标平台版本应该大于或等于 10(The android-platform should be equal/large than 10)
- git Bash 安装&配置与基本操作
- 关于IN UPDATE TASK
- Contact Manager Web API - Web API Routing
- flex4 Error #2044: 未处理的 IOErrorEvent:。 text=Error #2032: 流错误
- 实施,运维,开发驻场时与客户沟通需求的案例与技巧