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

例子过的很好呀,为什么会错呢,求求各位大牛了!!

Posted by ace_killer at 2009-04-03 23:24:27 on Problem 2105
//pku_2105
#include<stdio.h>
#include<math.h>

void main()
{
	char a[33];
	int i=0,j=0,n,t[9][4],b[9][32],k=0;
	for(i=0;i<4;i++)
		for(j=0;j<9;j++)
			t[i][j]=0;  
	scanf("%d",&n); 
	if(n>=1&&n<=9)
	{
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		for(j=0;j<32;j++)
			b[i][j]=a[j]-48;
	}
	for(i=0;i<4;i++)
	{
		for(j=31;j>=0;j--)
		{
		k=j%8;
		if(k!=0)
			b[i][j]=b[i][j]*(int)pow(2,7-k);
		else
			b[i][j]=b[i][j]*(int)pow(2,7);
		}
	}

	for(i=0;i<n;i++)
	{
		k=0;
		for(j=31;j>=0;j--)
		{
				if((j%8)!=0)
					t[i][k]+=b[i][j];
				else
				{
					t[i][k]+=b[i][j];
					k++;
				}
		}
	}

for(i=0;i<n;i++)
	
printf("%d.%d.%d.%d\n",t[i][3],t[i][2],t[i][1],t[i][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