HDOJ 2006 求奇数的乘积

来源:互联网 发布:linux退出不保存命令 编辑:程序博客网 时间:2024/06/06 14:19
/** * Created by YangYuan on 2017/12/8. */public class Problem2006{    public static void main(String[] args)    {        Scanner scanner = new Scanner(System.in);        while (scanner.hasNext())        {            int n = scanner.nextInt();            int result = 1;            for (int i = 0; i < n; i++)            {                int x = scanner.nextInt();                if (x % 2 != 0)                    result *= x;            }            System.out.println(result);        }    }}
原创粉丝点击