⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3095202_ac_1995ms_4780k.java

📁 北大大牛代码 1240道题的原代码 超级权威
💻 JAVA
字号:
import java.util.*;

public class Main 
{
    public static void main(String [] args)
    {
		Scanner cin = new Scanner (System.in);
		int hard [][] = new int [101][101];
		int easy [][] = new int [101][101];
		int tmp [] = new int [101];
		int i, j, p, n;

		n = cin.nextInt();
		p = cin.nextInt();
		for(i = 0; i < n; i++)
		{
			int max = -1, min = 2100000000;
			for(j = 0; j < p; j++)
			{
				tmp[j] = cin.nextInt();
				if(tmp[j] > max)	max = tmp[j];
				if(tmp[j] < min)	min = tmp[j];
			}
			for(j = 0; j < p; j++)
			{
				if(tmp[j]==min)
					easy[i][j] = 1;
				if(tmp[j]==max)
					hard[i][j] = 1;
			}
		}
		boolean none;
		none  = true;
		for(i = 0; i < p; i++)
		{
			int cnt = 0;
			for(j = 0; j < n; j++)
			{
				if(hard[j][i]==1)
				{
					cnt = 0;
					break;
				}
				if(easy[j][i]==1)
					cnt++;
			}
			if(cnt > n / 2)
			{
				none = false;
				System.out.print(i+1+" ");
			}
		}
		if(none)
		{
			System.out.print("0");
		}
		System.out.println();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -