Official
A - 合格ライン / Passing Score Editorial
by
A - 合格ライン / Passing Score Editorial
by
kyopro_friends
問題文中の指示通り、 \(A_1, \dots, A_N\) それぞれに対し、 \(X\) 未満であるかどうかを判定し、個数を数えればよいです。
実装例 (C++)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, x;
cin >> n >> x;
vector<int>a(n);
for(int i=0; i<n; i++) cin >> a[i];
int ans = 0;
for(int i=0; i<n; i++){
if(a[i] < x){
ans++;
}
}
cout << ans << endl;
}
実装例 (Python)
N, X = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for a in A:
if a < X:
ans += 1
print(ans)
posted:
last update:
