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

Re:贴个代码~

Posted by cpfromcuhk at 2010-03-13 03:52:14 on Problem 2505
In Reply To:贴个代码~ Posted by:cpfromcuhk at 2010-03-13 03:48:24
再简洁点

#include <stdio.h>
#include <math.h>

int main()
{
	unsigned long n;

	while(scanf("%d",&n)!=EOF)
	{
		while(1)
		{
			if(n<=9)
				break;
			n=(unsigned long)ceil( (double)n/18 );
		}
		if(n<=1)
			printf("Ollie wins.\n");
		else
			printf("Stan wins.\n");
	}

	return 0;
}

> #include <stdio.h>
> #include <math.h>
> 
> int main()
> {
> 	unsigned long n;
> 
> 	while(scanf("%d",&n)!=EOF)
> 	{
> 		if(n<=9)
> 		{
> 			printf("Stan wins.\n");
> 			continue;
> 		}
> 		while(1)
> 		{
> 			n=(unsigned long)ceil( (double)n/18 );
> 			if(n<=9)
> 				break;
> 		}
> 		if(n<=1)
> 			printf("Ollie wins.\n");
> 		else
> 			printf("Stan wins.\n");
> 	}
> 
> 	return 0;
> }
> 自己感觉比较简洁~O(∩_∩)O~

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