Subject description:
It is one of China's moon cake traditional cakes prestigious, since the Tang Dynasty, has developed hundreds of varieties. For competitions a kind of "best eating" moon cake, eat goods sector that is bound to lead to a reign of terror in ...... here we use the number of words, given the country a variety of moon cake sales, requiring you to find out the sales champion, identified as the best to eat moon cake. Input format: input is first given two positive integers N (≤1000) and M (≤100), respectively, the number of kinds of moon cake (moon cake so the default type number from 1 to N) and the number of cities participating statistics. Next M rows, each row is given a non-negative integer N (no more than 1 million), which is an integer of i-th moon cake sales of the i-th (block). Between numbers separated by a space. Output format: maximum output volume in the first row, the type of the highest-numbered second row output moon cake volume. If the winner is not unique, press the numbers in ascending order output tied for the championship. Between numbers separated by a space, the line from beginning to end may not have the extra space. Sample input: . 5. 3 1001 992. 6 0 233 . 8 0 2008 0 2018 36 1024 18 is 0. 4 Output Sample: 2018 . 3. 5
Highlights Reflection:
int max, flag = 0; // flags are recorded and maximum // flag when the read function is a maximum value, a maximum value before the first space without // end Title ensure the no extra spaces // not calculated Title number value satisfies the condition max
I AC Code:
// 1092 moon cake best to eat the AC 03 // flag when the read function is a maximum value, a maximum value before the first space without // end Title ensure the no extra spaces // max value without calculation satisfies the conditions subject number # the include <stdio.h> # 1000001 DEFINE max int main (void) { int N, M, Val; int I, J; int max, In flag = 0; // flags are recorded and maximum // flag when the read action is maximum, a maximum value before the first space without // end Title ensure the no extra spaces // max value without calculating the number satisfying the condition of the subject int the Sum [max] = {0}; Scanf ( " % D% D ", & N, & M); // calculate each sales for (I = 0; I <M; I ++) { for (J = 0; J <N; J ++) { Scanf ("% D " , & Val); the Sum [J] + = Val; } } max = the Sum [0]; for (I = 0; I <N; I ++) { // maximum numerical IF (max <the Sum [I]) { max = the Sum [I]; } } // outputs the final result of the printf ( "% D \ n-", max); for (I = 0; I <N; I ++) { IF (the Sum [I] == max) { // the control flag by the output format flag IF (flag == 0) { flag =. 1; } the else { the printf ( ""); } the printf ( "% D", I +. 1); } } return 0; }
RRR