http://noi.openjudge.cn/ch0107/07/
思路:水题,逐个匹配即可
有没有大佬讲讲c++入门到什么程度可以去刷LeetCode呀
1 #include <iostream> 2 #include <iomanip> 3 #include <iostream> 4 #include <cmath> 5 #include <string.h> 6 #include <stdio.h> 7 using namespace std; 8 9 int main() 10 { 11 char str[256]; 12 char str2[256] = {}; 13 cin>>str; 14 int maxlen = strlen(str); 15 // cout<<maxlen; 16 for(int i=0;i<maxlen;i++) 17 { 18 if(str[i] == 'A') 19 str2[i] = 'T'; 20 else if(str[i] == 'T') 21 str2[i] = 'A'; 22 else if (str[i] == 'G') 23 str2[i] = 'C'; 24 else if(str[i] == 'C') 25 str2[i] = 'G'; 26 } 27 cout<<str2<<endl; 28 }