| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:贴个代码~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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator