6 solutions
-
0
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv){ int n,m; cin >> n >> m; int a[n][m]; for (int i = 0;i < n;i++){ for (int j = 0;j < m;j++){ cin >> a[i][j]; } } for (int i = 0;i < m;i++){ // 列变行(列) for (int j = n - 1;j >= 0;j--){ // 最下面的最先输出(行) printf("%d ",a[j][i]); } cout << endl; } return 0; } // 仅对正方形有效 // 题库有问题
-
-1
`
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e6 + 10; const int INF = 0x3f3f3f3f; int a[110][110], n, m; int main() { cin >> n >> m; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { cin >> a[i][j]; } } //其实不用真的转90° for(int i = 1; i <= m; i++)//仔细想想这三句 { for(int j = n; j >= 1; j--)//为什么一个加一个减 { cout << a[j][i] << " ";//为什么要反着输出 } puts(""); } return 0; }
- 1
Information
- ID
- 613
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 4
- Tags
- # Submissions
- 112
- Accepted
- 49
- Uploaded By