QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#532867 | #5660. Simplified Genome Translation | ttbchimbu999# | AC ✓ | 1ms | 3652kb | C++14 | 1.4kb | 2024-08-25 13:43:23 | 2024-08-25 13:43:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const vector<vector<string> > table = {
{"F", "UUU", "UUC"},
{"L", "UUA", "UUG", "CUU", "CUC", "CUA", "CUG"},
{"I", "AUU", "AUC", "AUA"},
{"M", "AUG"},
{"V", "GUU", "GUC", "GUA", "GUG"},
{"S", "UCU", "UCC", "UCA", "UCG", "AGU", "AGC"},
{"P", "CCU", "CCC", "CCA", "CCG"},
{"T", "ACU", "ACC", "ACA", "ACG"},
{"A", "GCU", "GCC", "GCA", "GCG"},
{"Y", "UAU", "UAC"},
{"H", "CAU", "CAC"},
{"Q", "CAA", "CAG"},
{"N", "AAU", "AAC"},
{"K", "AAA", "AAG"},
{"D", "GAU", "GAC"},
{"E", "GAA", "GAG"},
{"C", "UGU", "UGC"},
{"W", "UGG"},
{"R", "CGU", "CGC", "CGA", "CGG", "AGA", "AGG"},
{"G", "GGU", "GGC", "GGA", "GGG"},
{"STOP", "UAA", "UAG", "UGA"},
};
void solve() {
string s;
cin >> s;
for (int i = 0; i < (int)s.size(); i += 3) {
string cur = s.substr(i, 3), ans = "";
for (auto &j : table) {
int sz = j.size();
for (int z = 1; z < sz; ++z) {
if (j[z] == cur) ans = j[0];
}
}
if (ans == "STOP") break;
cout << ans;
}
cout << '\n';
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef LOCAL
// freopen("TEST.inp", "r", stdin);
// freopen("TEST.out", "w", stdout);
#else
// freopen("TEST.inp", "r", stdin);
// freopen("TEST.out", "w", stdout);
#endif
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
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: 3652kb
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: 3648kb
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