知识点:
函数:函数
#include <iostream>
using namespace std;
double fun(int x);
int main() {
int n;
cin >> n;
int words[n];
double cost = 0;
for (int& i : words) {
cin >> i;
}
for (int i : words) {
cost += fun(i);
}
printf("%.1f", cost);
return 0;
}
double fun(int x) {
double ret;
if (x <= 60) {
ret = 0.1;
} else {
ret = 0.2;
}
return ret;
}



京公网安备 11010502036488号