-
Notifications
You must be signed in to change notification settings - Fork 0
/
template_javascript_ja.html
126 lines (107 loc) · 4.25 KB
/
template_javascript_ja.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/javascript/javascript.min.js"></script>
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<!-- ↓ 書き換え不可 -->
<script src="onbrowserjudge.js"></script>
<script> OnBrowserJudge.workerFile = "javascript.js" </script>
<!-- ↑ 書き換え不可 -->
<script>
// ↓ 必ず定義
OnBrowserJudge.getProgram = () => editor.getValue()
// ↑ 必ず定義
OnBrowserJudge.dict.ready = "▶実行(Ctrl+Enter)"
OnBrowserJudge.dict.running = "■停止"
OnBrowserJudge.dict.preparation = "準備中"
OnBrowserJudge.dict.case_name = "ケース名"
OnBrowserJudge.dict.status = "結果"
OnBrowserJudge.dict.exec_time = "実行時間"
OnBrowserJudge.dict.copy = "コピー"
OnBrowserJudge.dict.copied = "コピーしました"
OnBrowserJudge.dict.AC = "正解"
OnBrowserJudge.dict.WA = "不正解"
OnBrowserJudge.dict.RE = "エラー"
OnBrowserJudge.dict.TLE = "時間超過"
OnBrowserJudge.dict.WJ = "ジャッジ待ち"
// OnBrowserJudge.timeLimit = 2000
// OnBrowserJudge.process = (program, casename, input) => program
// OnBrowserJudge.assertEqual = (expected, actual) => expected == actual.trimEnd()
// ↓ 正解時に実行する関数
// OnBrowserJudge.congratulations = () => { alert("大正解!") }
</script>
<title>問題名</title>
</head>
<body>
<h1>問題名</h1>
<hr />
<h2>問題文</h2>
<p>ここに問題文を書く。</p>
<h2>制約</h2>
<ul>
<li>記入例:\(1 ≤ n ≤ 10000\)</li>
<li>\(n\) は整数</li>
</ul>
<hr />
<h2>入力</h2>
記入例:入力は以下の形式で標準入力から与えられる。
<div class="io_format">\(n\)</div>
<h2>出力</h2>
<p>出力内容をここに書く。</p>
<hr />
<h2>入力例1</h2>
<pre id="sample1_input" class="sample">123</pre>
<h2>出力例1</h2>
<pre id="sample1_output" class="sample">456</pre>
<p>解説</p>
<hr />
<!-- id が "*_input" and "*_output" の pre 要素が1組以上必要。 -->
<!-- pre.sample には自動的にコピーボタンが付く。 -->
<h2>入力例2</h2>
<pre id="sample2_input" class="sample">123</pre>
<h2>出力例2</h2>
<pre id="sample2_output" class="sample">456</pre>
<hr />
<pre id="testcase1_input" class="testcase">123</pre>
<pre id="testcase1_output" class="testcase">456</pre>
<pre id="testcase2_input" class="testcase">123</pre>
<pre id="testcase2_output" class="testcase">456</pre>
<textarea id="txt-editor">
function main(input) {
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
</textarea>
<p>
<!-- ↓ button#run は必ず用意 -->
<button id="run"></button>
<input type="checkbox" id="autocopy" checked /><label for="autocopy">実行時にプログラムを自動的にコピーしておく</label>
</p>
<p>実行結果:</p>
<!-- ↓ table#result は必ず用意 -->
<table id="result"></table>
<script>
const editor = CodeMirror.fromTextArea(document.getElementById("txt-editor"), {
lineNumbers: true,
mode: "javascript",
indentUnit: 2
})
editor.setOption("extraKeys", {
"Tab": function(cm) {
if (cm.somethingSelected()) cm.indentSelection("add")
else cm.replaceSelection(Array(cm.getOption("indentUnit") + 1).join(" "), "end", "+input")
},
"Shift-Tab": function(cm) {
cm.execCommand("indentLess")
},
"Ctrl-Enter": function(cm) {
OnBrowserJudge.runButtonPressed()
}
})
</script>
</body>
</html>