6 solutions

  • 1
    @ 2024-1-28 11:16:08
    #include <bits/stdc++.h>
    using namespace std;
    int n,m;
    int a[105][105];
    int main(){
        cin>>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--) cout <<a[j][i]<<" ";
    		cout<<endl;
    	}
        return 0;
    }
    
    • 0
      @ 2024-10-10 18:57:33

      #include<bits/stdc++.h> using namespace std; int s[114][114]; int m,n; int main(){ cin>>n>>m;//行和列 for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>s[i][j]; } } for(int i=1;i<=m;i++){ for(int j=n;i>=1;j--){ cout<<s[j][i]<<" "; } cout<<endl; } return 0; }

      • 0
        @ 2023-12-25 20:18:16

        我的解法最好

        #include <bits/stdc++.h>
        #define int long long
        using namespace std;
        int a[105][105],n,m;
        signed main(){
            cin>>n>>m;
        	for(int i=1;i<=n;i++)
                for(int j=1;j<=m;j++) cin>>a[i][j];
            for(int i=1;i<=m;i++){
                for(int j=n;j>=1;j--) cout<<a[j][i]<<" ";
                cout<<endl;
            }
        	return 0;
        }
        
        • 0
          @ 2023-10-5 10:02:06
          #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;
          }
          // 仅对正方形有效
          // 题库有问题
          
          • @ 2023-10-7 8:36:23

            看看@free的方法更好

        • -1
          @ 2023-10-13 0:21:34

          #include<bits/stdc++.h> using namespace std; int c[233][233]; int main(){ long long a,b; cin>>a>>b; for(int i=0;i<a;i++) { for(int j=0;j<b;j++){ cin>>c[i][j]; } }for(int i=0;i<b;i++) { for(int j=a-1;j>=0;j--){ cout<<c[j][i]<<" "; } cout<<endl; }

          }

          • -1
            @ 2023-9-29 11:47:39

            `

            #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