QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#85720 | #5660. Simplified Genome Translation | zhangboju# | AC ✓ | 2ms | 3564kb | C++14 | 1.4kb | 2023-03-08 08:15:50 | 2023-03-08 08:15:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
template <typename T> inline void read(T &x)
{
x=0;short f=1;char c=getchar();
for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
x*=f;return;
}
map<string,string>mp;
string s;
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"]="STOP";
}
void solve()
{
cin>>s;
for(int i=0;i<s.size();i+=3)
{
string a="";
a+=s[i];
a+=s[i+1];
a+=s[i+2];
if(mp[a]=="STOP") break;
else cout<<mp[a];
}
cout<<"\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
init();
int T;cin>>T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3436kb
input:
5 UUUUAACACUUUAUCACUUAACACCAC CAAAAUAUGAAAAAU AUGUACUUUGCGUUUCACUAA UUGCACUACUAC UACGUGGGUAUC
output:
F QNMKN MYFAFH LHYY YVGI
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3564kb
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: 3396kb
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