旋转矩阵

Time Limit: 1 Sec  Memory Limit:
128 MB

Submit: 268  Solved: 116



SubmitStatusWeb
Board

Description

给出一个矩阵,输出顺时针旋转90度后的矩阵。

Input

单实例测试。输入第一行是一个整数n(0 < n <=1000) ,之后n行是一个n行n列的整数矩阵。

Output

输出顺时针旋转90度后的矩阵。

Sample Input

3
1 2 3
4 5 6
7 8 9

Sample Output

7 4 1
8 5 2
9 6 3

#include<stdio.h>
#include<string.h>
int map[1010][1010];
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
scanf("%d",&map[i][j]);
for(int i=1;i<=n;i++)
{
for(int j=n;j>=2;j--)
printf("%d ",map[j][i]);
printf("%d\n",map[1][i]);
}
}
return 0;
}

zzulioj--1791-- 旋转矩阵(模拟水题)的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. POJ 2014:Flow Layout 模拟水题

    Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Descr ...

  3. 模拟水题,查看二维数组是否有一列都为1(POJ2864)

    题目链接:http://poj.org/problem?id=2864 题意:参照题目 哈哈哈,这个题discuss有翻译哦.水到我不想交了. #include <cstdio> #inc ...

  4. UVA 10714 Ants 蚂蚁 贪心+模拟 水题

    题意:蚂蚁在木棍上爬,速度1cm/s,给出木棍长度和每只蚂蚁的位置,问蚂蚁全部下木棍的最长时间和最短时间. 模拟一下,发现其实灰常水的贪心... 不能直接求最大和最小的= =.只要求出每只蚂蚁都走长路 ...

  5. Codeforces 1082B Vova and Trophies 模拟,水题,坑 B

    Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn t ...

  6. HDU4287-STL模拟水题

    一场2012天津网络预选赛的题,签到题. 但是还是写了三四十分钟,C++和STL太不熟悉了,总是编译错误不知道怎么解决. 一开始用的Char [] 后来改成了string,STL和string搭配起来 ...

  7. hdu 4891 模拟水题

    http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...

  8. Mishka and Contest(模拟水题)

    Mishka started participating in a programming contest. There are nn problems in the contest. Mishka' ...

  9. 模拟水题,牛吃草(POJ2459)

    题目链接:http://poj.org/problem?id=2459 题目大意:有C头牛,下面有C行,每头牛放进草地的时间,每天吃一个草,总共有F1个草,想要在第D的时候,草地只剩下F2个草. 解题 ...

  10. 洛谷 1079 Vigenère 密码——模拟水题

    题目:https://www.luogu.org/problemnew/show/P1079 大水题. #include<iostream> #include<cstdio> ...

随机推荐

  1. poj--3678--Katu Puzzle(2-sat 建模)

    Katu Puzzle Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit S ...

  2. Java悲观锁和乐观锁

    悲观的并发策略——Synchronized互斥锁 互斥锁是最常见的同步手段,在并发过程中,当多条线程对同一个共享数据竞争时,它保证共享数据同一时刻只能被一条线程使用,其他线程只有等到锁释放后才能重新进 ...

  3. 利用keytool颁发https证书方法

    1.首先生成私有认证机构 命令:keytool -genkeypair -alias CAname   补充:keytool -list 命令增加 -v 可以查看CA详细信息 2.然后生成私有证书 命 ...

  4. git服务器搭建-gitosis

    需求 硬件需求:一台Ubuntu或者debian电脑(虚拟机),能通过网络访问到. 软件需求:git-core, gitosis, openssh-server, openssh-client, Ap ...

  5. vue2.0中关于active-class

    一.首先,active-class是什么, active-class是vue-router模块的router-link组件中的属性,用来做选中样式的切换: 相关可查阅文档:https://router ...

  6. 对ListView的Item子控件监听并跳转页面

    public class MyAdapteforOwner extends BaseAdapter{ List<OwnerDevice>datas; private Context con ...

  7. DevExpress Report 打印提示one or more margins are set outside the printable area of the page 问题解决

    DevExpress  Report Print的时候,出现这样的问题:one or more margins are set outside the printable area of the pa ...

  8. 关于Android Studio更新后一直Refreshing的解决办法!

    今天更新了一下studio一直是这个问题 查了很多资料终于解决了 造成这个问题的原因是要更新的gradle版本和studio安装路径中的gradle版本不一致导致的 把他们改成一致的即可 在这个目录里 ...

  9. 如何打开DOS控制台及常见DOS命令作用

    如何打开DOS控制台? * A:xp下如何打开DOS控制台?     * a:开始--程序--附件--命令提示符     * b:开始--运行--cmd--回车     * c:win+r--cmd- ...

  10. node——module.exports

    module.exports 1. 在a.js中 var b=require('./b.js'); console.log(b); 在b.js中 function add(x,y){ return x ...