【例题 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 
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 #"<> 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 <

转载于:https://www.cnblogs.com/AWCXV/p/7952779.html

你可能感兴趣的:(【例题 7-2 UVA - 11059】Maximum Product)