#11548: TLE..why...實際測試可行


40405121 (40405121)

School : 正修科技大學
ID : 54332
IP address : [123.205.97.93]
Last Login :
2019-07-20 10:42:29
d984. 棄保效應 -- 板橋高中教學題 | From: [114.27.60.154] | Post Date : 2016-11-19 12:55

#include <stdio.h>
#include <string.h>

int main()
{
while (1)
{

unsigned int vote[3];
int max = 0;
int min = 0;
memset(vote,0,sizeof(vote));

for ( int i = 0 ; i < 3 ; i++)
{
scanf("%d",&vote[i]);
if ( vote[max] < vote[i] ) max = i;
if ( vote[min] > vote[i] ) min = i;
}

int mid = 3-min-max;
vote[mid] += vote[min];
if ( vote[mid] > vote[max] ) printf("%c\n",mid + 65);
else printf("%c\n",max + 65);

}
return 0;
}

 
#16718: Re:TLE..why...實際測試可行


Easonsfriend (123)

School : 臺北市私立延平高級中學
ID : 89827
IP address : [106.105.188.90]
Last Login :
2020-11-01 09:21:46
d984. 棄保效應 -- 板橋高中教學題 | From: [106.105.188.90] | Post Date : 2019-02-01 21:32

#include
#include

int main()
{
while (1)
{

unsigned int vote[3];
int max = 0;
int min = 0;
memset(vote,0,sizeof(vote));

for ( int i = 0 ; i < 3 ; i++)
{
scanf("%d",&vote[i]);
if ( vote[max] < vote[i] ) max = i;
if ( vote[min] > vote[i] ) min = i;
}

int mid = 3-min-max;
vote[mid] += vote[min];
if ( vote[mid] > vote[max] ) printf("%c\n",mid + 65);
else printf("%c\n",max + 65);

}
return 0;
}

//印出來要大寫




 
ZeroJudge Forum