-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathH23.cpp
44 lines (42 loc) · 846 Bytes
/
H23.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Author Pulkit Singh
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n;
cin >> n;
int a[n + 1];
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
sort(a, a + n);
int g = 1, ag = 0;
bool alive = 1;
for (int i = 0; i < n; i++)
{
if (g > a[i])
{
alive = 0;
break;
}
else
{
ag += 1;
g += 1;
if (ag % 6 == 0)
g += 1;
}
}
if (alive)
puts("Rick now go and save Carl and Judas");
else
{
puts("Goodbye Rick");
printf("%d\n", ag);
}
}
return 0;
}