1111

wyh15 Minecraft 2024-05-18 17:20:29 2024-05-18 17:20:48 8
<div id="page-header" class="ui fixed borderless menu" style="position: fixed; height: 49px; 
">
    <div class="ui container">
        
        <a class="header item" href="/"><span style="font-family: 'Exo 2'; font-size: 1.5em; font-weight: 600; ">Liuser's OJ</span></a>
        
        <a class="item" href="/"><i class="home icon"></i>首页</a>
        <a class="item active" href="/problems"><i class="book icon"></i>题库</a>
        <a class="item" href="/homeworks"><i class="list alternate icon"></i>作业</a>  
        <a class="item" href="/trainings"><i class="pencil icon"></i>训练 </a>
        <a class="item" href="/contests"><i class="calendar icon"></i>比赛</a>
        <a class="item" href="/submissions"><i class="hourglass icon"></i>评测</a> 
        <a class="item" href="/discussion/global"><i class="comments icon"></i> 讨论</a>
        <div class="ui simple dropdown item" style="color: inherit; ">
          <i class="bar icon"></i>更多
          <i class="dropdown icon"></i>
          <div class="menu">
            <a class="item" href="/ranklist"><i class="users icon"></i>排名</a>
              
            
            <!-- <a class="item" href="/teams"><i class="code icon"></i>IDE</a> -->
            <!-- <a class="item" href="/chat"><i class="comment icon"></i>吐槽</a>  -->
            <a class="item" id="theme-mode" onclick="setDark()"><i class="moon icon"></i>暗色</a>
            <script>
              localStorage.getItem("dark-mode") && setDark();

              function setLight() {
                $("#dark-mode").remove();
                $("#theme-mode")
                  .html('<i class="moon icon"></i>暗色')
                  .attr("onclick", "setDark()");
                localStorage.removeItem("dark-mode");
              }

              function setDark() {
                $("<link>").attr({
                  rel: "stylesheet",
                  type: "text/css",
                  href: "/self/dark.css", 
                  id: "dark-mode",
                }).appendTo("head");
                $("#theme-mode")
                  .html('<i class="sun icon"></i>亮色')
                  .attr("onclick", "setLight()");
                localStorage.setItem("dark-mode", "1");
              }
            </script>
          </div>
        </div>
        
        
        
        
        <div class="right menu">

          
          <a class="item" id="usernotification" href="/user/1759/notification/at"><i class="large alarm outline icon"></i>
              
          </a>
          <a href="/user/1759" style="color: inherit; ">
          </a><div class="ui simple dropdown item"><a href="/user/1759" style="color: inherit; ">
            <p style="margin-bottom: -5px; ">
            
              <img style="border-radius: 50%; vertical-align: middle; margin-bottom: 2px; margin-right: 2px; " src="/usericon/1759.png" width="27" height="27">
            
            <strong> wyh15</strong>  
           
            <i class="dropdown icon"></i>
            </p>
            </a><div class="menu"><a href="/user/1759" style="color: inherit; ">
              </a><a class="item" href="/user/1759"><i class="user icon"></i>我的资料</a>
              <a class="item" href="/submissions?submitter=wyh15"><i class="hourglass icon"></i>我的提交</a>
              <a class="item" href="/problems/user/1759"><i class="book icon"></i>我的题目</a> 
              <a class="item" href="/lists"><i class="clipboard icon"></i>我的题单</a>
              <a class="item" href="/article/user/1759"><i class="feed icon"></i>我的讨论</a>
              <a class="item" href="/file/1759"><i class="file icon"></i>我的文件</a>
              <!-- <a class="item"><i class="gem icon"></i>积分:0</a>   -->
              <div class="ui divider"></div>
              <a class="item" href="/user/1759/edit"><i class="edit icon"></i>编辑资料</a>
              
              <a class="item" href-post="/logout?url=%2Fproblem%2F4300"><i class="power icon"></i>退出登录</a>
            </div>

          </div>
          
            
        </div>
    </div>
</div>
<div style="margin-top: 28px; ">
<div class="ui main container" style="background-color: rgba(255,255,255,0.5); opacity: 90%;">
var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f247b417803c787866742129924988c6"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})(); //let user = {"id":1759,"username":"wyh15","email":"192@qq.com","password":"9cb3b0b4b0dcb20271d1bdfb807daa59","nickname":null,"realname":"王彦皓","nameplate":"","information":"小恐龙升级版\r\n\r\n\r\n这是一个按钮,我也不知道有啥用\r\n\r\n\r\nminecraft\r\n\r\n\r\nC++干货\r\n\r\n\r\nc++等级考试\r\n\r\n\r\n\r\n编程一坤时\r\n\r\n\r\n\r\nc++在线编译器\r\n\r\n\r\n\r\npoki小游戏\r\n\r\n\r\n\r\n\r\n电子学会等级考试\r\n\r\n\r\n\r\n\r\n演草纸\r\n\r\n\r\n随机跳题\r\n\r\n\r\n\r\n刷题王\r\n\r\n\r\n\r\n站长\r\n\r\n\r\n\r\n黄金三\r\n\r\n\r\n\r\n\r\n\r\n喵星人\r\n\r\n\r\n\r\n\r\n山顶洞人\r\n\r\n\r\n\r\n\r\n\r\n椰子!我爱椰子\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nsadbee........sb\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n保留\r\n\r\n\r\n\r\n\r\n\r\n站长\r\n\r\n\r\n\r\n\r\n\r\n管理员","ac_num":187,"notification_num":0,"at_num":0,"hf_num":0,"xt_num":0,"submit_num":653,"from_group":75,"is_admin":null,"is_teacher":false,"is_show":true,"public_email":false,"qq_image":3,"prefer_formatted_code":false,"sex":1,"rating":1500,"gold":0,"theme":0,"class_names":"76","register_time":1676628105}; // if (user) // { // daovoice('init', { // app_id: "51046a20", // user_id: user.id, // 必填: 该用户在您系统上的唯一ID // email: user.email, // 选填: 该用户在您系统上的主邮箱 // name: user.realname ? user.username + '(' + user.realname + ')' : user.username, // 选填: 用户名 // signed_up: user.register_time // 选填: 用户的注册时间,用Unix时间戳表示 // }); // daovoice('update'); // } // else // { // daovoice('init', { // app_id: "51046a20" // }); // daovoice('update'); // } #languages-menu::-webkit-scrollbar, #testcase-menu::-webkit-scrollbar { width: 0px; background: transparent; } #languages-menu .item::after, #testcase-menu .item::after { display: none; } window.pathLib = "/cdnjs/"; window.pathSelfLib = "/self/"; var originalConsoleWarn = console.warn; console.warn = function (message) { if (message.startsWith('Duplicate definition of module')) return; originalConsoleWarn.apply(console, arguments); };

      #4300. 「2023.09 三级」谁是你的潜在朋友
      
      <span class="ui tiny red label"> 入门 </span>
    
  </h1>
</div>

  <div class="row" style="margin-top: -15px">
      <span class="ui label">时间限制:1000 ms</span>
      <span class="ui label">内存限制:128 MiB</span>
      
        <span class="ui label">标准输入输出</span>
      
  </div>


  <div class="row" style="margin-top: -23px">
      <span class="ui label">题目类型:传统</span>
      <span class="ui label">评测方式:文本比较</span>
  </div>


    <div class="row" style="margin-top: -23px">
        <span class="ui label">上传者:
        
          <a href="/user/1">root</a>
        
        </span>
        
    </div>

        <a class="small ui primary button" href="#submit_code">提交</a>
      
      <a class="small ui positive button" href="/submissions?problem_id=4300">提交记录</a>
      <a class="small ui orange button" href="/problem/4300/statistics/fastest">统计</a>

  
      
      <a class="small ui brown button" href="/discussion/problem/4300" style="position: relative; ">
        讨论
        
      </a>
      <a class="small ui purple button" href="/discussion/solution/4300" style="position: relative; ">
          题解
          
      </a>
   
        <a class="small ui icon button button_todo_list blue" data-tooltip="加入任务计划" data-action="add">
          <i class="icon plus"></i>
        </a>
      
    
  </div>

  
  <script type="text/javascript">
    var attributes = {
      ".button_todo_list": {
        "class": ["blue", "red"],
        "data-action": ["add", "remove"],
        "data-tooltip": ["加入任务计划", "从任务计划中删除"],
      },
      ".button_todo_list i": {
        "class": ["plus", "minus"]
      }
    };
    function updateTodoListButton(type) {
      for (var selector in attributes) {
        var $dom = $(selector);
        for (var attrName in attributes[selector]) {
          var attrValues = attributes[selector][attrName];
          if (attrName === 'class') {
            $dom.removeClass(attrValues[1 - type])
                .addClass(attrValues[type]);
          } else {
            $dom.attr(attrName, attrValues[type]);
          }
        }
      }
    }
    $('.button_todo_list').click(function() {
      var $this = $(this);
      var action = $this.attr('data-action');
      $this.addClass("disabled");
      $.ajax({
        method: 'POST',
        url: '/api/todo_list/' + action + '/' + 4300,
        success: function(data) {
          if (data.error) {
            alert(data.error);
          } else {
            location.reload();
            var type = action === 'add' ? 1 : 0;
            updateTodoListButton(type);
          }
          $this.removeClass("disabled");
        },
        error: function(xhr) {
          alert(xhr.responseText);
          $this.removeClass("disabled");
        }
      });
    });
  updateTodoListButton(0);
  </script>
  

  
    <div class="ui buttons right floated"> 
      
       
    </div>
  
</div>

题目描述

  <div class="ui bottom attached segment font-content"><div style="position: relative; overflow: hidden; transform: translate3d(0, 0, 0); "><p>“臭味相投”——这是我们描述朋友时喜欢用的词汇。两个人是朋友通常意味着他们存在着许多共同的兴趣。然而作为一个宅男,你发现自己与他人相互了解的机会并不太多。幸运的是,你意外得到了一份北大图书馆的图书借阅记录,于是你挑灯熬夜地编程,想从中发现潜在的朋友。 首先你对借阅记录进行了一番整理,把N个读者依次编号为1,2,…,N,把M本书依次编号为1,2,…,M。同时,按照“臭味相投”的原则,和你喜欢读同一本书的人,就是你的潜在朋友。你现在的任务是从这份借阅记录中计算出每个人有几个潜在朋友。</p>
</div>

输入格式

      <div style="position: relative; overflow: hidden; transform: translate3d(0, 0, 0); "><p>第一行两个整数N,M,2 &lt;= N ,M&lt;= 200。接下来有N行,第i(i = 1,2,…,N)行每一行有一个数,表示读者i-1最喜欢的图书的编号P(1&lt;=P&lt;=M)</p>
<div class="row">
    <div class="column">
      <h4 class="ui top attached block header">输出格式</h4>
      <div class="ui bottom attached segment font-content">
        
        <div style="position: relative; overflow: hidden; transform: translate3d(0, 0, 0); "><p>包括N行,每行一个数,第i行的数表示读者i有几个潜在朋友。如果i和任何人都没有共同喜欢的书,则输出“BeiJu”(即悲剧,^ ^)</p>
<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: &quot;Fira Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, Menlo, Consolas, &quot;Lucida Console&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft Yahei&quot;, 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: &quot;Fira Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, Menlo, Consolas, &quot;Lucida Console&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft Yahei&quot;, 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>&nbsp;</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: &quot;Fira Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, Menlo, Consolas, &quot;Lucida Console&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft Yahei&quot;, 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>
var editor; var ok = 0 ; window.onEditorLoaded(function () { var editorElement = document.getElementById('editor'); var content = ''; // //注释可以取消在题目界面查看代码 editor = window.createCodeEditor(editorElement, $('#languages-menu .item.active').data('mode'), content); window.editor = editor; }); function hide_runcode() { document.getElementById("run_code").style.display="none"; } function run_code() { ok = 1; var code_example = document.getElementById("run_code_stdin"); var code_result = document.getElementById("run_code_stdout"); var problem_example = document.getElementById("problem_example"); var list = problem_example.getElementsByTagName('span'); //输入样例个数 var lastSubmitted; //代码框的代码 var debug_button = document.getElementById("debug"); code_result.value = ''; if (document.getElementById("run_code").style.display !== "block") { document.getElementById("run_code").style.display="block"; //设置输入框内容为样例 if (list.length <= 1) { code_example.value = ''; } else { code_example.value = list[0].innerHTML; } code_example.style.height = 'auto'; code_example.style.height=(code_example.scrollHeight)+ 'px'; //设置输入框跟样例一样大 } //准备工作 if (!$('#submit_code input[name=answer]').val().trim() && !editor.getValue().trim()) { lastSubmitted = ''; } else { $('#submit_code input[name=language]').val($('#languages-menu .item.active').data('value')); lastSubmitted = editor.getValue(); $('#submit_code input[name=code]').val(editor.getValue()); } //如果代码框的代码为空则不执行后续操作 if (lastSubmitted.length <= 15) { $('#judge_result_span').text('提交被拒').css("color", "blue"); code_result.value = "代码太短"; return false; } else { debug_button.disabled = true;//查找调试“测试代码”按钮并设置为不可用 $.ajax({ method: 'POST', url: '/problem/' + 4300 + '/codetest', data : { input : code_example.value, code : lastSubmitted, lang : $('#languages-menu .item.active').data('value') }, success: function(data) { // 处理成功响应的逻辑 console.log(data); if(data.not_allowed_error) $('#judge_result_span').text(data.not_allowed_error).css("color", "blue") else if(data.error) $('#judge_result_span').text(data.error).css("color", "red") else $('#judge_result_span').text("运行成功").css("color", "green") if(data.not_allowed_error == "提交过于频繁") { code_result.value = data.not_allowed_error + ',请 5 秒后再试'; } else if(data.not_allowed_error == "仅支持C++ 在线测试") { code_result.value = data.not_allowed_error + ",请选择 C++ 语言提交"; } else if(data.not_allowed_error) { code_result.value = "代码中有非法、中文符号"; } else if(data.info !== '') { code_result.value = data.info.replace(/(\/opt\/syzoj\/web\/uploads\/tmp\/[^\/]+\/main\.cpp)|(
)/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"; });
//动态时钟 var d = 1716023259; setInterval(function () { d += 1; let date = new Date(d * 1000); var year = date.getFullYear() //获取月份 var month = date.getMonth() + 1 // 获取日 var dates = date.getDate() //获取小时 var hours = date.getHours() // 获取分钟 var mit = date.getMinutes() // 获取秒 var seconds = date.getSeconds() //小时数小于10时就在前面加0 month = month > 9 ? month : "0" + month dates = dates > 9 ? dates : "0" + dates hours = hours > 9 ? hours : "0" + hours mit = mit > 9 ? mit : "0" + mit seconds = seconds > 9 ? seconds : "0" + seconds //将获取的时间信息以不同的形式展示 var result = year + "-" + month + "-" + dates + " " + hours + ":" + mit + ":" + seconds; //在id为td的控件中进行显示 document.getElementById("time").innerHTML = result }, 1000); //跳转页面顶部函数 $("#test").click(function(){ $("html,body").animate({scrollTop: "0px"}, 200); });
{{ vote && vote.total.up }}