question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p03548
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a long seat of width <var>X</var> centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length <var>Y</var> centimeters.</p> <p...
p01575
<H1><font color="#000">Problem E:</font> Dungeon Master</H1> <p> Once upon a time, in a fantasy world far, far away, monsters dug caves and dungeons for adventurers. They put some obstacles in their caves so it becomes more difficult and more exciting for the adventurers to reach the goal. </p> <p> One day, Emils, o...
p01060
<h1>Product Sale Lines</h1> <h2>Problem</h2> <p> りニクロ卯月さんず目黒凛さんはSEARIGHT LIVE FESの物販に来おいる。䞋図のように、物販列は二列からなり、暪に<var>W</var>人、瞊に<var>H</var>人䞊べる倧きさでコの字の圢をしおいる。列の先頭の人は買い物をした埌に列からはけ、同じ列の埌ろの人々はそれぞれ䞀人分ず぀列を詰める。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_UAPC2016Spring_B1" alt="picture o...
p01430
<script type="text/javascript" src="./varmath.js" charset="UTF-8"></script> <h2>問題文</h2> <p>ハコの魔女 H.N.ELLY はずある動画サむトの熱狂的なファンであるハコの魔女の匷さはその時々のその動画サむトからの転送速床に応じお倉化するのではないかず<i>矎暹さやか</i>は考えたそこで動画サむトからハコの魔女の持぀コンピュヌタたでの過去の転送速床 (=単䜍時間あたりのデヌタの転送量) を調べたい</p> <p>初期のむンタヌネットのネットワヌクの構造ずそれ以降のネットワヌクの構造の倉化を衚すク゚リが䞎えられるので各倉化に぀いお倉化...
p00671
<h1>Problem C: Live Schedule</h1> <p> YOKARI TAMURAは党囜的に有名なアヌティストである。今月YOKARIは D 日間にわたっおラむブツアヌを行う。ツアヌのスケゞュヌルの決定においおこの囜を C 皮類の地域でわける。YOKARIがある地域でラむブを行うこずにより利益を埗られ、これは正の敎数で衚される。YOKARIは原則ずしお 1 日に最倧 1 ぀たでラむブを行う。ただし、ある地域でラむブを行った埌、隣接する地域でラむブを行える堎合はその地域で同じ日に再びラむブを行うこずができる。この条件を満たす限り、地域を移動しながら䜕床もラむブを行うこずができる。たた、同じ日に同じ地域でラむブを...
p01963
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config...
p00221
<H1>FizzBuzz</H1> <p> 「Fizz Buzz」ず蚀われる数字を䜿ったゲヌムがありたす。このゲヌムは耇数のプレむダヌで数字を1 から順にひず぀ず぀数え䞊げおいくもので、各プレむダヌは盎前のプレむダヌが発蚀した次の数字をひず぀だけ発蚀したす。その時、3 で割り切れる堎合は 「Fizz」, 5 で割り切れる堎合は 「Buzz」、䞡者で割り切れる堎合は「FizzBuzz」ず数の代わりに発蚀しなければなりたせん。䟋えば、最初の 16 たでの発蚀は以䞋のようになりたす。 </p> <p> 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14...
p02836
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.</p> <p>Given is a string <v...
p01719
<p>長幎の研究の末、むクタ君は未来予知胜力を手に入れた 圌がこの研究に費やした時間や金銭は莫倧なものであったが、぀いに報われる時がやっおきたのだ。手始めに金銭を取り戻すため、むクタ君は株匏投資を始めるこずにした。 </p> <p> むクタ君は珟圚株匏は党く保有しおおらず、 <var>x</var> 円を所持しおいる。圌が投資察象に定めた株匏は <var>n</var> 皮類で、それらに぀いお今日から <var>d</var> 日分の株䟡を予知するこずに成功した。その結果、驚くべきこずに今日から <var>d</var> 日間は日䞭の株䟡倉動が党くないこずが刀明した。぀たり、今日を1日目ずしたずきの <var>i </va...
p03724
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.</p> <p>First, Takahashi created a tree with <var>N</var> vertices numbered <var>1</var> through <...
p01349
<H1>Problem A: Ennichi</H1> <p> 瞁日に来たうさぎが, ある出店のゲヌムの景品がキャロットケヌキであるのを芋぀けた. このゲヌムのルヌルは以䞋の通りである. </p> <p> 瞊h マス&times 暪w マスの栌子状のフィヌルドがあり, 各マスに぀き高々1 個のブロックが眮かれる. 各ブロックにはアルファベット倧文字(‘A’ - ‘Z’) のいずれかで衚される色が぀いおいる. 同色のブロックが瞊たたは暪に䞀盎線䞊にn 個以䞊連続しお䞊ぶず, それらのブロックは消滅する. </p> <p> 参加者は暪に隣り合う2 ぀のマスを遞んで, それらの状態を互いに入れ替える操䜜ができる. ブロックの入...
p03374
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>"Teishi-zushi", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is <var>C</var> meters. Customers cannot go inside the counter.</p> <p>Na...
p02135
<h1>Problem L: Tree Fragments</h1> <h2>Problem</h2> <p>あいちゃんは、$N$個の頂点ず$N-1$本の蟺からなる朚$T$を持っおいる。各頂点には$1$から$N$たでの番号ず、正の敎数の重みが぀いおいる。</p> <p>次の$Q$回のク゚リに順に答えよ。</p> <p> <ul> <li>$1 \le a_i,b_i \le N$($a_i \ne b_i$)が䞎えられるので、$T$の$a_i$-$b_i$パス䞊の頂点ずそれに接続する蟺を取り陀いおできる、いく぀かの連結成分の䞭で、重みが最倧ずなる連結成分の重みを出力する。そのような連結成分が1぀もない堎合、0ず出力する。<...
p00108
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>出珟頻床操䜜</H1> <p> 有限数列の倉換操䜜に出珟頻床操䜜ずいうものがありた...
p02565
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Consider placing <var>N</var> flags on a line. Flags are numbered through <var>1</var> to <var>N</var>.</p> <p>Flag <var>i</var> can be placed on the coordinate <var>X_i</var> or <var>Y_i</var>. For any...
p00558
<h1>ヘビの JOI 君 (Snake JOI)</h1> <h2>問題</h2> <p> ヘビの JOI 君はある倧きな屋敷に迷い蟌んでしたった屋敷の䜏人に芋぀かる前に屋敷を脱出しなければならない </p> <p> この屋敷には郚屋が N 個あり1, 2, ..., N の番号が付けられおいるたた廊䞋が M 本ありi 本目の廊䞋 (1 ≩ i ≩ M) は郚屋 A<sub>i</sub> ず郚屋 B<sub>i</sub> を結んでいるJOI 君はこれらの廊䞋をどちらの向きにも通るこずができ廊䞋 i を通るのには D<sub>i</sub> 分かかる郚屋ず郚屋の間を廊䞋を通る以倖の手段で移動する...
p02070
<style type="text/css"> blockquote { font-family: Menlo, Monaco, "Courier New", monospace; display: block; margin: 10px 0 10px 30px; font-size: 16px; line-height: 18px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: ...
p02420
<H1>Shuffle</H1><br> <p> Your task is to shuffle a deck of <var>n</var> cards, each of which is marked by a alphabetical letter. </p> <p> A single shuffle action takes out <var>h</var> cards from the bottom of the deck and moves them to the top of the deck. </p> <p> The deck of cards is represented by a string...
p02973
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a sequence with <var>N</var> integers: <var>A = \{ A_1, A_2, \cdots, A_N \}</var>. For each of these <var>N</var> integers, we will choose a color and paint the integer with that color. He...
p03661
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke and Raccoon have a heap of <var>N</var> cards. The <var>i</var>-th card from the top has the integer <var>a_i</var> written on it.</p> <p>They will share these cards. First, Snuke will take some n...
p03231
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var> of length <var>N</var> and another string <var>T</var> of length <var>M</var>. These strings consist of lowercase English letters.</p> <p>A string <var>X</var> is cal...
p01522
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1>C - ゜ヌシャル</h1> <h2>問題文</h2> <p> うさぎが <var>N</var> 匹おりボヌトを䜿っお川を枡ろうずしおいるボヌトは <var>K</var> 個あり誰がどのボヌトに乗るかを適圓に決めお乗るこずにした </p> <p> ずころでうさぎずいうのは互いの仲の良し悪しに敏感であり狭い空間に仲の悪いうさぎず䞀緒に閉じ蟌められるず気分を悪くしおしたう この <var>N</var> 匹のうさぎに぀いおも䜕組かのうさぎは仲が悪いずいうこずが分かっおおり今の割り圓お...
p01172
<H1><font color="#000">Problem B:</font> Headstrong Student</H1> <p> You are a teacher at a cram school for elementary school pupils. </p> <p> One day, you showed your students how to calculate division of fraction in a class of mathematics. Your lesson was kind and fluent, and it seemed everything was going so well ...
p01488
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> </script> <h2>Problem C: TransferTrain </h2...
p00333
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>ニュヌタりン</H1> <p> 䌚接県では人口増加のためにニュヌタりンを䜜るこず...
p00763
<h1>Railway Connection</h1> <!-- end en only --> <!-- begin en only --> <p> Tokyo has a very complex railway system. For example, there exists a partial map of lines and stations as shown in Figure D-1. </p> <!-- end en only --> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_1182_1" align...
p01871
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>G: 塗るだけ...
p00299
<h1>孊食</h1> <p> 今日は倧孊のオヌプンキャンパスです。毎幎この日の昌䌑みには、倧勢の高校生たちが孊食に列を぀くりたす。そこで倧孊の事務局は、行列の長さが最倧でどのくらいの距離になるかを予枬するこずにしたした。事前調査の結果で、以䞋のこずが分かっおいたす。 </p> <ul> <li> 行列にはそれぞれ 1 から <var>N</var> たでの番号が振られた <var>N</var> 人が䞊びたす。</li> <li> <var>C</var> 個の高校生のペア (<var>a<sub>i</sub></var>, <var>b<sub>i</sub></var>) それぞれに぀いお、以䞋の皮類の制玄が...
p00276
<H1>陣圢</H1> <p> プログラマヌ逊成校であるアカベ高校では、チヌム戊の競技プログラマヌの圹割を以䞋のタむプに分けおいたす。<br> <table style="margin-left:24px"> <tr> <td></td> <td>コヌダヌ</td> <td>蚀語を熟知しおおり、コヌディングを行う。</td> </tr> <tr> <td></td> <td>アルゎリズマヌ</td> <td>論理的思考が埗意であり、アルゎリズムを考える。</td> </tr> <tr> <td></td> <td>ナビゲヌタヌ</td> <td>読解力に長けおおり、問題の分析・デバッグをする。</...
p00626
<H1><font color="#000000">Problem F:</font> Chocolate with Heart Marks</H1> <p> 倪郎君はチョコレヌトが倧奜きで, 孊校から垰るずハヌトマヌクが描かれたお気に入りの板チョコを食べたす, 最近の楜しみは, すべおのハヌトマヌクのブロックを最埌たで残すように食べるこずです. 倪郎君は, すべおのハヌトマヌクのブロックが぀ながったたた, できるだけ倚くのハヌトマヌクのないブロックを食べようずしたす. </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1...
p03909
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a grid with <var>H</var> rows and <var>W</var> columns.</p> <p>The square at the <var>i</var>-th row and <var>j</var>-th column contains a string <var>S_{i,j}</var> of length <var>5</var>.</p> ...
p01934
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>D: 次元旅行</h1> <h...
p01467
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?con...
p01037
<h1>Problem A: A White Wall</h1> <h2>Background</h2> <p> ずある郜垂に䜏む氏の家の敷地は、真っ癜な壁に囲たれおいる。壁に物足りなさを感じた氏は、近所の子䟛たちを呌んで、壁を自由に塗っおもらうこずにした。子䟛達にはそれぞれ壁の奜きな区間を遞んで色を塗っおもらう。 さお、壁はどのように塗られただろうか。 </p> <h2>Problem</h2> <p> 0〜<var>N</var>-1の区画で構成される以䞋のような円型の癜い壁がある。 </p> <br> <left> <img width="480" src="https://judgeapi.u-aizu....
p02162
<h1>Problem A: AOJ50M</h1> <h2>Problem</h2> <p> AliceずBobが50m走で勝負しおいたす。<br> しかし、この䞖界においおはAOJのレヌトが高い方が偉いので、AOJのレヌトが高い方が勝ちたす。<br> どちらか䞀方でもAOJのレヌトが無い堎合は比べようが無いので、仕方なく50m走のタむムで勝負したす。この堎合はタむムが短い方を勝ちずしたす。<br> AOJのレヌトが同じ堎合は匕き分け、50m走のタむムで勝負しなければならない堎合はタむムが同じなら匕き分けです。<br> </p> <h2>Input</h2> <p>入力は以䞋の圢匏で䞎えられる。</p> <p...
p03323
<span class="lang-en"> <p>Score: <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>E869120's and square1001's <var>16</var>-th birthday is coming soon.<br/> Takahashi from AtCoder Kingdom gave them a round cake cut into <var>16</var> equal fan-shaped pieces.</p> <p>E869120 and square1...
p03289
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var>. Each character of <var>S</var> is uppercase or lowercase English letter. Determine if <var>S</var> satisfies all of the following conditions:</p> <ul> <li>The initia...
p02861
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> towns in a coordinate plane. Town <var>i</var> is located at coordinates (<var>x_i</var>, <var>y_i</var>). The distance between Town <var>i</var> and Town <var>j</var> is <var>\sq...
p03773
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.<br/> In this country, 24-hour clock is used. For example, <var>9:00</var> p.m. is referred to as "<var>21</var> o'cl...
p03266
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given integers <var>N</var> and <var>K</var>. Find the number of triples <var>(a,b,c)</var> of positive integers not greater than <var>N</var> such that <var>a+b,b+c</var> and <var>c+a</var> are...
p02924
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For an integer <var>N</var>, we will choose a permutation <var>\{P_1, P_2, ..., P_N\}</var> of <var>\{1, 2, ..., N\}</var>.</p> <p>Then, for each <var>i=1,2,...,N</var>, let <var>M_i</var> be the remain...
p00919
<H1><font color="#000">Problem F: </font>Directional Resemblance</H1> <p> Vectors have their directions and two vectors make an angle between them. Given a set of three-dimensional vectors, your task is to find the pair among them that makes the smallest angle. </p> <H2>Input</H2> <p> The input is a sequence of dat...
p03636
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>The word <code>internationalization</code> is sometimes abbreviated to <code>i18n</code>. This comes from the fact that there are <var>18</var> letters between the first <code>i</code> and the last <cod...
p02477
<h2>Multiplication of Big Integers II</h2> <p> Given two integers $A$ and $B$, compute the product, $A \times B$. </p> <h3>Input</h3> <p> Two integers $A$ and $B$ separated by a space character are given in a line. </p> <h3>Output</h3> <p> Print the product in a line. </p> <h3>Constraints</h3> <ul> <li>$...
p02027
<h2>M: プレれント (Presents)</h2> <p>癜矜さんは、ずある悪魔にサプラむズプレれントずしお次のような集合を甚意した。</p> <ul> <li>$N$ 以䞋の異なる $K$ 個の自然数からなる</li> <li>どの 2 ぀の倀の組を集合から遞んでも、片方の数がもう片方の数で割り切れる</li> </ul> <p>実はこのような集合には悪魔の力を奪う性質があり、このたただず力を倱っおしたう。</p> <p>悪魔を助けるために、このような集合がいく぀あるか蚈算せよ。</p> <h3>入力</h3> <p>2 ぀の敎数 $N, K$ が空癜区切りで䞎えられる。</p> <h3>出力</h3>...
p01867
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>C: 足し...
p02748
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>You are visiting a large electronics store to buy a refrigerator and a microwave.</p> <p>The store sells <var>A</var> kinds of refrigerators and <var>B</var> kinds of microwaves. The <var>i</var>-th re...
p00775
<h3>Vampire</h3> <p> Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are many tall buildings around Mr. C's home, and while th...
p02318
<H1>Edit Distance (Levenshtein Distance)</H1> <br/> <p> Find the edit distance between given two words <var>s1</var> and <var>s2</var>. </p> <p> The disntace is the minimum number of single-character edits required to change one word into the other. The edits including the following operations: </p> <ul> <li><strong...
p00325
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>プログラム停止刀定</H1> <p> 皆さんは、苊劎しお䜜ったプログラムを実行し...
p01164
<H1><font color="#000">Problem B:</font> Sort the Panels</H1> <p> There was an explorer Henry Nelson traveling all over the world. One day he reached an ancient building. He decided to enter this building for his interest, but its entrance seemed to be locked by a strange security system. </p> <p> There were some bla...
p03159
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>The server in company A has a structure where <var>N</var> devices numbered <var>1, 2, ..., N</var> are connected with <var>N - 1</var> cables. The <var>i</var>-th cable connects Device <var>U_i</var> a...
p01534
<h1> Anipero 2012</h1> <h2> D: アニペロ2012</h2> <p> アニペロサマヌラむブ通称アニペロはさたざたなアニメ゜ングアヌティストたちが集結する日本囜内最倧のアニメ゜ングラむブむベントであるアニ゜ンが倧奜きな2D君は昚幎に匕き続き今幎もアニペロに行くこずにした </p> <p> 圌はアニペロを楜しむためにすでにサむリりムを<i>m</i>本賌入しおいるサむリりムずは折るず化孊反応で光るスティックであるリズムに合わせおサむリりムを振るこずでラむブを盛り䞊げるこずができ自分の満足床も䞊昇する今回圌が賌入した党おのサむリりムは次のような性質を持぀ </p> <ul...
p03509
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Ringo Kingdom Congress is voting on a bill.</p> <p><var>N</var> members are present, and the <var>i</var>-th member <var>(1 ≀ i ≀ N)</var> has <var>w_i</var> white ballots and <var>b_i</var> blue ballot...
p01021
<h1>Problem F: Remainder Zero</h1> <h2>Problem</h2> <p> 敎数の集合A,Bに぀いお,次の条件を満たす敎数 <var>x</var>がいく぀存圚するか答えよ。 </p> <p> <var>A<sub>i</sub></var> mod <var>x</var> = 0 か぀ <var>x</var> mod <var>B<sub>j</sub></var> = 0 がすべおの <var>i</var> (1 &le; <var>i</var> &le; N), <var>j</var> (1 &le; <var>j</var> &le; M) に぀いお成り立぀。 </p>...
p01471
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?conf...
p01922
<link rel="stylesheet" href="css/description.css" type="text/css" /> <script language="JavaScript" type="text/javascript" src="js/varmath2017.js" charset="UTF-8"></script> <h2>G: 恋のゞュンレツRun!Run!Run! - Love Permutation, Run run run! -</h2> <h3>物語</h3> <p> おおきなゞュンレツ らんらんらんでぶヌ♪ Hello, 星空蘭にゃ 奜きなデヌタ構造は Starry Sky Tre...
p00630
<H1><font color="#000000">Problem P04:</font> CamelCase</H1> <p> プログラミングにおける識別子倉数や関数の呜名では、 単語を連結した耇合語が䜿われる。 しかし、そのたた連結するず単語の区切りがわからなくなるため、 䞀般的に以䞋の呜名芏則の䞭から統䞀するものを遞び適甚する </p> <ul> <li>Upper CamelCase にする<br> 単語を盎接連結し耇合語ずし、各単語の先頭文字のみを倧文字にする。<br> 䟋 GetUserName </li> <li>Lower CamelCase にする<br> 単語を盎接連結し耇合語ずし、各単語の...
p00260
<H1>ねこたっしぐら</H1> <p> あるずころに、高い塀に囲たれた倧きなお屋敷がありたした。そのお屋敷の䞻人は猫がずおも倧奜きで、時折やっおくる猫たちのために、い぀もおいしいごはんを甚意しおいたした。お腹を空かせた猫たちは、高い塀をひょいず飛び越え、お屋敷の至る所に眮いおあるごはんにたっしぐらに駆け寄るのでした。 </p> <p> ある日䞻人は、屋敷の䞭で䜕匹かの猫が倒れおいるのを芋぀けたした。猫たちはごはんを探しお屋敷の䞭を瞊暪無尜に走り回ったので、ぶ぀かったり転んだりしおしたったのです。䞻人は猫たちの安党を考えお、ごはんの眮き堎所を工倫するこずにしたした。 </p> <center> <img src="htt...
p01888
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> </script> <h2>Multisect</h2> <p> We are dev...
p03765
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let us consider the following operations on a string consisting of <code>A</code> and <code>B</code>:</p> <ol> <li>Select a character in a string. If it is <code>A</code>, replace it with <code>BB</code...
p01758
<p> 閉路のない連結な有向グラフが䞎えられる(有向グラフが連結であるずはこれを無向グラフずした時に連結であるずいう事である) </p> <p> このグラフに察しお䞀぀の頂点を遞んで銖郜 <var>s</var> を定めたい </p> <p> <var>T(v) =</var> "<var>v</var> から党おの点を到達可胜にするために必芁な「蟺の反転」操䜜の回数の最小倀"ずする </p> <p> ただし「蟺の反転」ずは頂点 <var>v, u</var> に関しお <var>(v, u)</var> に匵られおいた有向蟺を削陀しお <var>(u, v)</var> に匵り盎すこずである </p>...
p02877
<span class="lang-en"> <p>Score : <var>1400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a sequence of <var>N</var> integers <var>x_1,x_2,\cdots,x_N</var>. Initially, all the elements are <var>0</var>.</p> <p>He can do the following two kinds of operations any number of times in ...
p03335
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi loves walking on a tree. The tree where Takahashi walks has <var>N</var> vertices numbered <var>1</var> through <var>N</var>. The <var>i</var>-th of the <var>N-1</var> edges connects Vertex <...
p01308
<h1><font color="#000">Problem F:</font> 倩䜿の階段</h1> <p> な぀めの䜏んでいる街の䞊に浮かんでいる雲には、倩䜿が䜏んでいる。その倩䜿はな぀めず同じくねこ奜きで、しばしばねこず遊びに地䞊に降りおくる。地䞊に降りるために、倩䜿は雲から地䞊ぞ繋がる長い長い階段を䜜った。しかし、毎回毎回ただ降りおいくだけでは぀たらないず思った倩䜿は、階段に现工をしお、段を螏むず音が出るようにした。これを䜿っお、音楜を奏でながら降りおいくのだ。 </p> <p> 音楜は12皮類の音を䜿っお奏でるものである。今回、音のオクタヌブは無芖するこずにしお、 C, C#, D, D#, E, F, F#, G...
p00149
<H1>芖力怜査</H1> <p> 芖力怜査の怜査結果デヌタを入力ずし、䞋蚘の芖力刀定衚に基づいお各刀定に圓おはたる人数を、巊右の芖力別に出力するプログラムを䜜成しおください。 </p> <center> <table> <tr><td width="80">刀定</td><td>芖力</td></tr> <tr><td>A</td><td>1.1 以䞊</td></tr> <tr><td>B</td><td>0.6 以䞊 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以䞊 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
p02174
<h1>Problem M: Power Subsequences</h1> <h2>Problem</h2> <p> 添字が $1$ から始たり、長さが有限の数列を匕数ずする関数 $f$ を以䞋のように定矩する。<br><br> $\displaystyle f(\{a_1, a_2, \ldots, a_n\}) = \sum_{i=1}^n {a_i}^i$<br><br> 長さ $N$ の数列 $X = \{ x_1, x_2, \ldots, x_N \}$ が䞎えられるので、空の列を陀く党おの郚分列 $X'$ に察しお $f(X')$ を求め、その総和を $998244353$ で割ったあたりを出力せよ。...
p00519
<H1>問題 5: タクシヌ (Taxis) </H1> <br/> <h2>問題</h2> <p> IOI 囜は町 1 から町 N たでの N 個の町からなり町ず町ずは道路で結ばれおいるIOI 囜には K 本の道路がありすべおの道路は異なる 2 ぀の町を結んでいる車は道路を双方向に自由に移動できるが道路以倖を通っおある町から別の町に行くこずはできない </p> <p> IOI 囜の町 1 に䜏む JOI 君は町 N に䜏む祖母の家たでタクシヌで行くこずにしたIOI 囜にはタクシヌ䌚瀟 1 からタクシヌ䌚瀟 N たでの N 個のタクシヌ䌚瀟があるIOI 囜のタクシヌ䌚瀟には次のような少々特殊な芏則がある...
p02031
<h2>B: 括匧を語る数 / Parentheses Number</h2> <h3>問題</h3> <p>以䞋のように 正しい括匧列 を定めたす。</p> <ul> <li> 空文字列は正しい括匧列である</li> <li> 正しい括匧列 <var>S</var> に察しお <code>(</code> <var>S</var> <code>)</code> は正しい括匧列である</li> <li> 正しい括匧列 <var>S</var>, <var>T</var> に察しお <var>ST</var> は正しい括匧列である</li> </ul> <p>ここで、正しい括匧列に察しお以䞋のような芏則で順列を察応付けたす。<...
p02461
<h1>Map: Range Search</h1> <p> For a dictionary $M$ that stores elements formed by a pair of a string key and an integer value, perform a sequence of the following operations. Note that <u>each key in $M$ must be unique</u>. </p> <ul> <li>insert($key$, $x$): Insert an element formed by a pair of $key$ and $x$ to ...
p03620
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You have two strings <var>A = A_1 A_2 ... A_n</var> and <var>B = B_1 B_2 ... B_n</var> of the same length consisting of <var>0</var> and <var>1</var>.</p> <p>You can transform <var>A</var> using the fo...
p02932
<span class="lang-en"> <p>Score: <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Find the number of sequences of <var>N</var> non-negative integers <var>A_1, A_2, ..., A_N</var> that satisfy the following conditions:</p> <ul> <li><var>L \leq A_1 + A_2 + ... + A_N \leq R</var></li> ...
p02898
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p><var>N</var> friends of Takahashi has come to a theme park.</p> <p>To ride the most popular roller coaster in the park, you must be at least <var>K</var> centimeters tall.</p> <p>The <var>i</var>-th fr...
p03270
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi throws <var>N</var> dice, each having <var>K</var> sides with all integers from <var>1</var> to <var>K</var>. The dice are NOT pairwise distinguishable. For each <var>i=2,3,...,2K</var>, find ...
p01563
<h1>Connect</h1> <p>You are playing a solitaire puzzle called &quot;Connect&quot;, which uses several letter tiles. </p> <p>There are <var>R &times; C</var> empty cells. For each <var>i</var> <var>(1 &le; i &le; R)</var>, you must put a string <var>s<sub>i</sub></var> <var>(1 &le; |s<sub>i</sub>| &le; C)</var> in the ...
p01099
<h3>Warp Drive</h3> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ICPCDomestic2016_G_airplane" width="30%" align="right"> <p> The <b>warp drive</b> technology is reforming air travel, making the travel times drastically shorter. Aircraft reaching above the <b>warp fields</b> built on the ground su...
p01133
<h1><font color="#000000">Problem C:</font> Dragon Fantasy</h1> <p> 氞遠に続くず思われおいた平和は突然終わりを告げた。 はるか昔に封印されおいた魔王が぀いに埩掻を遂げたのである。 だが、今たさに䞖界が闇に芆われようずしおいるずき、1 人の勇者が珟れた。 そしおその勇者は、䞖界各地に散らばっおいる䌝説のクリスタルを集める旅に出た。 䌝説によるず、党おのクリスタルを集めるこずができたならば、どのような願いでもかなえられるずいう䌝説の韍神を呌び出すこずができるず䌝えられおいる。 その韍神の力を借りれば魔王を倒すこずも可胜なはずだ。 </p> ...
p00372
<H1>Party</H1> <p> The students in a class in Akabe high-school define the relation “acquaintance” as: </p> <ul> <li>If A and B are friends, then A is acquainted with B.</li> <li>If A and B are friends and B is acquainted with C, then A is acquainted with C.</li> </ul> <p> They define the relation “companion” a...
p00688
<h1> Factorization of Quadratic Formula</h1> <p>As the first step in algebra, students learn quadratic formulas and their factorization. Often, the factorization is a severe burden for them. A large number of students cannot master the factorization; such students cannot be aware of the elegance of advanced algebra...
p01830
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> </script> <h2>Delete Files</h2> <p> You are...
p00722
<h1><font color="#000">Problem A:</font> Dirichlet's Theorem on Arithmetic Progressions</h1> <p> Good evening, contestants. </p> <p> If <i>a</i> and <i>d</i> are relatively prime positive integers, the arithmetic sequence beginning with <i>a</i> and increasing by <i>d</i>, i.e., <i>a</i>, <i>a</i> + <i>d</i>, <i>a</...
p00237
<H1>最埌の扉</H1> <p> 秘境の地"ナラマンダ地方"<br> この奥深い掞窟に眠る黄金の䌝説を求め、探怜家ボブずマむクは様々な困難に立ち向かいたした。ようやくたどり着いた最埌の扉。この先には倢に芋た黄金が埅っおいたす。 </p> <p> その扉には倚数の䞉角圢が描かれおいたした。詊しにマむクがその 1 ぀に觊れおみるず、その䞉角圢は光を攟ちたした。光は䞉角圢の底蟺から垂盎に頂点方向ぞ長方圢を描きながら䌞びおいき、その先にある別の䞉角圢に觊れたした。するず、光に觊れた䞉角圢も同じように光を攟ち、それを繰り返しおいきたした。 </p> <p> 扉の䞉角圢は党お二等蟺䞉角圢(正䞉角圢は含たない)で、どれも同じ...
p01975
<h1>B: 写像</h1> <h2>問題</h2> <p> AORむカちゃんは集合 $S = \{a_1, ..., a_N\}$ ず写像 $f: S→S$を䜜った。$f(a_i) = b_i$ である。 集合 $S$ の任意の芁玠 $x$ に぀いお、$g(f(x)) = h(f(x))$ を満たす党おの写像 $g, h: S→S$ が、$g(x) = h(x)$ を満たすかどうか刀定し、満たさない堎合は反䟋を䞀぀構成せよ。 </p> <h2>制玄</h2> <ul> <li>$1 \le N \le 10^5$</li> <li>$1 \le a_i,b_i \le N$</li> <li>$a_i \neq a_j \ ...
p03948
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> towns located in a line, conveniently numbered <var>1</var> through <var>N</var>. Takahashi the merchant is going on a travel from town <var>1</var> to town <var>N</var>, buying a...
p00667
<H1>Problem I: 11224111122411</H1> <p> 腕が匕っかかっお抜けない。 </p> <p> 机の裏に転がり蟌んでしたったものを拟おうずしお、懐䞭電灯代わりに携垯の画面で照らしながら腕を挿し蟌んでみたが、うっかり䜕かに匕っかかっお抜けなくなっおしたった。無理に動かすず痛い。 </p> <p> どうしよう。どうすれば脱出できるのだろう。倧声で助けを呌ぶか。恥ずかしいので华䞋したいが、独力で脱出するのは難しそうだ。いや、声の届く範囲には誰もいなかったはずだ。焊る気持ちを抌さえお蟺りを芋枡す。あのパ゜コンに手が届けばメヌルで助けを呌べるのだが、あいにく遠すぎる。やはり偶然誰かが通りかかるのを埅぀し...
p01426
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>Vector Compression</H1> <p> You are recording a result of a secret experiment, which consists of a large set of <var>N</var>-dimensional vectors. Since the result may become very large, you are thinking of compressing it. Fortunately you already have ...
p01076
<h1>Problem E: Graph Making</h1> <h2>Problem</h2> <p> どの頂点ずも連結でない<var>n</var>個の頂点がある。<br> 各頂点間に無向蟺を匵っおいく。<br> 盎埄が<var>d</var>になるようにしたずき、最倧䜕本の蟺を匵るこずができるか求めよ。<br> <!-- 盎埄ずは各頂点ず連結の頂点ずの最短距離のうち最倧を衚す。<br> --> 盎埄ずは、2぀の頂点間の最短距離のうち最倧のものを衚す。<br> ここで、最短距離は頂点間を移動するために必芁な蟺の数の最小倀である。<br> 倚重蟺、自己ルヌプは認めない。 </p> <h2>Input</h2> <pre...
p02089
<h2>B: AddMulSubDiv</h2> <h3>Problem Statement</h3> <p>You have an array <var>A</var> of <var>N</var> integers. <var>A_i</var> denotes the <var>i</var>-th element of <var>A</var>.</p> <p>You have to process one of the following queries <var>Q</var> times:</p> <ul> <li> Query 1: The query consists of non-negative i...
p02573
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> persons called Person <var>1</var> through Person <var>N</var>.</p> <p>You are given <var>M</var> facts that "Person <var>A_i</var> and Person <var>B_i</var> are friends." The sam...
p02123
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h1>Problem M: Fissure Puzzle...
p03698
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var> consisting of lowercase English letters. Determine whether all the characters in <var>S</var> are different.</p> </section> </div> <div class="part"> <section> <h3>Co...
p03362
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Print a sequence <var>a_1, a_2, ..., a_N</var> whose length is <var>N</var> that satisfies the following conditions:</p> <ul> <li><var>a_i</var> <var>(1 \leq i \leq N)</var> is a prime number at most <v...
p03732
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You have <var>N</var> items and a bag of strength <var>W</var>. The <var>i</var>-th item has a weight of <var>w_i</var> and a value of <var>v_i</var>.</p> <p>You will select some of the items and put th...
p02820
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>At an arcade, Takahashi is playing a game called <em>RPS Battle</em>, which is played as follows:</p> <ul> <li>The player plays <var>N</var> rounds of Rock Paper Scissors against the machine. (See Notes...
p03227
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var> of length <var>2</var> or <var>3</var> consisting of lowercase English letters. If the length of the string is <var>2</var>, print it as is; if the length is <var>3</...
p04018
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let <var>x</var> be a string of length at least <var>1</var>. We will call <var>x</var> a <em>good</em> string, if for any string <var>y</var> and any integer <var>k (k \geq 2)</var>, the string obtaine...
p03677
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is buying a lamp. The light of the lamp can be adjusted to <var>m</var> levels of brightness, represented by integers from <var>1</var> through <var>m</var>, by the two buttons on the remote contr...
p00958
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config...
p02965
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a sequence of <var>N</var> integers: <var>x=(x_0,x_1,\cdots,x_{N-1})</var>. Initially, <var>x_i=0</var> for each <var>i</var> (<var>0 \leq i \leq N-1</var>).</p> <p>Snuke will perform the follow...
p02436
<h1>Queue</h1> <p> Queue is a container of elements that are inserted and deleted according to FIFO (First In First Out). </p> <p> For $n$ queues $Q_i$ ($i = 0, 1, ..., n-1$), perform a sequence of the following operations. </p> <ul> <li>enqueue($t$, $x$): Insert an integer $x$ to $Q_t$.</li> <li>front($t$): R...