i've tryed several times to solve this.... but i've still having WA...
that's my code... can anyone help me???
aahhhh... it's in JAVA...
![:)](./images/smilies/icon_smile.gif)
[java]
import java.io.*;
import java.util.StringTokenizer;
class Main
{
static String ReadLn ()
{
StringBuffer s = new StringBuffer("");
int car = -1;
try{
do{
car = System.in.read();
if ((car < 0) || (car == '\n')) break;
else s.append((char) car);
} while(car > 0);
} catch (IOException e){return (null);}
if (car < 0)return null;
String aux=s.toString();
return aux.substring(0,aux.length()-1);
}
public static void main (String[] args)
{
Main c1= new Main();
c1.procesar();
}
void procesar()
{
StringTokenizer st = new StringTokenizer(ReadLn());
int n=Integer.parseInt(st.nextToken());
int m=Integer.parseInt(st.nextToken());
int men,may;
while (!(n==0 && m==0))
{
if(n<m)
{
men=n;
may=m;
}
else
{
men=m;
may=n;
}
boolean s=true;
while (may < men*2)
{
may=may-men;
n=men;
m=may;
if(m<n)
{
men=m;
may=n;
}
s=!s;
}
st = new StringTokenizer(ReadLn());
n=Integer.parseInt(st.nextToken());
m=Integer.parseInt(st.nextToken());
if(m==0 && n==0)
{
if(s)System.out.print("Stan wins");
else System.out.print("Ollie wins");
}
else
{
if(s)System.out.println("Stan wins");
else System.out.println("Ollie wins");
}
}
}
}
[/java]