zoukankan      html  css  js  c++  java
  • 【例题 7-2 UVA

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

    在这里输入题意

    【题解】

    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;
    }
    
    
  • 相关阅读:
    ubuntu安装后要做什么
    JavaScript错误处理
    jQuery 事件
    display的用法
    百度排名的原理
    什么是ajax?
    CSS文档流
    引用CSS的方法
    jQuery的安装方式
    禁止WPS2019开机自启动
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7952779.html
Copyright © 2011-2022 走看看