hdu_2006 求奇数的乘积

来源:互联网 发布:鸿坤地产集团知乎 编辑:程序博客网 时间:2024/05/17 20:12
import java.util.Scanner;/** * Created by Administrator on 2017/11/12. */public class Main {    public static void main( String[] args){        Scanner scan = new Scanner(System.in);        while (scan.hasNext()){            int m = scan.nextInt();            int sum = 1;            for (int i = 0; i < m; ++i){                int x = scan.nextInt();                if (1 == (x&1)){                    sum *= x;                }            }            System.out.println(sum);        }    }}
原创粉丝点击