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

看F.A.Qs

Posted by Sempr at 2007-02-01 22:32:17 on Problem 2847
In Reply To:C和GCC有什么不同之处?大牛请告知,不胜感激! Posted by:purplefly at 2007-02-01 22:25:01
> 我的代码为何在C编译通过,在GCC就WA呢?十分不解,哪位好心人能解答一下?
> 代码如下:
> #include<stdio.h>
> #include<string.h>
> #include<math.h>
> 
> int main()
> {
> 	int i,j,m;
> 	__int64 ff,temp,num,di,p,res,t;
> 	
> 	scanf("%d",&m);
> 	while(m--)
> 	{
> 	scanf("%I64d",&num);
> 	p=10;
> 	res=0;
>     i=1;
> 	
> 	while(10*num/p)
> 	{
> 		di=num%p;
> 		for(j=0;j<=9;j++)
> 		{
> 			temp=j*(__int64)pow((double)10,(double)i-1)+res;
> 			
> 			if(i<10)
> 			{
> 			t=temp;
> 			temp=(temp*t)%(__int64)pow((double)10,(double)i);
> 			temp=(temp*t)%(__int64)pow((double)10,(double)i);
> 			}
> 			else
> 			{   
> 				t=temp;
> 				temp=t*(10*(t/(p/10))+t/(p/100)%10)%(__int64)pow((double)10,(double)i);
> 				temp=(temp*10000)%(__int64)pow((double)10,(double)i);
> 				temp=(temp*10000)%(__int64)pow((double)10,(double)i);
> 				
> 				temp+=t*(t%(p/100));
> 				temp%=(__int64)pow((double)10,(double)i);
> 
> 				ff=temp*(10*(t/(p/10))+t/(p/100)%10)%(__int64)pow((double)10,(double)i);
> 				ff=(ff*10000)%(__int64)pow((double)10,(double)i);
> 				ff=(ff*10000)%(__int64)pow((double)10,(double)i);
> 				
> 				ff+=temp*(t%(p/100));
> 				ff%=(__int64)pow((double)10,(double)i);
> 				temp=ff;
> 			}
> 			if(temp==di) break;
> 		}
> 		if(!res) res=j;
> 		else res+=j*(__int64)pow((double)10,(double)i-1);
> 		i++;
> 		p*=10;
> 	}
> 	printf("%I64d\n",res);
> 	}
> return 0;
> }

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