Home > Back-end >  A C language problem, the pta has been wrong, urgent request
A C language problem, the pta has been wrong, urgent request

Time:12-15

7-2 did you brush quickly today (15 points)
Quickly is a short video app software, to the fire inside every day update some interesting video, so it became a way we pass the time, but some classmate go in to see interesting video can't stop, cause addicted to it, when you enter and exit quickly app, it has a record of the background data into well quickly and out of time, the teacher in charge of you want to know each student in your class every brush well quickly, so he asked quickly platform for recording data of the background in your class, but these data are scattered, the teacher in charge of you let you help him to every classmate according to the smallest brush video time,

Input format:
In the first row to two integer n and m (1 n 1000, 0 or less or less m or less 10 ^ 4 or less), n is the number of people in your class, m represents the data on the number of article, the next m lines of each line to a set of data, format for: student id to enter exit time, student id for your class number from 0 to n - 1 and for three digits, subject to ensure that all the time of the given are all within the same day,

The output format:
Will brush quickly the total time of the day every classmate smallest to output (if equal condition, according to the student id since output), the output format for: student number, the final output for the longest time,

Note: the output and the output of student number for three digits (less than three to fill a leading 0), output time format for: 00:00:00
# include


Int main ()
{
Int n, m, I, j;
The scanf (" % d % d ", & amp; N, & amp; M);
B int aa [10001] [8], [10001], [6], re [10001] [4].
For (I=1; i<=m; I++)
{
The scanf (" % d % d: % d: % d % d: % d: % d ", & amp; Aa [I] [0], & amp; Aa [1], [I] & amp; Aa [I] [2], & amp; Aa [I] [3], & amp; Aa [I] [4], & amp; Aa [I] [5], & amp; Aa [I] [6]);
B [I] [3]=aa [I] [0];
B [I] [4]=0;
B [I] [0]=0;
B [I] [1]=0;
B [I] [2]=0;
B [I] [2]=aa [I] [6] - aa [I] [3];
If (b [I] [2] <0)
{
B [1] - [I];
B [I] [2] [I] [2]=b + 60;
}
B [I] [1]=aa [I] [5] - aa + b [I] [2] [I] [1];
If (b [I] [1] <0)
{
[I] [0] - b;
B [I] [1] [I] [1]=b + 60;
}
B [I] [0]=aa [I] [4] - aa + b [I] [1] [I] [0];
}
For (I=1; i<=m; I++)
{
for(j=i+1; j<=m; J++)
{
If ((b [I] [3]==b [j] [3]) & amp; & B [j] [4]==0)
{
B [I] [2] [I] [2]=b + b [j] [2];
If (b [I] [2] & gt;=60)
{
[I] [2]=b b [I] [2] - 60;
B [I] [1] + +;
}
B [I] [1] [I] [1]=b + b [j] [1];
If (b [I] [1] & gt;=60)
{
[I] [1] b=b [1] - [I] 60;
B [I] [0] + +;
}
B [I] [0] [I] [0]=b + b [j] [0];
B [j] [4]=1;
}
}
If (b [4] [I]!
=1){
B [I] [5] [I] [0]=b * 60 * 60 + b * 60 + b [I] [1] [2] [I];
}
}
int temp;
For (I=1; i<=m; I++)
{
for(j=i; j<=m; J++)
{
If (b [4] [I]!=1 & amp; & B [j] [4].
=1){
If ((b [I] [5] {
\ [I] [0]=b;
[I] [0]=b b [j] [0];
B [j] [0]=temp;
Temp=b [I] [1];
[I] [1] b=b [j] [1];
B [j] [1]=temp;
Temp=b [I] [2];
[I] [2]=b b [j] [2];
B [j] [2]=temp;
Temp=b [I] [3];
[I] [3] b=b [j] [3];
B [j] [3]=temp;
Temp=b [I] [5];
[I] [5] b=b [j] [5];
B [j] [5]=temp;
}

}
}
}
For (I=1; i<=m; I++)
{
If (b [4] [I]!
=1)02 03 printf (" % d % d: % 02 d: \ n % 2 d ", [I] [3], b b [I] [0], [I] [1] b, b [I] [2]).
}
}
  • Related