G - Game of Nuts URAL - 2068 (博弈)

版权声明: https://blog.csdn.net/nucleare/article/details/89844418

G - Game of Nuts

 URAL - 2068 

The war for Westeros is still in process, manpower and supplies are coming to an end and the winter is as near as never before. The game of thrones is unpredictable so Daenerys and Stannis decided to determine the true ruler of Seven Kingdoms playing more predictable and shorter game. For example, the game of nuts is the ideal candidate.

Rules of this game are quite simple. Players are given n heaps of nuts. There is an odd number of nuts in each heap. Players alternate turns. In each turn player chooses an arbitrary heap and divides it into three non-empty heaps so as there is again an odd number of nuts in each heap. The player who cannot make a move loses.

Daenerys has dragons so she moves first. Your task is to determine the winner assuming both Daenerys and Stannis play optimally. Please, do it and stop the war for Westeros!

Input

In the first line there is an odd integer n (1 ≤ n ≤ 777).

In the second line there are n integers separated by spaces. These are the amounts of nuts in each heap at the beginning of the game. It is guaranteed that each heap contains not less than one and not more than 54321 nuts and this amount is an odd number.

Output

Output "Daenerys" (without quotes) in case of Daenerys’ win. Otherwise output "Stannis".

Example

input output
1
3
Daenerys
3
1 1 1
Stannis
5
777 313 465 99 1
Daenerys
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
#include <functional>
#include <cstdio>
#include <cmath>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
#define ll long long
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int M = 1e7 + 7;
const int N = 1e6 + 7;
int main() {
	
	int n;
	scanf ("%d", &n);
	int x, ans = 0;
	for (int i = 1; i <= n; ++i) {
		scanf ("%d", &x);
		ans ^= ((x / 2) & 1);
	}
	if (ans) puts("Daenerys");
	else puts("Stannis");
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/nucleare/article/details/89844418