2 条题解

  • 1
    @ 2026-9-7 18:10:54
    #include <vector>
    using namespace std;
    
    int main()
    {
        int row, col;
        cin >> row >> col;
        vector<vector<int>> a(row, vector<int>(col));
        for(int i = 0; i < row; i++)
        {
            for(int j = 0; j < col; j++)
            {
                cin >> a[i][j];
            }
        }
    
        int top = 0, bottom = row - 1;
        int left = 0, right = col - 1;
    
        while(top <= bottom && left <= right)
        {
            // 左→右,上一行
            for(int j = left; j <= right; j++)
            {
                cout << a[top][j] << endl;
            }
            top++;
    
            // 上→下,右一列
            for(int i = top; i <= bottom; i++)
            {
                cout << a[i][right] << endl;
            }
            right--;
    
            // 右→左,下一行,要判断还有行
            if(top <= bottom)
            {
                for(int j = right; j >= left; j--)
                {
                    cout << a[bottom][j] << endl;
                }
                bottom--;
            }
    
            // 下→上,左一列,要判断还有列
            if(left <= right)
            {
                for(int i = bottom; i >= top; i--)
                {
                    cout << a[i][left] << endl;
                }
                left++;
            }
        }
        return 0;
    }
    
    
    
    • 0
      @ 2025-11-27 17:00:17
      #include<iostream>
      using namespace std;
      int main(){
      	for(long long i=0;i<=514514;i++){
      		cout<<"1111111111111111111111111111111111111111111111111";
      	}
      	return 0;
      }
      

      又有人卡bug

      • 1

      信息

      ID
      1041
      时间
      1000ms
      内存
      128MiB
      难度
      9
      标签
      递交数
      12
      已通过
      5
      上传者