QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#219872 | #5660. Simplified Genome Translation | owen0806# | AC ✓ | 1ms | 3644kb | C++14 | 1.5kb | 2023-10-19 19:21:17 | 2023-10-19 19:21:17 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
map<string, char> mp;
void init(){
mp["UUU"] = mp["UUC"] = 'F';
mp["UUA"] = mp["UUG"] = mp["CUU"] = mp["CUC"] = mp["CUA"] = mp["CUG"] = 'L';
mp["AUU"] = mp["AUC"] = mp["AUA"] = 'I';
mp["AUG"] = 'M';
mp["GUU"] = mp["GUC"] = mp["GUA"] = mp["GUG"] = 'V';
mp["UCU"] = mp["UCC"] = mp["UCA"] = mp["UCG"] = mp["AGU"] = mp["AGC"] = 'S';
mp["CCU"] = mp["CCC"] = mp["CCA"] = mp["CCG"] = 'P';
mp["ACU"] = mp["ACC"] = mp["ACA"] = mp["ACG"] = 'T';
mp["GCU"] = mp["GCC"] = mp["GCA"] = mp["GCG"] = 'A';
mp["UAU"] = mp["UAC"] = 'Y';
mp["CAU"] = mp["CAC"] = 'H';
mp["CAA"] = mp["CAG"] = 'Q';
mp["AAU"] = mp["AAC"] = 'N';
mp["AAA"] = mp["AAG"] = 'K';
mp["GAU"] = mp["GAC"] = 'D';
mp["GAA"] = mp["GAG"] = 'E';
mp["UGU"] = mp["UGC"] = 'C';
mp["UGG"] = 'W';
mp["CGU"] = mp["CGC"] = mp["CGA"] = mp["CGG"] = mp["AGA"] = mp["AGG"] = 'R';
mp["GGU"] = mp["GGC"] = mp["GGA"] = mp["GGG"] = 'G';
mp["UAA"] = mp["UAG"] = mp["UGA"] = 'X';
}
void solve(){
string s;
cin >> s;
int len = s.length();
string ans;
for(int i=0; i<len; i+=3){
if(mp[s.substr(i, 3)] == 'X') break;
// cout << s.substr(i, 3) << " ";
ans += mp[s.substr(i, 3)];
}
// cout << endl;
cout << ans << endl;
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int T = 1;
cin >> T;
init();
while(T--){
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
5 UUUUAACACUUUAUCACUUAACACCAC CAAAAUAUGAAAAAU AUGUACUUUGCGUUUCACUAA UUGCACUACUAC UACGUGGGUAUC
output:
F QNMKN MYFAFH LHYY YVGI
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
50 GGUCAGAGGGAGGGCCUAUUGAUACGUAGUGGACUAUCAUGUUCGUGAGCAGCAUGCAGAUUACCCGUUCGGCGAGGGAGAGCCCGCUCCGAAAUGUUUAGGGAGAUAGCGGGCCACAUAGUCGCUUGAGUGCAUACUGCGUACUUUAUGUACAAGUCCCGU AAUGGAUCACUCCUCUAUCAUUUCACUAGGUGUGACACAUGAUAUACUAACGUUCUGAAUUGGCAGUGGGGUAUGAGGCACUGAUUGGUCAUGGGACAGACUUGAGAGGAGUUGUCCUUGCUAAGCCCCGUCCC...
output:
GQREGLLIRSGLSCS NGSLLYHFTRCDT DASYKADEGLMFVLKDTGDYGSDYWQK SRKVLVDRISEPLVVAYLEGTDVDGANIGSKFDGANSSAWT FACST LTNARTSFYALRFKDACKYTCKSLFELFSNRGQFS II VLLRAARISCTFIHCRCSRRGFGPLSPCPPRPLAGVGSMIYNSCYIY TRKLSFS ESDQC QNGIPKKAC PHTRRTLPPSV GI ATSNVCTSFHGAGASGRNVCIRGRDRPL AF NPFQVSRSLQPRS IHPGYLRTGGGFRSILSVTRDG...
result:
ok 50 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
50 GGUCAGAGGGAGGGCCUAUUGAUACGUAGUGGACUAUCAUGUUCGUGAGCAGCAUGCAGAUUACCCGUUCGGCGAGGGAGAGCCCGCUCCGAAAUGUUUAGGGAGAUAGCGGGCCACAUAGUCGCUUGAGUGCAUACUGCGUACUUUAUGUACAAGUCCCGU AAUGGAUCACUCCUCUAUCAUUUCACUAGGUGUGACACAUGAUAUACUAACGUUCUGAAUUGGCAGUGGGGUAUGAGGCACUGAUUGGUCAUGGGACAGACUUGAGAGGAGUUGUCCUUGCUAAGCCCCGUCCC...
output:
GQREGLLIRSGLSCS NGSLLYHFTRCDT DASYKADEGLMFVLKDTGDYGSDYWQK SRKVLVDRISEPLVVAYLEGTDVDGANIGSKFDGANSSAWT FACST LTNARTSFYALRFKDACKYTCKSLFELFSNRGQFS II VLLRAARISCTFIHCRCSRRGFGPLSPCPPRPLAGVGSMIYNSCYIY TRKLSFS ESDQC QNGIPKKAC PHTRRTLPPSV GI ATSNVCTSFHGAGASGRNVCIRGRDRPL AF NPFQVSRSLQPRS IHPGYLRTGGGFRSILSVTRDG...
result:
ok 50 lines