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 wocha at 2012-04-27 16:08:49 on Problem 3982
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int a[123][3366];
int main()
{
 int i,j,n,l,q,w,e,r,t;
 while(~scanf("%d%d%d",&q,&w,&e))
{
	memset(a,0,sizeof(a));
	for(i=1;;i++)
	{

		if(q/pow(10.00,i)==0)
		{
			a[0][i-1]=q;
			break;
		}
		else
		{
			a[0][i-1]=q%10;
			q/=10;
		}
	}
for(i=1;;i++)
	{

		if(e/pow(10.00,i)==0)
		{
			a[2][i-1]=e;
			break;
		}
		else
		{
			a[2][i-1]=e%10;
			e/=10;
		}
	}
	for(i=1;;i++)
	{

		if(w/pow(10.00,i)==0)
		{
			a[1][i-1]=w;
			break;
		}
		else
		{
			a[1][i-1]=w%10;
			w/=10;
		}
	}
	/*
	for(i=0;i<3;i++)
	{
		for(j=0;j<5;j++)
		printf("%d",a[i][j]);
		printf("\n");
	}
	*/
		int e=0,m;
	for(i=3;i<=99;i++)
	  {
		e=0;
 for(j=0;j<i+4;j++)
	{
		m=a[i-3][j]+a[i-2][j]+a[i-1][j]+e;
		if(m<10)
		{
		a[i][j]=m;
		e=0;
	  }
	  else
	   {
			a[i][j]=m%10;
			e=m/10;
		 }
	  }
	}
int o=0;
	for(i=56;i>=0;i--)
{
		if(o==1)
		{
    printf("%d",a[99][i]);
		}
		if(a[99][i]!=0&&o==0){
			o=1;
		 printf("%d",a[99][i]);;
		}
	}
printf("\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