【字符串】HDU2135Rolling table
来源:互联网 发布:java五个框架有哪些 编辑:程序博客网 时间:2024/05/06 02:45
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2135
Problem Description
After the 32nd ACM/ICPC regional contest, Wiskey is beginning to prepare for CET-6. He has an English words table and read it every morning.
One day, Wiskey's chum wants to play a joke on him. He rolling the table, and tell Wiskey how many time he rotated. Rotate 90 degrees clockwise or count-clockwise each time.
The table has n*n grids. Your task is tell Wiskey the final status of the table.
One day, Wiskey's chum wants to play a joke on him. He rolling the table, and tell Wiskey how many time he rotated. Rotate 90 degrees clockwise or count-clockwise each time.
The table has n*n grids. Your task is tell Wiskey the final status of the table.
Input
Each line will contain two number.
The first is postive integer n (0 < n <= 10).
The seconed is signed 32-bit integer m.
if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times.
Following n lines. Every line contain n characters.
The first is postive integer n (0 < n <= 10).
The seconed is signed 32-bit integer m.
if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times.
Following n lines. Every line contain n characters.
Output
Output the n*n grids of the final status.
Sample Input
3 21234567893 -1123456789
Sample Output
987654321369258147
Author
Wiskey
代码:
#include<iostream>#include<cstring>using namespace std;int main(){ char a[15][15]; int n,m; cin.sync_with_stdio(false); while(cin>>n>>m){ for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) cin>>a[i][j]; while(m<0) m+=4; m%=4; if(m==1){ for(int j=1;j<=n;j++){ for(int i=n;i>0;i--){ cout<<a[i][j]; if(i==1) cout<<endl; } } }else if(m==2){ for(int i=n;i>0;i--){ for(int j=n;j>0;j--){ cout<<a[i][j]; if(j==1)cout<<endl; } } }else if(m==3){ for(int j=n;j>0;j--){ for(int i=1;i<=n;i++){ cout<<a[i][j]; if(i==n) cout<<endl; } } }else if(m==0){ for(int i=1;i<=n;i++) for(int j=1;j<=n;j++){ cout<<a[i][j]; if(j==n)cout<<endl; } } } return 0;}
0 0
- 【字符串】HDU2135Rolling table
- SQL--字符串转table
- 读取string table 的字符串
- lua table转成xml字符串
- 将字符串转换成Table
- mssql 将字符串分割为Table (splitToTable)
- ms sql字符串转化表(table)
- lua 把table拼装成字符串
- Jquery Ajax返回Json字符串 拼接table
- lua使用table.concat连接大量字符串
- Lua学习笔记-table转为字符串
- table 转化成grid,及其字符串排序
- lua 字符串截取 存入table中
- 如何把table封装成一个字符串
- lua使用table.concat连接大量字符串
- TABLE
- table
- table
- 粒子的控制
- 最长回文子串 hihocode 1032
- 信号
- 文件上传下载_01_原理
- SSH登录异常(someone is doing something nasty)
- 【字符串】HDU2135Rolling table
- ORA-16038 问题处理
- 使用socket和mysql编写一个简单的物联网服务器程序
- 我国三维成像激光雷达获突破
- Java之------类加载器(二)
- MYSQL常见错误
- 浅谈客户端架构
- SQL中sum(),avg()等统计结果为null的解决方法
- Hadoop HDFS封装