mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
优化丑陋的代码
This commit is contained in:
1 parent
62ac2f52c9
commit
dd1b7c363a
19 files changed
+97
-502
No files matched your search
+2
-2
@@ -3,8 +3,8 @@ function decodeBase64WithUriEncoding(encodedText) {
|
||||
}
|
||||
|
||||
function unescapedString(escapedString) {
|
||||
escapedString += new Array(5 - escapedString.length % 4).join('=');
|
||||
return escapedString.replace(/\-/g, '+').replace(/_/g, '/');
|
||||
escapedString += new Array(5 - (escapedString.length % 4)).join('=');
|
||||
return escapedString.replace(/-/g, '+').replace(/_/g, '/');
|
||||
}
|
||||
|
||||
function decodeJWT(idToken) {
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ function _digit2(number) {
|
||||
}
|
||||
|
||||
function formatSeconds(seconds = 0) {
|
||||
seconds = parseInt(seconds);
|
||||
seconds = parseInt(seconds, 10);
|
||||
return '{0}:{1}:{2}'.format(
|
||||
_digit2(Math.floor(seconds / 3600)),
|
||||
_digit2(Math.floor((seconds % 3600) / 60)),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user