样例过了零分
查看原帖
样例过了零分
1029721
AnsonIsTheBest楼主2024/9/7 08:10

没找到毛病啊

#include <iostream>
using namespace std;
int main()
{
    int l;
    int n;
    cin>>l>>n;
    int min=l,max=0;
    int temp;
    for (int i=0;i<n;i++)
    {
        cin>>temp;
        if (temp>max)
        {
            max=temp;
        }
        if (temp<min)
        {
            min=temp;
        }
    }
    if (l-max<min)
    {
        cout<<l-max+1;
    }
    else
    {
        cout<<min+1;
    }
    cout<<" ";
    if (max>l-min)
    {
        cout<<max+1;
    }
    else
    {
        cout<<l-min+1;
    }
}
2024/9/7 08:10
加载中...