A.Olympiad

  题意:有n个人,现在给他们发证。如果给一个成绩为i的人发证,所有成绩不低于他的人都要发证;成绩为0的不能发证。问方案数。

  思路:答案为成绩不为0的不同的个数。

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<set>
 4 using namespace std;
 5 int main()
 6 {
 7     int n;
 8     scanf("%d", &n);
 9     set<int>s;
10     for (int i = 1; i <= n; i++)
11     {
12         int t;
13         scanf("%d", &t);
14         if(t!=0) s.insert(t);
15     }
16     printf("%d\n", s.size());
17 
18     return 0;
19 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2021-08-12
  • 2021-04-24
  • 2021-12-04
  • 2021-11-19
猜你喜欢
  • 2022-02-01
  • 2022-12-23
  • 2021-08-19
  • 2018-03-08
  • 2018-03-21
  • 2021-08-18
相关资源
相似解决方案