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了,这样做为什么会TLE!??

Posted by jordankan at 2008-09-03 19:00:08 on Problem 1953
#include<math.h>
#include<stdio.h>
main(){
    int n,temp=1,h,j;
	int i,k,sum=1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
	    scanf("%d",&k);
		sum=k+1;
        for(j=2;j<=(k/2+1);j++){
			for(h=k-pow(2,j-1);h!=0;h--){
			   temp=temp*h;
			}
			sum=temp+sum;
			temp=1;
		}  
        printf("Scenario #%d:\n%d\n",i+1,sum);
		sum=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