-
Notifications
You must be signed in to change notification settings - Fork 0
/
mhg1.cpp
67 lines (62 loc) · 1.02 KB
/
mhg1.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
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int n1, n2, n3,max=0;
char v[50][1000] = { 0 }; // 초기화~
string DNA;
cin >> n1;
for (int i = 0; i < n1; i++) {
cin >> n2 >> n3;
int res = 0;
char C[1001] = { 0 };
for (int j = 0; j < n2; j++) {
cin >>DNA; // ???
for (int k = 0; k < n3; k++)
{
v[j][k]=DNA[k]; // ???
}
}
for (int j = 0; j < n3; j++) {
int B[5] = { 0 };
for (int k = 0; k < n2; k++)
{
if (v[k][j] == 'A')
B[0]++;
else if (v[k][j] == 'C')
B[1]++;
else if (v[k][j] == 'G')
B[2]++;
else
B[3]++;
}
max = B[0];
C[j] = 'A';
if (B[1] > max)
{
max = B[1];
C[j] = 'C';
}
if (B[2] > max)
{
max = B[2];
C[j] = 'G';
}
if (B[3] > max)
{
max = B[3];
C[j] = 'T';
}
res += (n2 - max);
}
for (int i = 0; i < n3; i++)
{
cout << C[i];
}
cout << endl;
cout << res << endl;
}
}