HDOJ_2006_求奇数的乘积

AC代码:

#include <iostream>
#include <cstdio>
using namespace std;
int main(void)
{
    freopen("in.txt","r",stdin);
    long long a,n;
    while(scanf("%lld",&n)!=EOF)
    {
        long long sum=1;
        for(long long i=1;i<=n;i++)
        {
            scanf("%lld",&a);
            if(a%2!=0)
                sum*=a;
        }
        
        printf("%lld\n",sum);
    }
    
    
    fclose(stdin);
    return 0;
}

 

posted @ 2018-11-30 06:04  pha创噬  阅读(99)  评论(0编辑  收藏  举报