If you have any questions, please note that this code is only tested locally and cannot be submitted for OJ testing. There will inevitably be problems. Learning Together .......
# Include <stdio. h> # include <string. h> # include <stdlib. h> int CMP (const void * a, const void * B) {return * (int *) A-* (int *) B;} int main () {int N, index, I; int sum [1001]; // freopen ("C: \ Users \ SJF \ Desktop \ acm.txt", "r", stdin ); memset (sum, 0, sizeof (SUM); Index = 0; while (scanf ("% d", & N )! = EOF) {If (n = 0) {// sort qsort (sum, index, sizeof (sum [0]), CMP); for (I = 0; I <index; I ++) {if (I = index-1) {printf ("% d \ n", sum [I]);} else {printf ("% d", sum [I]) ;}} break;} // calculate the sum of all while (n) {sum [Index] + = n % 10; n/= 10;} index ++;} return 0 ;}
# Include <stdio. h> # include <stdlib. h> # include <limits. h> int matrix [101] [101]; typedef struct MINMAX {int X; int y; int value;} mm; int main () {int n, m, I, j; mm min [101], Max [101]; // freopen ("C: \ Users \ SJF \ Desktop \ acm.txt", "r ", stdin); While (scanf ("% d", & N, & M )! = EOF) {for (I = 0; I <n; I ++) {Min [I]. value = int_max; For (j = 0; j <m; j ++) {scanf ("% d", & matrix [I] [J]); // If (Matrix [I] [J] <min [I]. value) {Min [I]. value = matrix [I] [J] ;}}for (j = 0; j <m; j ++) {max [J]. value = int_min; for (I = 0; I <n; I ++) {// The maximum value of each column if (MAX [J]. value <matrix [I] [J]) {max [J]. value = matrix [I] [J] ;}}// output Saddle Point int flag = 0; for (I = 0; I <n; I ++) {for (j = 0; j <m; j ++) {If (Min [I]. y = MAX [J]. Y & Min [I]. X = MAX [J]. X & Min [I]. value = MAX [J]. value) {flag = 1; printf ("% d \ n", I, j, Min [I]. value) ;}}// if there is no Saddle Point Output noif (flag = 0) {printf ("NO \ n") ;}} return 0 ;}
# Include <stdio. h> # include <stdlib. h> # include <limits. h> int matrix [101] [101]; int main () {int n, m, I, j, index, flag, mark; int min; // freopen ("C: \ Users \ SJF \ Desktop \ acm.txt", "r", stdin); While (scanf ("% d ", & N, & M )! = EOF) {mark = 0; // input data for (I = 0; I <n; I ++) {for (j = 0; j <m; j ++) {scanf ("% d", & matrix [I] [J]) ;}} for (I = 0; I <n; I ++) {min = int_max; For (j = 0; j <m; j ++) {// the minimum value of each line if (min> matrix [I] [J]) {min = matrix [I] [J]; Index = J ;}// in the column where it is located, determine whether it is the maximum flag = 0; For (j = 0; j <n; j ++) {If (Min <matrix [J] [Index]) {flag = 1; break ;}} if (flag = 0) {printf ("% d \ n", I, index, min); Mark = 1 ;}} // if no saddle point is output, noif (mark = 0) {printf ("NO \ n") ;}} return 0 ;}
# Include <stdio. h> # include <stdlib. h> # include <string. h> int main () {int I, j, Len, num; char STR [101]; char pre; // freopen ("C: \ Users \ SJF \ Desktop \ acm.txt "," r ", stdin); While (scanf (" % s ", STR )! = EOF) {Len = strlen (STR); num = 0; // extract the output file for (I = 0; I <Len; I ++) {If (STR [I] <'0' | STR [I]> '9') {for (j = 0; j <num-1; j ++) {printf ("% C", pre) ;}num = 0; // The character pre = STR [I]; printf ("% C ", STR [I]);} else {// extract number num = num * 10 + STR [I]-'0' ;}} for (I = 0; I <num-1; I ++) {printf ("% C", pre);} printf ("\ n");} return 0 ;}
Test cases:
A5b3aba13b4
Output: aaaaabbbabaaaaaaaaaaaaabbbb
Bbabab3a5abb
Output:
Bbababbbaaaaaabb