Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:大虾帮忙!

Posted by cpp050700448084 at 2005-04-08 20:41:06 on Problem 1477
In Reply To:大虾帮忙! Posted by:cpp050700448084 at 2005-04-08 20:36:27
> #include <iostream.h>
> void main()
> {
> 	int t;
> 	cin >> t;
> 	int i,temp,sum;
> 	int j = 1;
> 	while ( t != 0){
> 		sum = 0;temp = 0;
> 		int * p = new int [ t ];
> 		for ( i = 0; i < t; i ++){
> 			cin >> p [ i ];
> 			sum += p[i];
> 			sum = sum / t;
> 		}
> 		for ( i = 0; i < t; i ++)
> 			if ( p [ i ] > sum )
> 				temp ++;
> 		cout << "Set #" << j << endl <<"The minimum number of moves is "
> 			<< temp << "." << endl << endl;
> 		j ++;
> 		delete [] p; 
> 		cin >> t;
> 	}
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator