Untitled
Guest 1,093 3rd Apr, 2023
#include <iostream>
#include <fstream>
using namespace std;
bool czy_pot_2(int a)
{
for(int i=1;i<=2048;i*=2)
{
if(i==a) return true;
else if(i>a) return false;
}
}
bool podzial(string s)
{
string temp;
for(int i=0;i<s.size();i+=2)
{
if(s[i]=='B' && s[i+1]=='D') temp.push_back('A');
else if(s[i]=='C' && s[i+1]=='A') temp.push_back('B');
else if(s[i]=='C' && s[i+1]=='D') temp.push_back('B');
else if(s[i]=='D' && s[i+1]=='D') temp.push_back('C');
else if(s[i]=='B' && s[i+1]=='C') temp.push_back('D');
else return true;
}
if(temp.size()==1) return false;
return podzial(temp);
}
int main()
{
string s;
int suma=0;
ifstream plik("genetyka_1.txt");
{
while(plik>>s)
{
suma+=podzial(s);//cout<<s<<" "<<suma<<"\n";
}
}
cout<<suma;
return 0;
}
To share this paste please copy this url and send to your friends
RAW Paste Data