题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2006
//C++代码
#include<iostream>
using namespace std;
int main(){
int n;
while(cin>>n){
int m,ans=1;
while(n--){
cin>>m;
if(m&1) ans*=m;
}
cout<<ans<<endl;
}
return 0;
}
本文提供了一个针对HDU在线评测系统中编号为2006的问题的C++解决方案。该程序读取一系列整数并计算所有奇数的乘积。
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2006
//C++代码
#include<iostream>
using namespace std;
int main(){
int n;
while(cin>>n){
int m,ans=1;
while(n--){
cin>>m;
if(m&1) ans*=m;
}
cout<<ans<<endl;
}
return 0;
}
287

被折叠的 条评论
为什么被折叠?