Postgraduate review machine questions (2010)

Source: Internet
Author: User

Postgraduate review machine questions (2010)

Reprinted please indicate the source: dunni column http://blog.csdn.net/u012027907


Answer:

/** Description: machine question a answer * Author: Zhang yachao * blog: dunny column http://blog.csdn.net/u012027907 * Date: */# include "stdio. H "# define Max 1000int getevesum (INT num) {// calculate the numbers and INT sum = 0; while (num! = 0) {int r = num % 10; num = num/10; sum + = r;} return sum;} void sort (INT store [], int count) {// bubble sort for (INT I = 0; I <count; I ++) for (Int J = I + 1; j <count; j ++) {If (store [I]> store [J]) {int temp = store [I]; store [I] = store [J]; store [J] = temp ;}}void print (INT store [], int count) {// print the output for (INT I = 0; I <count; I ++) printf ("% d", store [I]); printf ("\ n") ;}int main () {int store [Max]; int COUNT = 0; int num; scanf ( "% D", & num); While (num! = 0) {store [count ++] = getevesum (Num); scanf ("% d", & num) ;}sort (store, count); print (store, count); Return 0 ;}


Answer:

/** Description: Machine questions B answers * Author: Zhang yachao * blog: dunny column http://blog.csdn.net/u012027907 * Date: */# include <stdio. h> # define M 100 # define n 100 void maanpoint (INT matrix [] [N], int M, int N) {bool isexist = false; int min, JJ, Max, II; For (INT I = 0; I <m; I ++) {// traverse a row by min = matrix [I] [0]; JJ = 0; for (int d = 0; D <n; D ++) {// find the minimum value of each row and Its subscript if (Matrix [I] [d] <min) {min = matrix [I] [d]; JJ = D ;}} max = matrix [0] [JJ]; II = 0; (Int A = 0; A <m; A ++) {// find the maximum value of each column and Its subscript if (Matrix [a] [JJ]> MAX) {max = matrix [a] [JJ]; II = A ;}} if (max = min) {// equal, isexist = true at the saddle point; printf ("% d \ n", II, JJ, max) ;}} if (! Isexist) {// The Saddle Point printf ("NO \ n") ;}} int main () {int matrix [m] [N]; int M, N; scanf ("% d", & M, & N); For (INT I = 0; I <m; I ++) for (Int J = 0; j <n; j ++) {scanf ("% d", & matrix [I] [J]);} maanpoint (matrix, m, n); Return 0 ;}

Reprinted please indicate the source: dunni column http://blog.csdn.net/u012027907


Postgraduate review machine questions (2010)

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.