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

这个也能TLE吗????

Posted by wanglinggui at 2007-11-07 14:43:05 on Problem 3421
#include <iostream>
using namespace std;

const int MAX=(1<<20)+1;

int a[MAX], c[MAX];

void set()
{
	int i, j, t;
	c[1]=1;
	for(i=1; i<MAX; ++i)
	{
		t=a[i]+1;
		for(j=i+i; j<MAX; j+=i)
		{
			if(a[j]<t)
			{
				a[j]=t;
				c[j]=c[i];
			}
			else if(a[j]==t) c[j]+=c[i];
		}
	}
}

int main()
{
	set();
	int i;
	while(scanf("%d", &i)==1)
	{
		printf("%d %d\n", a[i], c[i]);
	}
	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