<div class="row">
<div class="column">
<h4 class="ui top attached block header">样例</h4>
<div class="ui bottom attached segment font-content" id="problem_example"><div style="position: relative; overflow: hidden; transform: translate3d(0, 0, 0); "><p><strong>样例输入</strong></p>
复制4 5
2
3
2
1
样例输出
复制1
BeiJu
1
BeiJu
<div class="row" id="hide-buttons">
<div class="column">
<h4 class="ui block header" id="show_tag_title_div" style="margin-bottom: 0; margin-left: -1px; margin-right: -1px; "><a href="#" id="show_tag_button" style="color: #000; ">显示分类标签</a></h4>
<div class="ui bottom attached segment" style="display: none; " id="show_tag_div">
<a href="/problems/tag/198" class="ui medium violet label">
CIE三级2023.09
</a>
<a href="/problems/tag/157" class="ui medium purple label">
电子学会三级
</a>
</div>
</div>
</div>
<script>
$(function () {
$('#show_tag_button').click(function (e) {
e.preventDefault();
$('#show_tag_title_div').addClass('top');
$('#show_tag_title_div').addClass('top attached');
$('#show_tag_title_div').text('分类标签');
$('#show_tag_div').css('display', '');
})
});
</script>
<div class="row" id="hide-buttons">
<div class="column">
<div class="column">
<h4 class="ui top attached block header">粘贴代码时选择对应的语言</h4>
</div>
<form action="/problem/4300/submit?contest_id=" method="post" onsubmit="return submit_code()" id="submit_code" enctype="multipart/form-data">
<input id="debug_flag" name="debug_flag" type="hidden">
<input name="language" type="hidden" id="form">
<input name="code" type="hidden">
<div class="ui grid">
<div class="four wide column" style="margin-right: -25px; ">
<div class="ui attached vertical fluid pointing menu" id="languages-menu" style="height: 370px; overflow-y: scroll; overflow-x: hidden; ">
<a style="border-radius: 0; " class="item" data-value="cpp14" data-mode="cpp">
C++ 14
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 10.2.0</div>
</a>
<a style="border-radius: 0; " class="item" data-value="cpp" data-mode="cpp">
C++
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 10.2.0</div>
</a>
<a style="border-radius: 0; " class="item" data-value="python3" data-mode="python">
Python 3
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">PyPy 7.3.4 (Python 3.7.10)</div>
</a>
<a style="border-radius: 0; " class="item" data-value="c" data-mode="c">
C
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">Clang 12.0.1</div>
</a>
<a style="border-radius: 0; " class="item" data-value="cpp11" data-mode="cpp">
C++ 11
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 10.2.0</div>
</a>
<a style="border-radius: 0; " class="item active" data-value="cpp17" data-mode="cpp">
C++ 17
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 10.2.0</div>
</a>
<a style="border-radius: 0; " class="item" data-value="cpp-noilinux" data-mode="cpp">
C++ (NOI)
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 4.8.4 (NOILinux 1.4.1)</div>
</a>
<a style="border-radius: 0; " class="item" data-value="cpp11-noilinux" data-mode="cpp">
C++ 11 (NOI)
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 4.8.4 (NOILinux 1.4.1)</div>
</a>
<a style="border-radius: 0; " class="item" data-value="cpp11-clang" data-mode="cpp">
C++ 11 (Clang)
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">Clang 12.0.1</div>
</a>
<a style="border-radius: 0; " class="item" data-value="cpp17-clang" data-mode="cpp">
C++ 17 (Clang)
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">Clang 12.0.1</div>
</a>
<a style="border-radius: 0; " class="item" data-value="c-noilinux" data-mode="c">
C (NOI)
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GCC 4.8.4 (NOILinux 1.4.1)</div>
</a>
<a style="border-radius: 0; " class="item" data-value="csharp" data-mode="csharp">
C#
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">Mono 6.12.0.122</div>
</a>
<a style="border-radius: 0; " class="item" data-value="java" data-mode="java">
Java
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">OpenJDK 11.0.11</div>
</a>
<a style="border-radius: 0; " class="item" data-value="pascal" data-mode="pascal">
Pascal
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">Free Pascal 3.0.4</div>
</a>
<a style="border-radius: 0; " class="item" data-value="nodejs" data-mode="javascript">
Node.js
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">16.1.0</div>
</a>
<a style="border-radius: 0; " class="item" data-value="ruby" data-mode="ruby">
Ruby
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">2.7.0</div>
</a>
<a style="border-radius: 0; " class="item" data-value="haskell" data-mode="haskell">
Haskell
<div class="ui right floated" style="opacity: 0.4; margin-top: 8px; font-size: 0.7em; ">GHC 8.10.4</div>
</a>
</div>
</div>
<div class="twelve wide stretched column" style="position: relative; padding-left: 0; margin-left: calc(-1rem - 1px); width: calc(75% + 1rem + 13px) !important; ">
<div id="editor" style="position: absolute; width: 100%; height: calc(100% - 28px); border: 1px solid #D4D4D5; overflow: hidden; " class="editor showUnused" contenteditable="" data-keybinding-context="1" data-mode-id="cpp"><div class="monaco-editor no-user-select vs" data-uri="inmemory://model/1" style="width: 265px; height: 368px;"><div data-mprt="3" class="overflow-guard" style="width: 265px; height: 368px;"><div class="margin" role="presentation" aria-hidden="true" style="position: absolute; will-change: transform; top: 0px; height: 368px; width: 60px;"><div class="glyph-margin" style="left: 0px; width: 0px; height: 368px;"></div><div class="margin-view-zones" role="presentation" aria-hidden="true" style="position: absolute;"></div><div class="margin-view-overlays" role="presentation" aria-hidden="true" style="position: absolute; width: 60px; font-family: "Fira Mono", "Bitstream Vera Sans Mono", Menlo, Consolas, "Lucida Console", "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", monospace; font-weight: normal; font-size: 14px; line-height: 22px; letter-spacing: 0px; height: 368px;"><div style="position:absolute;top:0px;width:100%;height:22px;"><div class="current-line" style="width:60px; height:22px;"></div><div class="line-numbers" style="left:0px;width:34px;">1</div></div></div></div><div class="monaco-scrollable-element editor-scrollable vs" role="presentation" data-mprt="5" style="position: absolute; overflow: hidden; left: 60px; width: 205px; height: 368px;"><div class="lines-content monaco-editor-background" style="position: absolute; overflow: hidden; width: 1e+06px; height: 1e+06px; will-change: transform; top: 0px; left: 0px;"><div class="view-overlays" role="presentation" aria-hidden="true" style="position: absolute; height: 0px; width: 184px;"><div style="position:absolute;top:0px;width:100%;height:22px;"><div class="current-line" style="width:184px; height:22px;"></div></div></div><div role="presentation" aria-hidden="true" class="view-rulers"></div><div class="view-zones" role="presentation" aria-hidden="true" style="position: absolute;"></div><div class="view-lines" role="presentation" aria-hidden="true" data-mprt="7" style="position: absolute; font-family: "Fira Mono", "Bitstream Vera Sans Mono", Menlo, Consolas, "Lucida Console", "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", monospace; font-weight: normal; font-size: 14px; line-height: 22px; letter-spacing: 0px; width: 184px; height: 368px;"><div style="top:0px;height:22px;" class="view-line"><span><span> </span></span></div></div><div data-mprt="1" class="contentWidgets" style="position: absolute; top: 0px;"><div class="lightbulb-glyph" title="Show Fixes (Ctrl+.)" widgetid="LightBulbWidget" style="position: absolute; visibility: hidden; max-width: 743px;"></div></div><div role="presentation" aria-hidden="true" class="cursors-layer cursor-line-style cursor-solid"><div class="cursor " style="height: 22px; top: 0px; left: 0px; font-family: "Fira Mono", "Bitstream Vera Sans Mono", Menlo, Consolas, "Lucida Console", "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", monospace; font-weight: normal; font-size: 14px; line-height: 22px; letter-spacing: 0px; display: block; visibility: hidden; width: 1px;"></div></div></div><div role="presentation" aria-hidden="true" class="invisible scrollbar horizontal" style="position: absolute; width: 184px; height: 10px; left: 0px; bottom: 0px;"><div class="slider" style="position: absolute; top: 0px; left: 0px; height: 10px; will-change: transform; width: 184px;"></div></div><canvas class="decorationsOverviewRuler" aria-hidden="true" width="0" height="368" style="position: absolute; will-change: transform; top: 0px; right: 0px; width: 0px; height: 368px;"></canvas><div role="presentation" aria-hidden="true" class="invisible scrollbar vertical" style="position: absolute; width: 0px; height: 368px; right: 0px; top: 0px;"><div class="slider" style="position: absolute; top: 0px; left: 0px; width: 0px; will-change: transform; height: 368px;"></div></div></div><div role="presentation" aria-hidden="true" style="width: 244px;"></div><textarea data-mprt="6" class="inputarea" wrap="off" autocorrect="off" autocapitalize="off" autocomplete="off" spellcheck="false" aria-label="Editor content;Press Alt+F1 for Accessibility Options." role="textbox" aria-multiline="true" aria-haspopup="false" aria-autocomplete="both" style="font-size: 1px; line-height: 22px; top: 0px; left: 60px; width: 1px; height: 1px;"></textarea><div style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px;"></div><div data-mprt="4" class="overlayWidgets" style="width: 265px;"><div class="accessibilityHelpWidget" role="dialog" aria-hidden="true" widgetid="editor.contrib.accessibilityHelpWidget" style="display: none; position: absolute;"><div role="document"></div></div></div><div data-mprt="8" class="minimap slider-mouseover" role="presentation" aria-hidden="true" style="position: absolute; left: 244px; width: 21px; height: 368px;"><div class="minimap-shadow-hidden" style="height: 368px;"></div><canvas width="21" height="368" style="position: absolute; left: 0px; width: 21px; height: 368px;"></canvas><canvas class="minimap-decorations-layer" width="21" height="368" style="position: absolute; left: 0px; width: 21px; height: 368px;"></canvas><div class="minimap-slider" style="position: absolute; will-change: transform; width: 21px; height: 33px;"><div class="minimap-slider-horizontal" style="position: absolute; left: 0px; width: 21px; top: 0px; height: 33px;"></div></div></div></div><div data-mprt="2" class="overflowingContentWidgets"><div class="editor-widget suggest-widget" widgetid="editor.widget.suggestWidget" style="position: absolute; visibility: inherit; max-width: 150px; top: 0px; left: -41px;" monaco-visible-content-widget="true"><div class="message" aria-hidden="true" style="display: none; background-color: rgb(243, 243, 243); border-color: rgb(200, 200, 200);"></div><div class="tree" aria-hidden="true" style="display: none; background-color: rgb(243, 243, 243); border-color: rgb(200, 200, 200);"><div class="monaco-list list_id_1" tabindex="0" role="tree"><div class="monaco-scrollable-element " role="presentation" style="position: relative; overflow: hidden;"><div class="monaco-list-rows" style="overflow: hidden;"></div><div role="presentation" aria-hidden="true" class="invisible scrollbar horizontal" style="position: absolute;"><div class="slider" style="position: absolute; top: 0px; left: 0px; height: 10px; will-change: transform;"></div></div><div role="presentation" aria-hidden="true" class="invisible scrollbar vertical" style="position: absolute;"><div class="slider" style="position: absolute; top: 0px; left: 0px; width: 10px; will-change: transform;"></div></div></div><style type="text/css" media="screen">.monaco-list.list_id_1:focus .monaco-list-row.focused { background-color: #d6ebff; }
.monaco-list.list_id_1:focus .monaco-list-row.focused:hover { background-color: #d6ebff; } .monaco-list.list_id_1:focus .monaco-list-row.selected { background-color: #0069d1; } .monaco-list.list_id_1:focus .monaco-list-row.selected:hover { background-color: #0069d1; } .monaco-list.list_id_1:focus .monaco-list-row.selected { color: #ffffff; }
.monaco-drag-image,
.monaco-list.list_id_1:focus .monaco-list-row.selected.focused { background-color: #0074e8; }
.monaco-drag-image,
.monaco-list.list_id_1:focus .monaco-list-row.selected.focused { color: #ffffff; }
.monaco-list.list_id_1 .monaco-list-row.focused { background-color: #d6ebff; } .monaco-list.list_id_1 .monaco-list-row.focused:hover { background-color: #d6ebff; } .monaco-list.list_id_1 .monaco-list-row.selected { background-color: #e4e6f1; } .monaco-list.list_id_1 .monaco-list-row.selected:hover { background-color: #e4e6f1; } .monaco-list.list_id_1:not(.drop-target) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: #f0f0f0; }
.monaco-list.list_id_1.drop-target,
.monaco-list.list_id_1 .monaco-list-row.drop-target { background-color: #d6ebff !important; color: inherit !important; }
.monaco-list-type-filter { background-color: #efc1ad } .monaco-list-type-filter { border: 1px solid rgba(0, 0, 0, 0); } .monaco-list-type-filter.no-matches { border: 1px solid #be1100; } .monaco-list-type-filter { box-shadow: 1px 1px 1px #a8a8a8; }
<div class="ui right aligned vertical segment" style="padding-bottom: 0; ">
<button class="ui orange labeled icon button" id="debug" name="debug" onclick="run_code()"><i class="ui keyboard outline icon"></i>测试代码</button>
<button type="submit" id="submit" name="submit" class="ui labeled green icon button" onclick="set_ok()"><i class="ui paper plane icon"></i>提交答案</button>
</div>
</form>
</div>
</div>
<div class="row" style="display:none" id="run_code">
<div class="column">
<h4 class="ui top attached block header">
代码运行状态:<span id="judge_result_span"> </span> <i class="close icon" onclick="hide_runcode()"></i>
</h4>
<div class="ui bottom attached segment font-content">
<h5> 输入: </h5>
<div class="ui form">
<div class="field">
<textarea class="run_code_stdin" id="run_code_stdin" name="code_stdin" cols="50" rows="1" style="border-radius: 5px; resize: none; font-size: 16px; width: 100%; overflow: hidden; margin-top: 2px; margin-bottom: 1px; min-height: 20px; "> </textarea>
</div>
</div>
<h5> 输出: </h5>
<div class="ui form">
<div class="field">
<textarea readonly="readonly" class="run_code_stdout" id="run_code_stdout" name="code_stdout" cols="50" rows="1" style="border-radius: 5px; resize: none; font-size: 16px; width: 100%; overflow: hidden; margin-top: 2px; margin-bottom: 1px; min-height: 20px; "> </textarea>
</div>
</div>
<br>
<p id="cpu_time_span"> </p>
</div>
</div>
</div>
)/g, function(match, p1, p2) { if (p1) { return "main.cpp"; } else if (p2) { return '\n'; } }); console.log(code_result.value); } else { code_result.value = data.output; $("#cpu_time_span").text('运行时间:' + data.cpu_time + 'ms') } code_result.style.height = 'auto'; code_result.style.height= (code_result.scrollHeight )+ 'px'; //设置输出框跟输出一样大 debug_button.disabled = false; } }); } } function set_ok() { ok = 0; setTimeout(function() { submit.disabled = false; }, 5000); } var lastSubmitted = ''; function submit_code() { if (ok) return false; if (!$('#submit_code input[name=answer]').val().trim() && !editor.getValue().trim()) return false; ok = 1; var submit_button = document.getElementById("submit"); submit_button.disabled = true; $('#submit_code input[name=language]').val($('#languages-menu .item.active').data('value')); lastSubmitted = editor.getValue(); $('#submit_code input[name=code]').val(editor.getValue()); return true; } $('#languages-menu')[0].scrollTop = $('#languages-menu .active')[0].offsetTop - $('#languages-menu')[0].firstElementChild.offsetTop; $(function () { $('#languages-menu .item').click(function() { $(this) .addClass('active') .closest('.ui.menu') .find('.item') .not($(this)) .removeClass('active') ; monaco.editor.setModelLanguage(editor.getModel(), $(this).data('mode')); }); }); $(document).ready(function (){ $("#problem_example pre").prepend("复制"); $(".copy-button").click(function() { var element = $(this).siblings("code"); var text = $(element).text(); var $temp = $(""); $("body").append($temp); $temp.val(text).select(); document.execCommand("copy"); $temp.remove(); $(this).text("复制成功"); var e = this; setTimeout(function() { $(e).text("复制"); }, 500); }); }); $('.run_code_stdin').on('input', function(){ //时刻变化输入框 this.style.height = 'auto'; this.style.height = this.scrollHeight + "px"; }); $('.run_code_stdout').on('output', function(){ //时刻变化输出框 this.style.height = 'auto'; this.style.height = (this.scrollHeight) + "px"; });