Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef long long ll;
- struct tt{
- ll n;
- bool log;
- };
- int main()
- {
- ll n, m, a[10], sum = 0, mx;
- cin >> n >> m;
- tt b[90010];
- for (int i = 0; i < 90010; i++){
- b[i].log = 0;
- b[i].n = n;
- }
- for (int i = 0; i < m; i++){
- cin >> a[i];
- if (a[i] > mx || i == 0)
- mx = a[i];
- }
- b[0].n = n;
- b[0].log = 1;
- for (int i = 0; i < 90010; i++){
- if (b[i].log && b[i].n)
- for (int j = 0; j < m; j++){
- b[i + a[j]].log = 1;
- b[i + a[j]].n = b[i].n - 1;
- }
- }
- bool bol1 = 0, bol2 = 0;
- for (int i = 0; i < 90010; i++){
- if (b[i].n == 0 && i % 9 != 0)
- bol1 = 1;
- if (b[i].n == 0 && i % 9 == 0)
- bol2 = 1;
- }
- if (m % 2 == 0)
- if (bol2)
- cout << "Gena";
- else
- cout << "Petya";
- else
- if (bol1)
- cout << "Petya";
- else
- cout << "Gena";
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement