-
Notifications
You must be signed in to change notification settings - Fork 28
/
1425.c
61 lines (51 loc) · 1.17 KB
/
1425.c
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
int main()
{
//M - pedra onde está o presente
//N - total de pedras
int m, n;
while (scanf("%d %d", &n, &m))
{
if (n == 0 && m == 0)
break;
int i = 2;
int a = 1;
int d = 0;
if (m > 34)
{
printf("Let me try!\n");
}
else
{
while (a > 0 && a < n + 1)
{
if (a == m)
{
d++;
break;
}
else if (a < m)
{
if (a + (2 * i - 1) < n + 1)
a += 2 * i - 1;
else
a -= 2 * i - 1;
i++;
}
else
{
if (a - (2 * i - 1) > 0)
a -= 2 * i - 1;
else
a += 2 * i - 1;
i++;
}
}
if (d != 0)
printf("Let me try!\n");
else
printf("Don't make fun of me!\n");
}
}
return 0;
}