poj3224

Posted kasenbob

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了poj3224相关的知识,希望对你有一定的参考价值。

1.链接地址

https://vjudge.net/problem/POJ-3224

2.问题描述

The Lab Cup Table Tennis Competition is going to take place soon among laboratories in PKU. Students from the AI Lab are all extreme enthusiasts in table tennis and hold strong will to represent the lab in the competition. Limited by the quota, however, only one of them can be selected to play in the competition.

To make the selection fair, they agreed on a single round robin tournament, in which every pair of students played a match decided by best of 5 games. The one winning the most matches would become representative of the lab. Now Ava, head of the lab, has in hand a form containing the scores of all matches. Who should she decide on for the competition?

输入样例

4
0 0 3 2
3 0 3 1
2 2 0 2
3 3 3 0

输出样例

4

3.解题思路

 就是找出每一行3最多的那个人,一样多则取在前的那一位

4.算法实现源代码

#include <iostream>
using namespace std;
int main()

    int n;
    int a[105][105];
    cin>>n;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin>>a[i][j];
    int maxIndex = 0;
    int max = 0;
    for(int i = 0; i < n; i++)
    
        int sum = 0;
        for(int j = 0; j < n; j++)
        
            if(a[i][j] == 3)
                sum++;
        
        if(sum > max)
        
            max = sum;
            maxIndex = i;
        
    
    cout<<maxIndex+1<<endl;
    return 0;

 

以上是关于poj3224的主要内容,如果未能解决你的问题,请参考以下文章

bzoj 3224

BZOJ 3224

BZOJ3224

[代码] bzoj 3224 普通平衡树(无旋treap)

平衡树模板 bzoj 3224

BZOJ 3224 普通平衡树