zoukankan      html  css  js  c++  java
  • CodeForces 618B Guess the Permutation

    只要找出当前没用过的数字中,大于或等于当前这一列的最大值就可以

    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<vector>
    #include<algorithm>
    using namespace std;
    
    const int maxn=100;
    int n;
    int x[maxn][maxn];
    int ans[maxn];
    int flag[maxn];
    
    int main()
    {
        scanf("%d",&n);
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
                scanf("%d",&x[i][j]);
    
        memset(flag,0,sizeof flag);
    
        for(int j=1; j<=n; j++)
        {
            int Max=-1;
            for(int i=1; i<=n; i++) Max=max(Max,x[i][j]);
            for(int i=Max; i<=n; i++)
            {
                if(flag[i]==0)
                {
                    ans[j]=i;
                    flag[i]=1;
                    break;
                }
            }
        }
        for(int i=1; i<=n; i++) printf("%d ",ans[i]);
        printf("
    ");
        return 0;
    }
  • 相关阅读:
    systemd管理服务
    卷积神经网络
    matplotlib-3.2.1
    pandas-1.0.3
    numpy-1.18.4
    降维
    无监督学习-聚类
    集成学习
    人工神经网络
    贝叶斯分类
  • 原文地址:https://www.cnblogs.com/zufezzt/p/5176741.html
Copyright © 2011-2022 走看看