Question 1200: The maximum two acm c language implementations

Source: Internet
Author: User
 

 
 # include 
    
      # define P (z) for (I = 0; I <5; ++ I) printf ("% d", Z [I]); printf ("\ n"); int main () {int N, I, j, t, a [5], B [5]; while (~ Scanf ("% d", & N) {While (n --) {scanf ("% d", A, A + 1, A + 2, A + 3, A + 4, B, B + 1, B + 2, B + 3, B + 4); for (I = 0; j = I % 5, I <10; ++ I) {scanf ("% d", & T); If (T> A [J]) {if (a [J] 
      B [J]) B [J] = T;} P (A); P (B) ;}}
    
Description:
Enter a matrix of four rows and five columns to find the maximum two numbers of each column.
Input:
The first line of the input includes an integer N (1 <= n <= 1000), and the next four rows contain five integers. Represents a matrix of four rows and five columns. All matrix elements are integers.
Output:
Multiple groups of test data may exist. For each group of data, the maximum two numbers of each column are output according to the sample output format, if one of the two largest numbers has multiple identical values in this column, the row value is the one with a small row value.
The row and column sequence of the original matrix must be retained during output. That is, the row values in the original matrix are smaller than those in the original matrix.
Sample input:
1
1 2 4 9 8
-1 4 9 8 8
12 9 8 7 0
7 8 9 7 0
Sample output:
12 9 9 9 8
7 8 9 8 8
 
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.