HDU 2006 (水)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2006
题目大意:给你几个数,求奇数的乘积和
解题思路:
很水,不需要数组的,一个变量 x 就行
代码:
#include<iostream>
using namespace std;
int main()
{
int sum;
int n;
int a[];
while(cin >> n)
{
sum = ;
for(int i = ; i < n; i ++)
{
cin >> a[i];
if(a[i] % != )
sum *= a[i];
}
cout << sum << endl; }
}
优化:
#include<iostream>
using namespace std;
int main()
{
int sum;
int n;
int x;
while(cin >> n)
{
sum = ;
for(int i = ; i < n; i ++)
{
cin >> x;
if(x % != )
sum *=x;
}
cout << sum << endl; }
}
HDU 2006 (水)的更多相关文章
- HDU-1042-N!(Java大法好 && HDU大数水题)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Subm ...
- hdu 4464 水
http://acm.hdu.edu.cn/showproblem.php?pid=4464 现场赛总会有水题,这就是最水的一道,预计也就是能当高校的上机题,保研用,呵呵~~~ #include &l ...
- HDU 2006 求奇数的乘积
http://acm.hdu.edu.cn/showproblem.php?pid=2006 Problem Description 给你n个整数,求他们中所有奇数的乘积. Input 输入数据包 ...
- HDU 5391 水题。
E - 5 Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 1544 水题
水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...
- hdu 3357 水题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...
- hdu 5007 水 弦
http://acm.hdu.edu.cn/showproblem.php?pid=5007 纯粹的联系String的substr 什么时候substr拦截比写短话 string te; int n; ...
- Tickets HDU - 1260 水DP
HDU - 1260 现在有n个人要买电影票,如果知道每个人单独买票花费的时间, 还有和前一个人一起买花费的时间,问最少花多长时间可以全部买完票. 直接dp就行,注意下输出和初始化 每次从dp[i-1 ...
- HDU排序水题
1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...
随机推荐
- 详解 缓冲区(Buffer 抽象类)
在本篇博文中,本人主要讲解NIO 的两个核心点 -- 缓冲区(Buffer) 和 通道 (Channel)之一的 缓冲区(Buffer), 有关NIO流的其他知识点请观看本人博文<详解 NIO流 ...
- 大数据作业之利用MapRedeuce实现简单的数据操作
Map/Reduce编程作业 现有student.txt和student_score.txt.将两个文件上传到hdfs上.使用Map/Reduce框架完成下面的题目 student.txt 20160 ...
- Windows环境,获取当前线程的ID,GetCurrentThreadId
GetCurrentThreadId 打印格式:0x%08lx 头文件:processthreadsapi.h (include Windows Server 2003, Windows Vista, ...
- [SVN] Couldn't perform atomic initialization
svn: Commit failed (details follow): svn: Couldn't perform atomic initialization It was because the ...
- 《高性能Linux服务器构建实战》——第1章轻量级HTTP服务器Nginx
第1章 轻量级HTTP服务器Nginx本章主要介绍Nginx的配置管理和使用.作为一个轻量级的HTTP服务器,Nginx与Apache相比有以下优势:在性能上,它占用很少的系统资源,能支持更多的并发连 ...
- 批量将制定文件夹下的全部Excel文件导入微软SQL数据库
以下代码将c:\cs\文件夹下的全部Excle中数据导入到SQL数据库 declare @query vARCHAR(1000) declare @max1 int declare @count1 i ...
- chrome清除缓存、不使用缓存而刷新快捷键
Ctrl+Shift+Del 清除Google浏览器缓存的快捷键 Ctrl+Shift+R 重新加载当前网页而不使用缓存内容 转载于:https://www.cnblogs.com/JAVA-ST ...
- vue 跳转并传参,实现数据实时更新
原文链接:点我 比如我现在在页面A跳转到页面B,A中的router-link :to={path:’B’,params:{id:’5’}} 求助:在页面B中的mounted生命周期函数中使用this. ...
- ACM-ICPC 2019 山东省省赛 C Wandering Robot
这个题额,我觉的是一道水题,思维题,需要考虑的情况比较多,题意一个机器人给一条指令,循环n遍,问此过程中离原点最远距离. 考虑最远距离可能出现的的情况. 每次循环之后距离至少为0: 1.假设他每一次循 ...
- python selenium(键盘事件 Keys 类)
1.导入Keys类 from selenium.webdriver.common.keys import Keys Keys.BACK_SPACE 删除输入框内结尾的单个字符 Keys.SPACE ...