Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Ants 1852 为什么会Runtime Error啊

Posted by 2537732688 at 2021-01-15 15:48:10
#include <iostream>
using namespace std;
int x;
pair<int,int> ant[100];
int sumn[100][100];
int main()
{
    scanf("%d",&x);
    for(int i=0;i<x;i++)
    {
        scanf("%d",&ant[i].first);
        scanf("%d",&ant[i].second);
        for(int j=0;j<ant[i].second;j++)
        {
            scanf("%d",&sumn[i][j]);
        }
    }
    for(int i=0;i<x;i++)
    {
        int tmin=0,tmax=0;
        for(int j=0;j<ant[i].second;j++)
        {
            if(sumn[i][j]<(ant[i].first/2))
            {
                tmin=max(sumn[i][j],tmin);
                tmax=max(tmax,ant[i].first-sumn[i][j]);
            }
            else
            {
                tmin=max(tmin,ant[i].first-sumn[i][j]);
                tmax=max(tmax,sumn[i][j]);
            }
        }
        printf("%d %d\n",tmin,tmax);
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator