公式
A - Counting Passes 解説 by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest. There you can find a sample code for each language.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
This problem can be solved by using a lop to read the scores and checking if each of them is \(L\) or greater.
Sample code (Python):
n,l = map(int,input().split())
a = list(map(int,input().split()))
ok = 0
for x in a:
if x >= l:
ok += 1
print(ok)
Sample code (C++):
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,l;
cin >> n >> l;
int ok=0;
for(int i=0;i<n;i++){
int a;
cin >> a;
if(a>=l){ok++;}
}
cout << ok << "\n";
return 0;
}
投稿日時:
最終更新: