当前位置:网站首页>【CCF CSP】201503-1图像旋转
【CCF CSP】201503-1图像旋转
2022-07-21 11:27:00 【jennie佳妮】
问题描述
试题编号: | 201503-1 |
试题名称: | 图像旋转 |
时间限制: | 5.0s |
内存限制: | 256.0MB |
问题描述: | 问题描述 旋转是图像处理的基本操作,在这个问题中,你需要将一个图像逆时针旋转90度。 输入格式 输入的第一行包含两个整数n, m,分别表示图像矩阵的行数和列数。 输出格式 输出m行,每行包含n个整数,表示原始矩阵逆时针旋转90度后的矩阵。 样例输入 2 3 样例输出 3 4 评测用例规模与约定 1 ≤ n, m ≤ 1,000,矩阵中的数都是不超过1000的非负整数。 |
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int** arr = new int*[m];
for (int i = 0; i < m; i++)
{
arr[i] = new int[n];
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin >> arr[m - j - 1][i];
}
}
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
cout<<arr[i][j]<<' ';
}
cout << endl;
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
Clion(CMake工具)中创建父子项目,引入第三方库的方法
gadget之usb_gadget
February day
gadget之composite
guava常用的工具类方法整理
Li Shuo, vice president of Baidu: AI can go deep into the scene and create real value. From sensors to large screens, it is just the beginning of digitalization
NFTScan 与 Port3 在 NFT 数据领域达成战略合作
匿名内部类在开发中的使用
Su Chunyuan, founder of science and technology · CEO of Guanyuan data: making business use is the key to the Bi industry to push down the wall of penetration
JS advanced Es5 implementation inheritance
10 papers of ant security laboratory were included by ccf-a top meeting to explore the realization of AI credibility from the perspective of algorithm
Xiangtan party and government delegation visited Qilin Xin'an for investigation
H3C build small and medium-sized enterprise network (NE)
50 places are limited to open | with the news of oceanbase's annual press conference coming!
真人踩过的坑,告诉你避免自动化测试新手常犯的10个错误
Sequences, Time Series and Prediction in Tessorflow quizs on Coursera (一)
压缩字符串
冒号排序代码实现
3.1栈
为JTable添加按列选择功能