【例题 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& ...
随机推荐
- Linux桌面词典 星际译王(StarDict)
星际译王(StarDict)是利用GTK(GIMP TOOLKIT)开发的国际化的.跨平台的自由的桌面字典软件.它并不包含字典档,使用者须自行下载配合使用.它可以运行于多种不同的平台,如Linux, ...
- C#获得文件夹下文件名
String path = @"X:\xxx\xxx"; //第一种方法 var files = Directory.GetFiles(path, "*.txt" ...
- POJ 1466 Girls and Boys (匈牙利算法 最大独立集)
Girls and Boys Time Limit: 5000MS Memory Limit: 10000K Total Submissions: 10912 Accepted: 4887 D ...
- Android学习笔记(三)
ContentProvider简单介绍 ContentProvider是不同应用程序之间进行数据交换的标准API,当一个应用程序须要把自己的数据暴露给其它程序使用时.该应用程序便可通过提供Conten ...
- LightOJ 1070 Algebraic Problem (推导+矩阵高速幂)
题目链接:problem=1070">LightOJ 1070 Algebraic Problem 题意:已知a+b和ab的值求a^n+b^n.结果模2^64. 思路: 1.找递推式 ...
- 第一天,Mysql安装,DDL(数据库定义语言),DBA,DML(数据库操纵语言),导入外面的sql文件
把“D:\mysql-5.6.22-winx64\bin”添加到系统环境变量path中了,然后在任意目录可访问mysql等命令,这样如登录等操作就不需要进入MySQL安装目录才好执行! MySQL下载 ...
- Android 学习笔记进阶14之像素操作
在我们玩的游戏中我们会经常见到一些图像的特效,比如半透明等效果.要实现这种半透明效果其实并不难,需要我们懂得图像像素的操作. 不要怕,其实在Android中Bitmap为我们提供了操作像素的基本方法. ...
- CSS3的属性选择器
CSS3中新增了许多选择器,今天零度给大家说说CSS3的属性选择器. 与CSS2相比,CSS3新增了3种属性选择器:[attr^=value].[attr$=value].[attr*=value]: ...
- LA 2531 The K-league 最大流
#include <iostream> #include <cstdio> #include <fstream> #include <algorithm> ...
- 分享一个css3学习使用的选择器手册
http://www.haorooms.com/tools/css_selecter/