优化丑陋的代码

This commit is contained in:
undefined committed 2020-06-23 22:40:01 +08:00
1 parent 62ac2f52c9
commit dd1b7c363a
19 files changed
+97 -502

No files matched your search

+2 -2
View File
@@ -6,9 +6,9 @@ function convert(ini) {
const res = { cases: [] };
for (let i = 1; i <= count; i++) {
const [input, output, time, score, memory] = f[i].split('|');
const cur = { input, output, score: parseInt(score) };
const cur = { input, output, score: parseInt(score, 10) };
cur.time = `${time}s`;
if (!Number.isNaN(parseInt(memory))) cur.memory = `${Math.floor(parseInt(memory) / 1024)}m`;
if (!Number.isNaN(parseInt(memory, 10))) cur.memory = `${Math.floor(parseInt(memory, 10) / 1024)}m`;
else cur.memory = '128m';
res.cases.push(cur);
}