From a0a07a438b6804fdca0e18b2d626ceedb982611c Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Fri, 24 Jun 2022 18:33:35 +0200 Subject: Solved 4 problems on codechef long challenge --- codechef/ComplementaryStrandInDna/inp | 0 codechef/ComplementaryStrandInDna/main | Bin 0 -> 23496 bytes codechef/ComplementaryStrandInDna/main.cpp | 31 +++++++++++++++++++++ codechef/ComplementaryStrandInDna/main_input0.txt | 9 ++++++ codechef/ComplementaryStrandInDna/main_output0.txt | 4 +++ 5 files changed, 44 insertions(+) create mode 100644 codechef/ComplementaryStrandInDna/inp create mode 100755 codechef/ComplementaryStrandInDna/main create mode 100644 codechef/ComplementaryStrandInDna/main.cpp create mode 100644 codechef/ComplementaryStrandInDna/main_input0.txt create mode 100644 codechef/ComplementaryStrandInDna/main_output0.txt (limited to 'codechef/ComplementaryStrandInDna') diff --git a/codechef/ComplementaryStrandInDna/inp b/codechef/ComplementaryStrandInDna/inp new file mode 100644 index 0000000..e69de29 diff --git a/codechef/ComplementaryStrandInDna/main b/codechef/ComplementaryStrandInDna/main new file mode 100755 index 0000000..11c95ec Binary files /dev/null and b/codechef/ComplementaryStrandInDna/main differ diff --git a/codechef/ComplementaryStrandInDna/main.cpp b/codechef/ComplementaryStrandInDna/main.cpp new file mode 100644 index 0000000..d6c5804 --- /dev/null +++ b/codechef/ComplementaryStrandInDna/main.cpp @@ -0,0 +1,31 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + int l; + cin >> l; + string s; + cin >> s; + for(int i = 0; i < s.size(); i++) { + if(s[i] == 'A') { + s[i] = 'T'; + } + else if(s[i] == 'T') { + s[i] = 'A'; + } + else if(s[i] == 'C') { + s[i] = 'G'; + } + else if(s[i] == 'G') { + s[i] = 'C'; + } + } + cout << s << endl; + } +} diff --git a/codechef/ComplementaryStrandInDna/main_input0.txt b/codechef/ComplementaryStrandInDna/main_input0.txt new file mode 100644 index 0000000..c5bd48c --- /dev/null +++ b/codechef/ComplementaryStrandInDna/main_input0.txt @@ -0,0 +1,9 @@ +4 +4 +ATCG +4 +GTCC +5 +AAAAA +3 +TAC diff --git a/codechef/ComplementaryStrandInDna/main_output0.txt b/codechef/ComplementaryStrandInDna/main_output0.txt new file mode 100644 index 0000000..fd0e483 --- /dev/null +++ b/codechef/ComplementaryStrandInDna/main_output0.txt @@ -0,0 +1,4 @@ +TAGC +CAGG +TTTTT +ATG -- cgit v1.2.3