-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBA_L
50 lines (42 loc) · 1.12 KB
/
BA_L
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
using System;
namespace zadL
{
class Program
{
static char LastSymbol(string pattern)
{
char sym = pattern[pattern.Length - 1];
return sym;
}
static string Prefix(string pattern)
{
string pref = "";
for(int i=0; i<pattern.Length-1;i++)
{
pref += pattern[i];
}
return pref;
}
static int SymbolToNumber(char symbol)
{
if (symbol == 'T') return 3;
else if (symbol == 'G') return 2;
else if (symbol == 'C') return 1;
else return 0; // =='A'
}
static int PatternToNumber(string pattern)
{
int cnt = 0;
if (pattern.Length == 0) return 0;
char symbol;
string prefix;
symbol = LastSymbol(pattern);
prefix = Prefix(pattern);
return 4 * PatternToNumber(prefix) + SymbolToNumber(symbol);
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}