【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

C语言for循环练习题

【代码】

  1. /*
  2. 1.Shoud it use long long ?
  3. 2.Have you ever test several sample(at least therr) yourself?
  4. 3.Can you promise that the solution is right? At least,the main ideal
  5. 4.use the puts("") or putchar() or printf and such things?
  6. 5.init the used array or any value?
  7. 6.use error MAX_VALUE?
  8. */
  9. #include <bits/stdc++.h>
  10. using namespace std;
  11. int n;
  12. int a[100];
  13. int main(){
  14. #ifdef LOCAL_DEFINE
  15. freopen("F:\\c++source\\rush_in.txt", "r", stdin);
  16. freopen("F:\\c++source\\rush_out.txt", "w", stdout);
  17. #endif
  18. ios::sync_with_stdio(0),cin.tie(0);
  19. int kase = 0;
  20. while (cin >>n){
  21. kase++;
  22. cout << "Case #"<<kase<<": The maximum product is ";
  23. for (int i = 1;i <= n;i++) cin >> a[i];
  24. long long ans = 0;
  25. for (int i = 1;i <= n;i++)
  26. {
  27. long long temp = 1;
  28. for (int j = i;j<= n;j++){
  29. temp = (temp*1LL*a[j]);
  30. ans = max(ans,temp);
  31. }
  32. }
  33. cout <<ans<<"."<<endl;
  34. cout << endl;
  35. }
  36. return 0;
  37. }

【例题 7-2 UVA - 11059】Maximum Product的更多相关文章

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

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAB1QAAAMcCAIAAABo0QCJAAAgAElEQVR4nOydW7msuhKF2wIasIAHJK

  2. Uva 11059 Maximum Product

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

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

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

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

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

  5. UVA.10305 Maximum Product (暴力)

    UVA.10305 Maximum Product (暴力) 题意分析 直接枚举起点和重点,然后算出来存到数组里面,sort然后取最大值即可. 代码总览 #include <iostream&g ...

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

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

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

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

  8. Maximum Product UVA - 11059

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

  9. UVa 11059 最大乘积

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

随机推荐

  1. SQL Server 2008 R2 超详细安装图文教程及问题解决(锐姿公司安装)

    问题点: 1.为了sqlserver与mysql 的安全,建议数据库低权限运行.禁止远程访问 1433与 3306端口等. 2.安装提示.net 3.5没有安装 ,在server2012的添加 3. ...

  2. Flex 编译器及编译步骤

    通过为Flex项目添加编译器参数:-keep-generated-actionscript=true 可以看到经过编译器处理过的源程序文件集合. 在这些文件的文件名中包含有“xxx-generated ...

  3. 如何批量telnet查看否开放指定端口

    由于机房搬迁,需要重新telnet看看网络是否联通 [weblogic@pays03pre_BankVerify /]$ telnet 172.29.1.159 22Trying 172.29.1.1 ...

  4. W3C高级算法挑战之python实现

    最近在学python,网上很难找到对应的算法题网站,专业算法网站大部分都是国外的,之前在w3cschool看到有三个级别的Javascript脚本算法挑战,尝试用python实现,代码量相对比较少,如 ...

  5. 学习——HTML5

    HTML5多用于手机页面制作,因为PC版浏览器大多不兼容,可以通过下面网站查看HTML5浏览器兼容情况: http://www.caniuse.com/#index 一.语义化标签 1.<hea ...

  6. Java并发包之CountDownLatch用法

    CountDownLatch计数器闭锁是一个能阻塞主线程,让其他线程满足特定条件下主线程再继续执行的线程同步工具. Latch闭锁的意思,是一种同步的工具类.类似于一扇门:在闭锁到达结束状态之前,这扇 ...

  7. Spring : 征服数据库(一)

    严格的说.这里征服的是关系型数据库.之后笔者会以MongoDB为例,给出非关系型数据库的解决方式,敬请期待. 获取连接,操作,关闭,不知所云的异常...是的,你受够了.在使用纯JDBC时你訪问数据库时 ...

  8. NYOJ 203 三国志(Dijkstra+贪心)

    三国志 时间限制:3000 ms  |  内存限制:65535 KB 难度:5 描写叙述 <三国志>是一款非常经典的经营策略类游戏.我们的小白同学是这款游戏的忠实玩家.如今他把游戏简化一下 ...

  9. OpenCV —— 图像局部与部分分割(一)

    背景减除 一旦背景模型建立,将背景模型和当前的图像进行比较,然后减去这些已知的背景信息,则剩下的目标物大致就是所求的前景目标了 缺点 —— 该方法基于一个不长成立的假设:所有像素点是独立的 场景建模 ...

  10. LightOJ 1291 Real Life Traffic

    Real Life Traffic Time Limit: 2000ms Memory Limit: 32768KB This problem will be judged on LightOJ. O ...