QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#532867#5660. Simplified Genome Translationttbchimbu999#AC ✓1ms3652kbC++141.4kb2024-08-25 13:43:232024-08-25 13:43:23

Judging History

你现在查看的是最新测评结果

  • [2024-08-25 13:43:23]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3652kb
  • [2024-08-25 13:43:23]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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