Home > Back-end >  Who first down
Who first down

Time:01-21

which bosses look I knock on the code which is wrong? Why are there no output?
topics are as follows:
Who first down
Building-would is ancient Chinese wine culture as part of a fun, two people on the wine table building-would of method is: in the mouth a number, each at the same time to her out of a number, if who holds a number equal to the sum of two people shout out of digital, who lose, loser for a cup of wine, two people to win or to lose two people continues to the next round, until the only winner,

Given below a, b two people's capacity for liquor (at most) can drink how much cup and building-would records, would you please determine two men who first down,

Input format:
Enter the first line has given a, b two people drink of the nonnegative integers (no more than 100), separated by Spaces, the next row is given a positive integer N (100) or less, then N lines, each line give a round of building-would records, format for:

A shout a cross b shout b row
Among them is shout shout out Numbers, row is drawn Numbers, are all positive integers less than 100 (two hands row),

The output format:
Output in the first row, first the man fall: on behalf of A and B on behalf of B, the second line of the output the man standing drink how much cup, ensure that there is A person fall, pay attention to the process end, someone fell behind the data don't have to deal with,

Input the sample:
1 1
6
8 9 10 12
5 to 10 10
3 August 5 12
12 18 1 13
4 16 12 15
15 1 1 16
The output sample:
A
1


 # include "stdio.h" 


Int main ()
{
Int j1, j2, n.
The scanf (" % d % d ", & amp; J1, & amp; J2);
The scanf (" % d ", & amp; n);

Int a [100], [100] b, c [100], [100] d;
For (int I=0; I & lt; N; I++)
The scanf (" % d % d % d % d \ n ", & amp; A [I], & amp; [I], b & amp; [I], c & amp; D [I]);

Int p=0, t=0;
For (int I=0; I & lt; N; I++)
{
If (b [I]==a + c [I] [I] & amp; & D [I]!=a + c [I] [I])
P++;
If (b [I]!=a + c [I] [I] & amp; & D [I]==a + c [I] [I])
T++;
If (p & gt; J1)
{
Printf (" A \ n % d ", t);
break;
}
If (t & gt; J2)
{
Printf (" \ n B % d ", p);
break;
}
}






return 0;
}

CodePudding user response:

Line 12 more than dozen \ n
 the scanf (" % d % d % d % d ", & amp; A [I], & amp; [I], b & amp; [I], c & amp; D [I]); 

CodePudding user response:

Why add \ n, is wrong?

CodePudding user response:

Refer to this blog: https://blog.csdn.net/21aspnet/article/details/174326
  • Related