Submission #644133


Source Code Expand

#include<stdio.h>

int main(void)
{
	long int num[10][100000]={};
	long int n;
	int i,j;
	
	//num[0][0]=0;
	//num[0][1]=0;
	//num[0][2]=1;
	
	scanf("%d",&n);
	
	for(i=0;i<10;i++)
	{
		for(j=0;j<100000;j++)
		{
			num[i][j]=num[i][j-1]+num[i][j-2]+num[i][j-3];
		
			if(i==0 && j==0)
			{
				num[i][j]=0;
			}
		
			else if(i==0 && j=1)
			{
				num[i][j]=0;
			}
		
			else if(i==0 && j==2)
			{
				num[i][j]=1;
			}
			
			else if(i>0 && j==0)
			{
				num[i][j]=num[i-1][99997]+num[i-1][99998]+num[i-1][99999];
			}
			
			else if(i>0 && j==1)
			{
				num[i][j]=num[i-1][99998]+num[i-1][99999]+num[i][j-1];
			}
			
			else if(i>0 && j==2)
			{
				num[i][j]=num[i-1][99999]+num[i][j-1]+num[i][j-2];
			}
		}
	}
		
	if(n<=100000)
	{
		printf("%d\n",num[0][n-1]%10007);
	}
	
	else if(n>100000 && n<=200000)
	{
		printf("%d\n",num[1][n-1]%10007);
	}
	
	else if(n>200000 && n<=300000)
	{
		printf("%d\n",num[2][n-1]%10007);
	}
	
	else if(n>300000 && n<=400000)
	{
		printf("%d\n",num[3][n-1]%10007);
	}
	
	else if(n>400000 && n<=500000)
	{
		printf("%d\n",num[4][n-1]%10007);
	}
	
	else if(n>500000 && n<=600000)
	{
		printf("%d\n",num[5][n-1]%10007);
	}
	
	else if(n>600000 && n<=700000)
	{
		printf("%d\n",num[6][n-1]%10007);
	}
	
	else if(n>700000 && n<=800000)
	{
		printf("%d\n",num[7][n-1]%10007);
	}
	
	else if(n>800000 && n<=900000)
	{
		printf("%d\n",num[8][n-1]%10007);
	}
	
	else if(n>900000 && n<=1000000)
	{
		printf("%d\n",num[9][n-1]%10007);
	}
	
	return 0;
}

Submission Info

Submission Time
Task B - トリボナッチ数列
User unko114514
Language C++ (G++ 4.6.4)
Score 0
Code Size 1579 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:15: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long int*’ [-Wformat]
./Main.cpp:26:22: error: lvalue required as left operand of assignment
./Main.cpp:55:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
./Main.cpp:60:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
./Main.cpp:65:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
./Main.cpp:70:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
./Main.cpp:75:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
./Main.cpp:80:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat]
./Main...