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 zhucheng at 2005-03-05 18:19:15 on Problem 2231
In Reply To:不行了,各位大侠帮帮忙吧! Posted by:c0500448161 at 2005-03-05 18:14:41
> #include <iostream.h>
> #include <stdlib.h>
> 
> int cmp(const void *a, const void *b){
> 	return *(int *)a - *(int *)b;
> }
> 
> int main(){
> 	unsigned int Place[10000], Num, i;
> 	__int64 Vol = 0, Temp = 1;
> 	cin >>Num;
> 	for (i = 0; i < Num; i++)
> 		cin >>Place[i];
> 	
> 	qsort(Place, Num, sizeof(unsigned int), cmp);
> 	
> 	for (i = 0; i < Num - 1; i++)
> 		Vol += (Place[i+1] - Place[i]) * (i + 1) * (Num - i - 1) * 2;
> 	while(Temp <= Vol ) Temp *= 10;
> 	Temp /= 10;
> 
> 	while(Temp > 0){
> 		cout <<int(Vol / Temp);
> 		Vol %= 10 ;
> 		Temp /= 10;
> 	}
> 	cout <<endl;
> 
> 	return 0;
> }
> 
> 总是 WA。
> 顺便问下, __int64类型的该怎么输出
__int64也不够用
printf("%I64d\n"

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