https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2000

题意:找出乘积最大的连续子序列。

思路:这道题目我挺无语的,一直超时,也不知道是哪里出了问题,反正最后试来试去终于有种办法成功了。不过好像这道题目不需要考虑输出0的情况吧。

 #include<iostream>
using namespace std; int main()
{
int ans[];
int n;
int kase = ;
while (cin>>n)
{
kase++;
for (int i = ; i < n; i++)
cin >> ans[i];
long long max = ;
long long sum;
for (int i = ; i < n; i++)
{
sum = ;
for (int j = i; j < n; j++)
{
sum *= ans[j];
if (sum>max) max = sum;
}
}
cout << "Case #" << kase << ": The maximum product is " << max << ".\n\n";
}
return ;
}

UVa 11059 最大乘积的更多相关文章

  1. UVa 11059 最大乘积 java 暴力破解

    题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  2. 暴力求解——最大乘积 Maximum Product,UVa 11059

    最大乘积 Maximum Product 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=84562#problem/B 解题思路 ...

  3. UVa 11059 - Maximum Product 最大乘积【暴力】

    题目链接:https://vjudge.net/contest/210334#problem/B 题目大意:Given a sequence of integers S = {S1, S2, . . ...

  4. 最大乘积(Maximum Product,UVA 11059)

    Problem D - Maximum Product Time Limit: 1 second Given a sequence of integers S = {S1, S2, ..., Sn}, ...

  5. UVA 11059

    Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the ...

  6. UVA 11059 Maximum Product【三层暴力枚举起终点】

    [题意]:乘积最大的子序列.n∈[1,10],s∈[-10,10] [代码]: #include<bits/stdc++.h> using namespace std; int a[105 ...

  7. Maximum Product UVA - 11059

    Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the ...

  8. uva 11059 maximum product(水题)——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAB1QAAAMcCAIAAABo0QCJAAAgAElEQVR4nOydW7msuhKF2wIasIAHJK

  9. Uva 11059 Maximum Product

    注意long long  long long  longlong !!!!!!   还有 printf的时候 明明longlong型的答案 用了%d  WA了也看不出,这个细节要注意!!! #incl ...

随机推荐

  1. CentOS 下mysql 的安装

    1.安装mysql服务器 yum -y install mysql-server 2.装入service启动服务 /etc/rc.d/init.d/mysqld start 3.设置mysql服务开机 ...

  2. android ApplicationContext Context Activity 内存的一些学习

    Android中context可以作很多操作,但是最主要的功能是加载和访问资源. 在android中有两种context,一种是application context,一种是activity cont ...

  3. Review Board的使用

    代码审核工具.先在命令行界面,进入到工程的Main目录下,然后使用命令 svn diff>yus.diff  这样就将Main里面的所有内容生成了,然后在浏览器里进入到自己的Review Boa ...

  4. hdu_5723_Abandoned country(最小生成树)

    题目链接:hdu_5723_Abandoned country 题意: 让你求最小生成树的花费,然后求任给两点的期望路程 题解: 最小生成树大家都会求,Kruskal这里要改改,因为后面要求任意两点的 ...

  5. nested query for "pat2" table

    mysql> select t.appln_id, t.filing_date, t.appln_kind, t.people, GROUP_CONCAT(pu.publn_kind) from ...

  6. 利用XShell 上传和下载文件

    原文:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=28977986&id=4292781 借助XShell,使用li ...

  7. 转: OGG Checkpoint 详解

    1. OGG Checkpoint 详解 定位中断的位置,下次启动从中断的位置开始恢复. 1.target 端配置: 2.一条记录对应一个replicat 一. Extract Checkpoints ...

  8. PAT (Advanced Level) 1053. Path of Equal Weight (30)

    简单DFS #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  9. vs2008安装opencv2.4.6

    最近安装opencv2.4.6,发现犯了一个很愚蠢的错误,在此记录一下. opencv的头文件包含应该位于build文件夹内,而我误将opencv文件夹下的include包含了进去,造成无法找到头文件 ...

  10. awesome-deep-learning

    https://github.com/ChristosChristofidis/awesome-deep-learning