TOJ 3861.Erase

    xiaoxiao2025-04-15  6

    题目链接:http://acm.tju.edu.cn/toj/showp3861.html

    3861.    Erase
    Time Limit: 1.0 Seconds    Memory Limit: 65536K Total Runs: 392    Accepted Runs: 212

    Ann is playing a number game with her friend Bob. They are both very clever.

    At first, there are n consecutive numbers. Each time Ann and Bob will erase a number in turn until only 2 numbers left. Ann always goes first. If the last 2 numbers are coprime, then Ann wins. Otherwise Bob wins. Being coprime means that 2 numbers have no common factor other than 1.

    For example, there are 3 consecutive numbers 6, 7, and 8, from 6 to 8. Ann will erase 6 so that only 7 and 8 are left. Bob shouldn't erase any number because there are only 2 numbers. Obviously 7 and 8 are coprime so that Ann wins. To simplify this problem, you can assume that n is an odd number.

    Input

    A line contains an integers n ( 2 < n < 2^32).

    Output

    Print a line "Ann wins". if Ann could win, or "What a pity!" .

    Sample Input

    3

    Sample Output

    Ann wins.

    Source: TJU 2012 Team Selection
    Submit   List    Runs   Forum   Statistics

    题意很简单,结论是Ann永远会赢,至于为什么,稍后更新。。

    #include <stdio.h> int main(){ long long n; while(~scanf("%lld",&n)) printf("Ann wins.\n"); }

    转载请注明原文地址: https://ju.6miu.com/read-1298098.html
    最新回复(0)