QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133696 | #5660. Simplified Genome Translation | wytang1010 | AC ✓ | 2ms | 3940kb | C++14 | 2.1kb | 2023-08-02 13:01:59 | 2023-08-02 13:02:03 |
Judging History
answer
/*
* author: weiyutang
*/
#include <bits/stdc++.h>
using namespace std;
/* ===== BEGIN USER CODE ===== */
#define ll long long
#define ld long double
#define f first
#define s second
const int MOD = 1e9 + 7;
const vector<vector<int>> dirs4 {{0,1}, {1,0}, {-1,0}, {0,-1}};
const vector<vector<int>> dirs8 {{0,1}, {1,0}, {-1,0}, {0,-1}, {-1,-1}, {-1,1}, {1,-1}, {1,1}};
unordered_map<string, int> mp;
void solve() {
string st;
cin >> st;
int n = st.size();
string ans = "";
for (int i = 0; i < n; i += 3) {
string nucs = string {st[i], st[i+1], st[i+2]};
if (mp[nucs] == 0) break;
ans += mp[nucs];
}
cout << ans << endl;
}
void set_map() {
mp["UUU"] = 'F';
mp["UUC"] = 'F';
mp["UUA"] = 'L';
mp["UUG"] = 'L';
mp["CUU"] = 'L';
mp["CUC"] = 'L';
mp["CUA"] = 'L';
mp["CUG"] = 'L';
mp["AUU"] = 'I';
mp["AUC"] = 'I';
mp["AUA"] = 'I';
mp["AUG"] = 'M';
mp["GUU"] = 'V';
mp["GUC"] = 'V';
mp["GUA"] = 'V';
mp["GUG"] = 'V';
mp["UCU"] = 'S';
mp["UCC"] = 'S';
mp["UCA"] = 'S';
mp["UCG"] = 'S';
mp["AGU"] = 'S';
mp["AGC"] = 'S';
mp["CCU"] = 'P';
mp["CCC"] = 'P';
mp["CCA"] = 'P';
mp["CCG"] = 'P';
mp["ACU"] = 'T';
mp["ACC"] = 'T';
mp["ACA"] = 'T';
mp["ACG"] = 'T';
mp["GCU"] = 'A';
mp["GCC"] = 'A';
mp["GCA"] = 'A';
mp["GCG"] = 'A';
mp["UAU"] = 'Y';
mp["UAC"] = 'Y';
mp["CAU"] = 'H';
mp["CAC"] = 'H';
mp["CAA"] = 'Q';
mp["CAG"] = 'Q';
mp["AAU"] = 'N';
mp["AAC"] = 'N';
mp["AAA"] = 'K';
mp["AAG"] = 'K';
mp["GAU"] = 'D';
mp["GAC"] = 'D';
mp["GAA"] = 'E';
mp["GAG"] = 'E';
mp["UGU"] = 'C';
mp["UGC"] = 'C';
mp["UGG"] = 'W';
mp["CGU"] = 'R';
mp["CGC"] = 'R';
mp["CGA"] = 'R';
mp["CGG"] = 'R';
mp["AGA"] = 'R';
mp["AGG"] = 'R';
mp["GGU"] = 'G';
mp["GGC"] = 'G';
mp["GGA"] = 'G';
mp["GGG"] = 'G';
mp["UAA"] = 0;
mp["UAG"] = 0;
mp["UGA"] = 0;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
srand(chrono::steady_clock::now().time_since_epoch().count());
int t = 1;
cin >> t;
set_map();
while (t--) {
solve();
}
cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3800kb
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: 3744kb
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: 2ms
memory: 3940kb
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