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;
    }
    
    
  • 相关阅读:
    NOIP2009 靶形数独
    NOIP2014 寻找道路
    NOIP2005 篝火晚会
    NOIP2014 联合权值
    NOIP2011 选择客栈
    luogu2659 美丽的序列
    NOIP2008 传纸条
    vijos1642 班长的任务
    codevs1427 RQNOJ204 特种部队
    AC自动机
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7952779.html
Copyright © 2011-2022 走看看