修改提交代码页面的js逻辑,判断语言 更加宽泛, 添加 对于 __int64和%I64d错误的提醒

This commit is contained in:
sxw@401 2015-09-15 10:19:44 +08:00
parent 856ad6d378
commit de14553e43

View File

@ -120,10 +120,7 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"],
if (code.indexOf("using namespace std") > -1) { if (code.indexOf("using namespace std") > -1) {
return "2"; return "2";
} }
//c
if (code.indexOf("printf") > -1) {
return "1";
}
//java //java
if (code.indexOf("public class Main")) { if (code.indexOf("public class Main")) {
return "3"; return "3";
@ -146,6 +143,19 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"],
} }
} }
if (language < 3) {
if (code.indexOf("__int64") > -1) {
if (!confirm("您是否在尝试使用'__int64'类型? 这不是 c/c++ 标准并将引发编译错误可以使用 'long long' 代替(详见关于->帮助),是否仍然提交?")) {
return;
}
}
if (code.indexOf("__int64") > -1) {
if (!confirm("您是否在尝试用'%I64d'做long long类型的I/O? 这不是 c/c++ 标准并将引发编译错误可以使用 '%lld' 代替(详见关于->帮助),是否仍然提交?")) {
return;
}
}
}
if (location.href.indexOf("contest") > -1) { if (location.href.indexOf("contest") > -1) {
var problemId = location.pathname.split("/")[4]; var problemId = location.pathname.split("/")[4];
var contestId = location.pathname.split("/")[2]; var contestId = location.pathname.split("/")[2];