CF152A.Marks

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya, or Mr. Vasily Petrov is a dean of a department in a local university. After the winter exams he got his hands on a group's gradebook.

Overall the group has n students. They received marks for m subjects. Each student got a mark from 1 to 9 (inclusive) for each subject.

Let's consider a student the best at some subject, if there is no student who got a higher mark for this subject. Let's consider a student successful, if there exists a subject he is the best at.

Your task is to find the number of successful students in the group.

瓦西里(即瓦西里·彼得罗夫先生)是一所本地大学某院系的系主任。冬季考试结束后,他拿到了一个班级的成绩册。

该班级共有 nn 名学生,每名学生在 mm 门科目中均获得了一个介于 11 到 99(含)之间的分数。

我们称一名学生在某门科目中“最优秀”,当且仅当没有任何其他学生在该科目中获得比他更高的分数。我们称一名学生为“成功学生”,当且仅当存在至少一门科目,他在该科目中是最优秀的学生。

你的任务是求出该班级中成功学生的数量。

输入格式

The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of students and the number of subjects, correspondingly. Next n lines each containing m characters describe the gradebook. Each character in the gradebook is a number from 1 to 9. Note that the marks in a rows are not sepatated by spaces.

第一行输入包含两个整数 nn 和 mm(1≤n,m≤1001 \leq n, m \leq 100),分别表示学生人数和科目数。接下来的 nn 行,每行包含 mm 个字符,描述成绩表。成绩表中的每个字符均为 11 到 99 之间的数字。注意:同一行中的各成绩之间不以空格分隔。

输出格式

Print the single number — the number of successful students in the given group.

输出单个数字——给定组中成功学生的数量。

输入输出样例

  • 输入#1

    3 3
    223
    232
    112

    输出#1

    2
  • 输入#2

    3 5
    91728
    11828
    11111

    输出#2

    3

说明/提示

In the first sample test the student number 1 is the best at subjects 1 and 3, student 2 is the best at subjects 1 and 2, but student 3 isn't the best at any subject.

In the second sample test each student is the best at at least one subject.

在第一个样例测试中,学生 1 在科目 1 和科目 3 上表现最佳,学生 2 在科目 1 和科目 2 上表现最佳,但学生 3 在任何科目上均未表现最佳。

在第二个样例测试中,每位学生至少在一科上表现最佳。

输入解题思路,AI测评打分。不知道怎么写?

首页