All pastes #259660 Raw Edit

Miscellany

public java v1 · immutable
#259660 ·published 2006-11-27 17:11 UTC
rendered paste body
import java.io.*;import java.math.*;import java.util.*;public class Main{	public static void main(String[] args) throws IOException	{		int k=0;		BigInteger three = new BigInteger("3");		BigInteger temp,n;		BigInteger value = BigInteger.ZERO;		StringTokenizer st;		String str;		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));		int flag = 0;		while(true)		{			str = br.readLine();			st = new StringTokenizer(str," ");			if(flag==0&&st.hasMoreTokens())			{				k = Integer.parseInt(st.nextToken());				flag = 1;			}			if(st.hasMoreTokens()==false)				continue;			n = new BigInteger(st.nextToken());			n = n.mod(three);			value = n;			k--;			while(st.hasMoreTokens())			{				str = st.nextToken();				temp = new BigInteger(str);				temp = temp.mod(three);				k--;				value = value.xor(temp);			}			if(k==0)				break;		}		if(value.compareTo(BigInteger.ZERO)==0)			System.out.println("Second wins.");		else			System.out.println("First wins.");	}}