-
Notifications
You must be signed in to change notification settings - Fork 0
/
contest-10166.cpp
76 lines (66 loc) · 1.25 KB
/
contest-10166.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n, keyvan = 0, nezam = 0, shir = 0;
string key;
cin >> n >> key;
for (int i = 0; i < n; ++i)
{
int temp = key[i] - '0';
if ((i % 3) + 1 == temp)
{
++nezam;
}
switch (i % 4)
{
case 0:
case 2:
if (temp == 2)
++shir;
break;
case 1:
if (temp == 1)
++shir;
break;
case 3:
if (temp == 3)
++shir;
break;
}
switch(i % 6)
{
case 0:
case 1:
if (temp == 3)
++keyvan;
break;
case 2:
case 3:
if (temp == 1)
++keyvan;
break;
case 4:
case 5:
if (temp == 2)
++keyvan;
break;
}
}
int maxi = max(keyvan, max(shir, nezam));
cout << maxi << endl;
if (maxi == keyvan)
{
cout << "keyvoon" << endl;
}
if (maxi == nezam)
{
cout << "nezam" << endl;
}
if (maxi == shir)
{
cout << "shir farhad" << endl;
}
return 0;
}