To find the product of odd numbers
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 114710 Accepted Submission (s): 69944
Problem description gives you n integers, asking for the product of all the odd numbers in them.
Input data contains multiple test instances, one row per test instance, and N for each row, indicating that there is a total of n for this group of data, followed by n integers, you can assume that each set of data must have at least one odd number.
Output outputs the product of all the odd numbers in each set, and one row for the test instance.
Sample INPUT3 1 2 34 2 3 4 5
Sample Output315
1#include <cstdio>2 using namespacestd;3 intMain ()4 {5 intN;6 7 while(SCANF ("%d", &n)! =EOF)8 {9 intx;Ten Long Longresult =1; One while(n--) A { -scanf"%d",&x); - if(%2!=0) the { -Result *=x; - } - } +printf"%ld\n", result); - } + return 0; A}
hdu2006 the Product "C + +" for odd numbers