1 条题解
-
0
#include <bits/stdc++.h> using namespace std; const int M = 1e5 + 5; int a[M]; int n; bool check(int num)//是否符合要求 { return num % 9 == 0 && num % 8 != 0; } int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; // a + 1是数组开始位置的迭代器, a + n + 1是数组结束位置的迭代器 cout << count_if(a + 1, a + n + 1, check); //使用count_if统计是否在数组里满足条件的数 cout << "\n"; return (0); }
- 1
信息
- ID
- 5051
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 1
- 标签
- 递交数
- 42
- 已通过
- 13
- 上传者