AC Array Checker

AtCoderのTaskページにおいて配列の要素の最大値が指定した数より小さい場合に強調します。

  1. // ==UserScript==
  2. // @name AC Array Checker
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-02-20
  5. // @description AtCoderのTaskページにおいて配列の要素の最大値が指定した数より小さい場合に強調します。
  6. // @author You
  7. // @license mit
  8. // @match https://atcoder.jp/contests/*/tasks/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=atcoder.jp
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. const main = (function() {
  14. 'use strict';
  15.  
  16. // 10^7
  17. const maximum = 10000000;
  18.  
  19. document.querySelectorAll("annotation[encoding=\"application/x-tex\"]").forEach((ele) => {
  20. if(ele.aac_checked) { return; }
  21. ele.aac_checked = true;
  22. const match = ele.innerHTML.match(/[0-9]+[\s\t]*\\[gl]?eq[\s\t]+[a-zA-Z]+\_[a-zA-Z]+[\s\t]*\\[gl]?eq[\s\t]+(.*)/);
  23. if(match) {
  24. const exp = new Function("return " + match[1].replaceAll("\\times", "*").replaceAll("\\cdot", "/").replaceAll("^", "**"));
  25. console.log(exp);
  26. if(exp() <= maximum) {
  27. ele.parentNode.parentNode.parentNode.parentNode.style += ";color:red;font-size: 20pt;";
  28. }
  29. }
  30. });
  31.  
  32. });
  33.  
  34. setInterval(main, 100);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址