题解 | #数字求和#
数字求和
https://www.nowcoder.com/practice/e8cee01f2d834fa9ba3479fafe492b65
#include <iostream> using namespace std; const int MAXN = 100 + 10; int arr[MAXN]; int main () { int a; cin >> a; int sum = 0; for (int i = 0; i < 5; i++){ cin >> arr[i]; if (arr[i] < a){ sum += arr[i]; } } cout << sum << endl; return 0; }