Game Hdu 3032, Hdu 1525

Source: Internet
Author: User
Tags printf

HDU 3032:

#include <cstdio>
#include <cstring>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
#define LL Long Long
 

int main ()
{
	int t;
	scanf ("%d", &t);
	while (t--)
	{
		int n,i,j,k;
		scanf ("%d", &n);
		int ans=0;
		while (n--)
		{
			scanf ("%d", &k);
			j=k%4;
			if (j==3) k++;
			else if (j==0) k--;
			ans^=k;
		}
		if (ans)
			printf ("alice\n");
		else
			printf ("bob\n");
	}
}


HDU 1525:

#include <cstdio>
#include <cstring>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
#define LL Long long
 
int p[1000];
int main ()
{
	int n,m,t;
	while (scanf ("%d%d", &n,&m), n+m)
	{
		if (n<m) swap (n,m);
		int cnt=0;
		while (m)
		{
			p[cnt]=n/m;
			t=m;
			m=n%m;
			n=t;
			cnt++;
		}
		int F;
		if (cnt==0)
			f=0;
		else if (cnt==1)
		{
			f=1;
		}
		else 
		{
			int sum=0;
			for (int i=0;i<cnt-1;i++)
			{
				if (p[i]==1)
					sum++;
				else break
					;
			}
			if (sum%2==1)
				f=0;
			else
				f=1;
		}
		if (f==1)
			printf ("Stan wins\n");
		else
			printf ("Ollie wins\n");
	}
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.