标题:求此程序流程图
只看楼主
天上第一把
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2017-3-2
结帖率:66.67%
已结贴  问题点数:16 回复次数:2 
求此程序流程图
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAX = 1010;
int a[MAX][MAX], p[MAX], q[MAX];
int b[MAX][MAX], c[MAX][MAX];
int n;

int main()
{
//    freopen("a.txt","r",stdin);
    int i, j, s, t, k, x;
    while(scanf("%d",&n)!=EOF)
    {
        for(i = 1; i <= n; ++ i)
            for(j = 1; j <= n; ++ j)
            scanf("%d",&a[i][j]);
        for(i = 1; i <= n; ++ i)
           for(j = 1; j <= n; ++ j)
           {
               scanf("%d",&k);
               b[i][j] = k;
               c[i][k] = j;
           }
        for(i = 1; i <= n; ++ i)
            p[i] = 1;
        for(x = 0; !x ;)
        {
            x = 1;
            memset(q,0,sizeof(q));
            for(i = 1; i <= n; ++ i)
            {
                j = a[i][p[i]];
                if(q[j] == 0)  q[j] = i;
                else
                {
                    x = 0;
                    s = c[j][i];
                    t = c[j][q[j]];
                    if(s > t) p[i] ++;
                    else p[q[j]] ++, q[j] = i;
                }
            }
        }
        for(i = 1; i <= n; ++ i)
            printf("%d\n",a[i][p[i]]);
    }
    return 0;
}
搜索更多相关主题的帖子: include 流程图 
2017-03-09 09:14
wp231957
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:神界
等 级:版主
威 望:422
帖 子:13681
专家分:53296
注 册:2012-10-18
得分:16 
一般都是根据流程图 编写代码 主要是为了方便
现在问题是 已经有了代码  在编写流程图  就多此一举了

DO IT YOURSELF !
2017-03-09 17:45
佳琪啊
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2017-11-7
得分:0 
回复 2楼 wp231957
大神,会根据代码写流程图吗。求教。
2017-11-07 11:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-474880-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.086823 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved