WOJ1300-Stone

本文介绍了一种基于取石子游戏的博弈论算法问题,玩家每次可以取2、3或5个石子,不能取石子者输。通过分析游戏规律,得出玩家胜败的关键在于石子总数模7的余数。

Dzs and Sproblvem love mathmatics, so when they play games they also want to find out the inner rules of the game. 
The game they played is very classic. 
There is a pile of stones, two players can pick 2,3 or 5 stones each round, if the player can't pick stones from thepile, for instance if there is only 1 stone left, he will lose the game. 
This time Sproblvem will be the "first pick" player ,he want to know if both of them play perfect who will win? 

输入格式

At the first line is a number c (1<= c <= 1025), means there will be c case.
Then follow c lines, each line have number n (0 <= n <= 1000000) represent that pile have n stones.

输出格式

For each case print one line, if Sproblvem will win the game, output "Sproblvem" otherwise output "Dzs".

样例输入

3
13
14
16

样例输出

Sproblvem
Dzs
Sproblvem


#include<stdio.h>
int main(){
    int c,n;
    scanf("%d",&c);
    while(c--){
        scanf("%d",&n);
        if(n%7==0||n%7==1)
        printf("Dzs\n");
        else
        printf("Sproblvem\n");
	}
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值