这程序有问题吗?

P1968 美元汇率

Motbloveut221 @ 2020-04-28 21:52:20

#include<iostream>
using namespace std;
const int N = 100;
int hl[N+1];
double m[N+1];
int max(int a,int b)
{
    return (a>b)?a:0;
}
int min(int a,int b)
{
    return (a<b)?a:0;
}
int main()
{
    int n;
    cin >> n;
    bool ism = false;
    for(int i=1;i<=n;i++)
    {
        cin >> hl[i];
    }
    m[0]=100.00; 
    for(int i=1;i<n;i++)
    {
        if(!ism)
        {
            double bh = max(hl[i],hl[i+1]);
            if(bh==0)
            {
                continue;
            }
            m[i] = m[i-1]/100.00*hl[i];
            ism = true;
        }
        else
        {
            double lh = min(hl[i],hl[i+1]);
            if(lh==0)
            {
                continue;
            }
            m[i] = m[i-1]*1.00/hl[i]*100.00;
            ism = false;
        }
    }
    if(ism=true)
    {
        m[n] = m[n-1]*1.00/hl[n]*100.00;
    }
    else
    {
        m[n] = m[n-1]/100.00*hl[n];
    }
    cout << m[n];
    return 0;
}

样例直接爆\ 0


by LHQing @ 2020-04-28 21:52:39

为啥每天都...


by Motbloveut221 @ 2020-04-28 21:53:42

@LHQing ?


by 小小藤藤蛇 @ 2020-04-28 21:58:19

想必没问题的话您也不会发这个帖子了


by _短笛无腔_ @ 2020-04-28 21:59:34

宁又来了


by _短笛无腔_ @ 2020-04-28 22:00:25

具体说一下有没有问题、什么问题、自己获得的分数珂海星!!!这样让我们这群蒟蒻情何以堪


by Shallow_sing @ 2020-04-28 22:02:16

想必没问题的话您也不会发这个帖子了


by 谦谦君子 @ 2020-04-28 22:22:42

想必没问题的话您也不会发这个帖子了


by Motbloveut221 @ 2020-04-28 22:30:25

@一只蒟蒻OIer 肯定是有问题啊,每次不管我输啥都输出0,然后我现在根本没提交呢,交了估计也是0


|