Home > Back-end >  The Time Limit Exceeded Length
The Time Limit Exceeded Length

Time:10-30

I ask is that wrong
#include
Void the sort (int [] s)
{
int t;
for(int i=0; S [I]!='\ 0'; I++)
For (int j=I + 1; S [j].='\ 0'; J++)
If (s [I] {
T=s [I];
S [j] [I]=s;
S [j]=t;
}
}

Int main ()
{
Int n, m;
Int a [3005], [1005] b;
While (the scanf (" % d % d ", & amp; N, & amp; M)!=(EOF)
{
for(int i=0; iThe scanf (" % d ", & amp; A [I]);
Int k=0;
for(int i=0; iFor (int j=I + 1; JB=a [I] + [k] a [j];
k++;
}
Sort (b);
for(int i=0; iPrintf (" % d, b [I]);
printf("\n");
}
}

CodePudding user response:

 # include 

//void the sort (int [] s)
Void the sort (int [s], int len)
{
int t;
//for (int I=0; S [I]!='\ 0'; I++)
for(int i=0; I & lt; Len. I++)
//for (int j=I + 1; S [j].='\ 0'; J++)
For (int j=I + 1; J & lt; Len. J++)
If (s [I] {
T=s [I];
S [j] [I]=s;
S [j]=t;
}
}

Int main ()
{
Int n, m;
Int a [3005], [1005] b;
While (the scanf (" % d % d ", & amp; N, & amp; M)!=(EOF)
{
for(int i=0; iThe scanf (" % d ", & amp; A [I]);
Int k=0;
for(int i=0; iFor (int j=I + 1; JB=a [I] + [k] a [j];
k++;
}
//sort (b);
Sort (b, k);
for(int i=0; iPrintf (" % d, b [I]);
printf("\n");
}
}

For your reference ~

The original poster is confused, '\ 0' is the end of the string tag, not int the end of an integer

CodePudding user response:

The
reference 1/f, confident boy reply:
 # include 

//void the sort (int [] s)
Void the sort (int [s], int len)
{
int t;
//for (int I=0; S [I]!='\ 0'; I++)
for(int i=0; I & lt; Len. I++)
//for (int j=I + 1; S [j].='\ 0'; J++)
For (int j=I + 1; J & lt; Len. J++)
If (s [I] {
T=s [I];
S [j] [I]=s;
S [j]=t;
}
}

Int main ()
{
Int n, m;
Int a [3005], [1005] b;
While (the scanf (" % d % d ", & amp; N, & amp; M)!=(EOF)
{
for(int i=0; iThe scanf (" % d ", & amp; A [I]);
Int k=0;
for(int i=0; iFor (int j=I + 1; JB=a [I] + [k] a [j];
k++;
}
//sort (b);
Sort (b, k);
for(int i=0; iPrintf (" % d, b [I]);
printf("\n");
}
}

For your reference ~

The original poster is confused, '\ 0' is the end of the string tag, not int the end of an integer

Yes thank you yesterday, I also considered is the location out of the question, but finally went to change themselves stupid

CodePudding user response:

But the timeout
  • Related