"Hdu 5512" "2015ACM/ICPC Asia Shenyang Station" pagodas Test Instructions & Code (c + +)

Source: Internet
Author: User

Topic Links:
http://acm.hdu.edu.cn/showproblem.php?pid=5512
Test Instructions:
Given n points and a, B two initially labeled points, each time you can choose to have been labeled points in the two points I, J to mark the new point i+j or i-j, two people take turns mark, if who cannot mark, who loses, the output wins the person.
The following:
First we found that when a, B coprime, it through the above operation, it can be marked to 1th points, and then all points can be marked, when a, B is not coprime, write a few number of rules found GCD (A, A, a) multiple positions can be labeled.
Code:

#include <iostream>#include <algorithm>#include <stdio.h>using namespace STD;intN,t,a,b;intMain () {scanf("%d", &t); for(intt=1; t<=t;t++) {scanf("%d%d%d", &n,&a,&b);intG=__GCD (A, b);intnum=n/g-2;if(num%2==1)printf("Case #%d:yuwgna\n", t);Else        printf("Case #%d:iaka\n", t); }}

"Hdu 5512" "2015ACM/ICPC Asia Shenyang Station" pagodas Test Instructions & Code (c + +)

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.