【例题 7-2 UVA - 11059】Maximum Product
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
C语言for循环练习题
【代码】
/*
1.Shoud it use long long ?
2.Have you ever test several sample(at least therr) yourself?
3.Can you promise that the solution is right? At least,the main ideal
4.use the puts("") or putchar() or printf and such things?
5.init the used array or any value?
6.use error MAX_VALUE?
*/
#include <bits/stdc++.h>
using namespace std;
int n;
int a[100];
int main(){
#ifdef LOCAL_DEFINE
freopen("F:\\c++source\\rush_in.txt", "r", stdin);
freopen("F:\\c++source\\rush_out.txt", "w", stdout);
#endif
ios::sync_with_stdio(0),cin.tie(0);
int kase = 0;
while (cin >>n){
kase++;
cout << "Case #"<<kase<<": The maximum product is ";
for (int i = 1;i <= n;i++) cin >> a[i];
long long ans = 0;
for (int i = 1;i <= n;i++)
{
long long temp = 1;
for (int j = i;j<= n;j++){
temp = (temp*1LL*a[j]);
ans = max(ans,temp);
}
}
cout <<ans<<"."<<endl;
cout << endl;
}
return 0;
}
【例题 7-2 UVA - 11059】Maximum Product的更多相关文章
- uva 11059 maximum product(水题)——yhx
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAB1QAAAMcCAIAAABo0QCJAAAgAElEQVR4nOydW7msuhKF2wIasIAHJK
- Uva 11059 Maximum Product
注意long long long long longlong !!!!!! 还有 printf的时候 明明longlong型的答案 用了%d WA了也看不出,这个细节要注意!!! #incl ...
- UVa 11059 - Maximum Product 最大乘积【暴力】
题目链接:https://vjudge.net/contest/210334#problem/B 题目大意:Given a sequence of integers S = {S1, S2, . . ...
- UVA 11059 Maximum Product【三层暴力枚举起终点】
[题意]:乘积最大的子序列.n∈[1,10],s∈[-10,10] [代码]: #include<bits/stdc++.h> using namespace std; int a[105 ...
- UVA.10305 Maximum Product (暴力)
UVA.10305 Maximum Product (暴力) 题意分析 直接枚举起点和重点,然后算出来存到数组里面,sort然后取最大值即可. 代码总览 #include <iostream&g ...
- 最大乘积(Maximum Product,UVA 11059)
Problem D - Maximum Product Time Limit: 1 second Given a sequence of integers S = {S1, S2, ..., Sn}, ...
- 暴力求解——最大乘积 Maximum Product,UVa 11059
最大乘积 Maximum Product 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=84562#problem/B 解题思路 ...
- Maximum Product UVA - 11059
Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the ...
- UVa 11059 最大乘积
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
随机推荐
- layui图片懒加载-loading占位图
前言 使用layui的图片懒加载,发现未加载的图片没有loading占位图,显示的是裂图,看着不是很好.找了一些解决方法我统一记录一下. layui图片懒加载使用方法 layui.use(’flow’ ...
- Linux下java/bin目录下的命令集合
Linux下JAVA命令(1.7.0_79) 命令 详解 参数列表 示例 重要程度 资料 appletviewer Java applet 浏览器.appletviewer 命令可在脱离万维网浏览器环 ...
- Android应用公布后的统计——百度移动统计的应用
一个App公布到各个渠道之后,我们须要採集不同渠道的一些信息,比方app在执行过程中产生的一些异常信息,app在各个android版本号的分布,以及各个app版本号的分布,各渠道的用户数,用户忠诚度等 ...
- [Python] Use Python Classes
Object oriented classes work much like classes in other languages. Learn how to create them and use ...
- XCode6报数组越界错误的问题
今天碰到一个非常奇葩的问题, 调试了半天: 错误:"index 0 beyond bounds for empty array", 意思就是说数据源数组为nil, 所以你调用直接 ...
- 在resin配置參数实现JConsole远程监控JVM
在Resin配置參数实现JConsole远程监控JVM 在Resin中配置中配置下列參数,就能够是实现了! <jvm-arg>-Dcom.sun.management.jmxremote& ...
- OJ刷题---猜算式
题目要求: 输入代码: #include<iostream> using namespace std; void Calc(); int main() { Calc(); return 0 ...
- win7中下mysql-5.6.22免安装配置
windows下mysql免安装配置 1. 下载mysql免安装压缩包 下载mysql-5.6.22-winx64.zip 解压到本地D:\mysql-5.6.22-winx64 2. 修改配置文件 ...
- 机器学习Python实现AdaBoost
adaboost是boosting方法多个版本号中最流行的一个版本号,它是通过构建多个弱分类器.通过各个分类器的结果加权之后得到分类结果的.这里构建多个分类器的过程也是有讲究的,通过关注之前构建的分类 ...
- Typedef和#define之间的区别
Typedef和define都可以用来给对象取一个别名,但是两者却有着很大不同. 1. 首先,二者执行时间不同 关键字typedef在编译阶段有效,由于是在编译阶段,因此typedef有类型检查的功能 ...