全部评论 1

  • 还是我当时的小模拟好(

    #include<bits/stdc++.h>
    using namespace std;
    bool cmp(int x,int y){
        return x>y;
    }
    int main(){
        int n,m,a[110];
        cin>>n>>m;
        int x=n*m;
        for(int i=1;i<=x;i++){
            cin>>a[i];
        }int num=a[1];
        sort(a+1,a+x+1,cmp);
        int c=1,r=1,seat[15][15],k=1;
        while(true){
            seat[c][r]=a[k],k++;
            if(seat[c][r]==num){
                cout<<c<<' '<<r;
                return 0;
            }
            if(c%2==1 and r==n)c++;
            else if(c%2==0 and r==1)c++;
            else if(c%2==1)r++;
            else if(c%2==0)r--;
        }
    }
    

    19小时前 来自 上海

    2

热门讨论