using System using System Collections Generic using System Linq using

 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
// Представим, что здесь хранятся твои карты и очки
List<string> cards = new List<string>();
int playerPoints = 0;
foreach(string s in cards)
{
playerPoints+=CheckCard(s);
}
}
public static int CheckCard(string card)
{
int e = 0;
int playerspoints = 0;
for (int i = 54; i <= 57; i++)
{
if (card[0] == i) { playerspoints += e; return playerspoints; }
e++;
};
switch (card[0])
{
case 'z':
{
playerspoints += 10;
break;
}
case 'v':
{
playerspoints += 2;
break;
}
case 'd':
{
playerspoints += 3;
break;
}
case 'k':
{
playerspoints += 4;
break;
}
case 't':
{
playerspoints += 11;
break;
}
}
return playerspoints;
}
}
}