Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

A Multiplication Game/권영기: Difference between revisions

From ZeroWiki
imported>trailblaze
No edit summary
imported>trailblaze
No edit summary
Line 1: Line 1:
#include<stdio.h>
잘못된페이지.
#define swap(s, w) t = s, s = w, w = t;
 
long long int t;
같은 실수를 하다니..
long long int n, start1, end1, start2, end2;
long long int getStart(long long int start, int cnt)
{
long long int temp;
if(cnt % 2 == 1){
temp = start/9;
if(temp * 9  < start)temp++;
return temp;
}
else{
temp = start/2;
if(temp * 2 < start)temp++;
return temp;
}
}
int main(void)
{
int cnt;
while(scanf("%lld", &n) == 1){
cnt = 0;
start2 = n;
while(1)
{
cnt++;
end1 = start2 - 1;
start1 = getStart(start2, cnt);
if(start1 <= 1 && 1 <= end1)break;
swap(end1, end2);
swap(start1, start2);
}
if(cnt % 2 == 1)printf("Stan wins.\n");
else printf("Ollie wins.\n");
}
return 0;
}
----
----
[[ACM_ICPC/2012스터디]]
[[ACM_ICPC/2012스터디]]



Revision as of 14:13, 17 August 2012

잘못된페이지.

같은 실수를 하다니..


ACM_ICPC/2012스터디