-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDNA.cpp
More file actions
58 lines (51 loc) · 917 Bytes
/
Copy pathDNA.cpp
File metadata and controls
58 lines (51 loc) · 917 Bytes
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
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
class DNAString {
public:
int minChanges(int maxPeriod, vector <string> dna)
{
int len=dna.size();
int changes=INT_MAX;
for(int i=maxPeriod;i>=1;i--)
{
int count=0;
for(int k=1;k<=len/i;k++)
{
cout<<"das";
for(int j=0;j<maxPeriod;j++)
{
cout<<i<<" "<<k<<" "<<j<<endl;
if(dna[j]!=dna[j+i*k])
count++;
}
}
cout<<i<<" "<<count<<endl;
changes=min(changes, count);
}
return changes;
}
};
int main()
{
DNAString dna = new DNAString();
dna.minChanges("ATAGATA");
system("pause");
}