2006 求奇数的乘积

#include<iostream>
#include<vector>

using namespace std;

int main() {
    int n;
    while (cin >> n) {
        vector<int> t(n);
        int a;
        for (int i = 0;i < n;i++) {
            cin >> a;
            t.push_back(a);
        }
        int ans = 1;
        for (auto i : t) {
            if (i % 2 == 1) {
                ans *= i;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/Mered1th/p/10556093.html