question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p00899
<H1><font color="#000">Problem F: </font>City Merger</H1> <p> Recent improvements in information and communication technology have made it possible to provide municipal service to a wider area more quickly and with less costs. Stimulated by this, and probably for saving their not sufficient funds, mayors of many citi...
p00030
<H1>整数の和</H1> <p> 0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/> <br/> 1 + 2 + 3 = 6<br/> 0 + 1 + 5 = 6<br/> 0 + 2 + 4 = 6<br/> <br/> の 3 通りとなります。 </p...
p00460
<H1> ビンゴ</H1> <h2>問題</h2> <p> あるプログラミングコンテストでは,競技後の懇親会でビンゴゲームをする習わしがある.しかし,このビンゴゲームで使うビンゴカードは少々特殊で,以下の条件に従って作成される. </p> <ul> <li> ビンゴカードは N 行 N 列のマス目に区切られており,各マス目には正整数が1つずつ書かれている.それらの整数は全て異なる.</li> <li> マス目に書かれている整数は 1 以上 M 以下である.</li> <li> ビンゴカードに書かれているN×N個の整数の合計は S である.</li> <li> どの列を見たときも,上から下に...
p00175
<H1>4進数</H1> <p> 10 進数は現在使われている一般的な記数法で、0、1、2、3、4、5、6、7、8、9 の10 個の記号を用いて全ての数字を表します。 </p> <p> 2 進数はコンピュータの世界でよく使われる記数法で、0 と1 の二つの記号を用いて全ての数字を表します。 </p> <p> 4 進数で用いられるのは 0、1、2、3 の 4 つの数字だけです。4 進数では 0 から順に数を増やしていったときに 4 まで来たら次の位に桁上がりします。そのため、10 進数の 4 は桁上がりして「10」という表現になります。 </p> <center> <table> <tr> <td width="80...
p02148
<h1>Problem L: Tousa Tree</h1> <h2>Problem</h2> <p>君は一昨日、友人のトウサから一つ、頼み事をされた。なんでも、木に等差数列を飾って誕生日パーティーに使いたいのだが、木が大きすぎて一人ではとてもできないのだという。そこで、優秀なプログラマである君に、効率的に木に等差数列を飾るプログラムを書いてもらいたいそうだ。君とトウサは旧知の親友である。君はトウサの頼み事を受けることにした。</p> <p>飾り付けをする$N$ノードの木が与えられる。木のノードには$0$から$N-1$までの番号が振られている。最初、木のノードの点数は全て$0$である。プログラムは、以下の二つのクエリに対応しなけれ...
p00525
<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> 切り取り線(Cutting) </H1> <br...
p00876
<H1><font color="#000">Problem C:</font> Swimming Jam</H1> <p> Despite urging requests of the townspeople, the municipal office cannot afford to improve many of the apparently deficient city amenities under this recession. The city swimming pool is one of the typical examples. It has only two swimming lanes. The Muni...
p03759
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Three poles stand evenly spaced along a line. Their heights are <var>a</var>, <var>b</var> and <var>c</var> meters, from left to right. We will call the arrangement of the poles <em>beautiful</em> if th...
p01764
<h1>E : Sigma / Σ</h1> <h1>Problem</h1> <p>小学生のづあい君は同じ足し算にも得意不得意があり、 0 以上の整数 <em>X</em>, <em>Y</em> に対して、<em>X</em> + <em>Y</em> を計算するのにかかる時間(秒)が次のように決まる。</p> <ul> <li>1 の位から順番に計算していく。</li> <li>10 進数表記で 10<sup><em>i</em></sup> 位の計算には <em>x<sub>i</sub></em> × <em>y<sub>i</sub></em> + <em>c<sub>i</sub></em> 秒かかる。 <ul...
p03309
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has an integer sequence <var>A</var> of length <var>N</var>.</p> <p>He will freely choose an integer <var>b</var>. Here, he will get sad if <var>A_i</var> and <var>b+i</var> are far from each othe...
p01334
<h1><font color="#000">Problem B:</font> Let's JUMPSTYLE</h1> <h2>Description</h2> <p>踊りの好きなFは,とあるダンスホールでJUMPSTYLEと呼ばれるハードコアな踊りの練習をすることにした.</p> <p>フロアはN×Nの格子状にタイルが敷き詰められている. 踊りの練習をサポートするため,各タイルには次のステップに飛び移るべきタイルの座標が書かれている.Fは日々の練習によって強靭な運動神経を持っており,フロア内の任意のタイルへ飛び移ることができる.</p> <p>Fは,十分に長い時間この踊りを続けていけば,いつか定常状態に入り,同じル...
p01123
<!--<h2>Problem G</h2>--> <!-- begin en only --> <h3>Let's Move Tiles!</h3> <!-- end en only --> <!-- begin en only --> <p> You have a framed square board forming a grid of square cells. Each of the cells is either empty or with a square tile fitting in the cell engraved with a Roman character. You can tilt the boar...
p01573
<H1><font color="#000">Problem C:</font> Complex Integer Solutions</H1> <p> Let <i>f</i>(<i>x</i>) = <i>a</i><sub>0</sub> + <i>a</i><sub>1</sub><i>x</i> + <i>a</i><sub>2</sub><i>x</i><sup>2</sup> + ... + <i>a<sub>d</sub>x<sup>d</sup></i> be the function where each <i>a<sub>i</sub></i> (0 &le; <i>i</i> &le; <i>d</i>) ...
p01089
<h2>Deadlock Detection</h2> <p> In concurrent processing environments, a deadlock is an undesirable situation where two or more threads are mutually waiting for others to finish using some resources and cannot proceed further. Your task is to detect whether there is any possibility of deadlocks when multiple threads...
p00732
<h1><font color="#000000">Problem E:</font> Twirl Around</h1> <!-- begin en only --> <p> Let's think about a bar rotating clockwise as if it were a twirling baton moving on a planar surface surrounded by a polygonal wall (see Figure 1). </p> <!-- end en only --> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources...
p01820
<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> <h3>Problem B: Vector Field</h3> ...
p00362
<!--<H1>Network Charging System</H1>--> <h1>Charging System for Network</h1> <p> There is a network consisting of <var>N</var> machines (sequentially numbered from 0 to <var>N</var>-1) interconnected through <var>N</var>-1 bidirectional communication cables. Any two machines can perform bidirectional communication t...
p00698
<H1> Missing Numbers </H1> <P> Toshizo is the manager of a convenience store chain in Hakodate. Every day, each of the stores in his chain sends him a table of the products that they have sold. Toshizo's job is to compile these figures and calculate how much the stores have sold in total. </P> <P> The type of a t...
p00677
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1>Make KND So Fat</h1> <h2>Problem</h2> <p>KND君は会津大学に在籍する学生プログラマである。彼の隣人はとても迷惑なことで知られている。隣人は彼が甘党であることを知り、必要以上に甘味を差し入れて彼を太らせようと画策している。そのために、当の隣人であるあなたは友人からとある甘味処を紹介してもらった。</p> <p>しかし、その甘味処での商品の販売の仕方は少し変わっている。その販売方法とは、甘味セットと呼ばれる甘味の組を日替わりで販売するというものだ。予算内であればその日...
p01965
<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...
p03958
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>K</var> pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking <var>K</var> days to eat them all.</p> <p>There are <var>T</var> types of cake, and the number of the cak...
p00227
<H1>お客様大感謝祭</H1> <p> 悪天候が続き野菜の価格が高騰する中、セブンマートではお客様に野菜のまとめ買いセールを実施しています。 日ごろなかなか店頭に並ばない野菜もお手頃価格で手に入るとあって、 店内はとても賑わっています。 </p> <p> ある日、松長団地に住む仲良し 3 人組がセブンマートの広告を手に話に花を咲かせていました。今回のセールは「お客様大感謝祭」と銘打っただけに、袋詰めした野菜の中で最も安いものが無料になるのが目玉となっています。広告を読んでみると、どうやら以下のようなセールのようです。 </p> <ul> <li> 1 つの袋には <var>m</var> 個まで野菜...
p01066
<h1>Reflection Warp Machine</h1> <h2>Problem</h2> <p> とある宇宙では、2次元の格子点上に<var>n</var>個の星が存在し、宇宙人達はReflection Warp Machineを使い、星間を移動している。<br> この装置は、任意の位置、角度で直線を引くことができる。<br> この直線を対称軸として、現在いる座標から線対称の座標に移動することができる。<br> ただし、星が存在しない座標に移動することはできない。<br> 一度引いた直線は何度でも利用できる。<br> 現在、(<var>x<sub>0</sub></var>,<var>y<sub>0</sub></...
p01436
<script type="text/javascript" src="./varmath.js" charset="UTF-8"></script> <h2>問題文</h2> <p> <i>キュゥべえ</i>はなかなか契約を結んでくれない<i>鹿目まどか</i>にしびれを切らせて,ソウルジェムゲームと称して<i>佐倉杏子</i>と<i>美樹さやか</i>のソウルジェムの中身 (魂) を <var>W</var> 列 <var>H</var> 段のロッカーの中に隠してしまった.そこで,<i>まどか</i>は<i>杏子</i>と<i>さやか</i>を助け出したい.しかし,契約を結ばずに助けるにはロッカーボックスの壁を操作して <v...
p02133
<h1>Problem J: Matrix</h1> <h2>Problem</h2> <p> 長さ$H$の数列$A$と長さ$W$の数列$B$が与えられる。<br><br> $H$行$W$列からなる行列$C$を以下のように定義する。<br> $ C_{i,j} = A_i \times B_j (1 \leq i \leq H, 1 \leq j \leq W) $ <br><br> 以下の四種類のクエリを合計$Q$回処理せよ。<br> <br>クエリ1<br> $1$ $a$ $b$ $v$<br> $ A_i ( a \leq i \leq b) $に$v$を加える <br> <b...
p02099
<h1>Problem B: GPA JANKEN</h1> <h2>Problem</h2> <p> GPAとは「Galaxy Point of Aizu」の略で、0から4までの実数値を取る。<br> GPAじゃんけんは二人で行うゲームである。各々が「じゃんけん、ぽん(ほい)」の合図で互いにグー、チョキ、パーのどれか好きな手を出した後、GPAが高い人が勝者となり、低い人が敗者となる。同じ場合は引き分けとなる。 </p> <p> <var>N</var> 人のGPAのデータが与えられるので、総当たり戦をした時のそれぞれの勝ち点を出力せよ。<br> ただし、勝ち点は勝ちの時3、引き分けの時1、負けの時0とする。 </p> <p...
p02563
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integer arrays <var>a_0, a_1, ..., a_{N - 1}</var> and <var>b_0, b_1, ..., b_{M - 1}</var>. Calculate the array <var>c_0, c_1, ..., c_{(N - 1) + (M - 1)}</var>, defined by <var>c_i = \...
p02830
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are strings <var>s</var> and <var>t</var> of length <var>N</var> each, both consisting of lowercase English letters.</p> <p>Let us form a new string by alternating the characters of <var>S</var> a...
p03722
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a directed graph with <var>N</var> vertices and <var>M</var> edges. The <var>i</var>-th edge <var>(1≤i≤M)</var> points from vertex <var>a_i</var> to vertex <var>b_i</var>, and has a weight <var...
p03688
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> cats. We number them from <var>1</var> through <var>N</var>.</p> <p>Each of the cats wears a hat. Cat <var>i</var> says: "there are exactly <var>a_i</var> different colors among t...
p03372
<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...
p00948
<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 Distribution Center ...
p02975
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has <var>N</var> hats. The <var>i</var>-th hat has an integer <var>a_i</var> written on it.</p> <p>There are <var>N</var> camels standing in a circle. Snuke will put one of his hats on each of the...
p03667
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> balls in a row. Initially, the <var>i</var>-th ball from the left has the integer <var>A_i</var> written on it.</p> <p>When Snuke cast a spell, the following happens:</p> <ul> <l...
p03237
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><strong>Problem F and F2 are the same problem, but with different constraints and time limits.</strong></p> <p>We have a board divided into <var>N</var> horizontal rows and <var>N</var> vertical column...
p04008
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> towns in Snuke Kingdom, conveniently numbered <var>1</var> through <var>N</var>. Town <var>1</var> is the capital.</p> <p>Each town in the kingdom has a <em>Teleporter</em>, a fac...
p02076
<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: ...
p02426
<h1>Bit Mask</h1> <p> A state with $n$ flags of ON or OFF can be represented by a sequence of bits where $0, 1, ..., n-1$ th flag corresponds to 1 (ON) or 0 (OFF). The state can be managed by the corresponding decimal integer, because the sequence of bits is a binary representation where each bit is 0 or 1. </p>...
p02308
<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>Cross Points of a Circe and a Line</H1> <p>...
p00335
<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> あなたが勤めているパンケーキ屋では、細長い鉄板にパ...
p02758
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> robots numbered <var>1</var> to <var>N</var> placed on a number line. Robot <var>i</var> is placed at coordinate <var>X_i</var>. When activated, it will travel the distance of <va...
p00765
<h1>Generic Poker</h1> <!-- end en only --> <!-- begin en only --> <p> You have a deck of <i>N</i> &times; <i>M</i> cards. Each card in the deck has a rank. The range of ranks is 1 through <i>M</i>, and the deck includes <i>N</i> cards of each rank. </p> <!-- end en only --> <!-- begin en only --> <p> We denote a ca...
p01877
<h2>F: きっちり - Kitsuchiri -</h2> <h3>問題</h3> <p>若ヶ松高校二年へ組の合津千里(あつちり)さんは数列が「きっちり」していなければ気がすまない。</p> <p> 合津さんによると、「きっちり」した数列とは、長さが偶数で左右対称である数列のことである。 すなわち、長さ<var>N</var>(<var>N</var>は偶数)の数列<var>S</var>について、次の条件を満たせば数列<var>S</var>は「きっちり」している。 </p> <pre><var>S_1 = S_N, S_2 = S_{N &minus; 1},</var> ... <var>, S_{N/2} =...
p01524
<h1>E - じゃんけん</h1> <h2>問題文</h2> <p> E 君はじゃんけんが大好きである (ちなみにじゃんけんのルールについては<a href="http://ja.wikipedia.org/wiki/%E3%81%98%E3%82%83%E3%82%93%E3%81%91%E3%82%93">Wikipediaのじゃんけんのページ</a>を参照せよ). ある日,町内でじゃんけん大会があるということを知った E 君は,じゃんけんの腕に自信があったこともあり早速出場することにした. ところが大会当日,E 君を待ち受けていたのは,普通の「グー・チョキ・パー」のみからなる普通のじゃんけんではなく, より多くの手...
p03519
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two sequences <var>a</var> and <var>b</var>, both of length <var>2N</var>. The <var>i</var>-th elements in <var>a</var> and <var>b</var> are <var>a_i</var> and <var>b_i</var>, respectively...
p01174
<H1><font color="#000">Problem D:</font> Rotation Estimation</H1> <p> Mr. Nod is an astrologist and has defined a new constellation. He took two photos of the constellation to foretell a future of his friend. The constellation consists of <i>n</i> stars. The shape of the constellation in these photos are the same, bu...
p03149
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given four digits <var>N_1, N_2, N_3</var> and <var>N_4</var>. Determine if these can be arranged into the sequence of digits "<var>1974</var>".</p> </section> </div> <div class="part"> <section...
p01461
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>Multi-ending Story</H1> <p> You are a programmer who loves bishojo games (a sub-genre of dating simulation games). A game, which is titled &quot;I * C * P * C!&quot; and was released yesterday, has arrived to you just now. This game has multiple endings....
p01031
<h1>Problem D: Smell Searcher</h1> <h2>Problem</h2> <p> 廃津大学では強烈な香りを放つ<var>N</var>個の廃材が一列に並んでいます。 廃材には1から<var>N</var>の番号が順番にふられていて、<var>i</var>番目の廃材は強さ<var>a<sub>i</sub></var>の香りを放っています。 </p> <p> リヒト君は仕事で、すべての廃材の放つ香りの総和を求めるよう依頼されました。 香りの総和が<var>M</var>以上になると「大変きつい仕事」とみなされ特別支給金がもらえます。 </p> <p> この仕事を行うために、リヒト君は精度<...
p00270
<H1>鉄道路線</H1> <p> ある国の鉄道網に、自動改札を導入することになりました。導入にあたって難しい問題の一つは、与えられた切符で、指定された駅の間を移動できるかどうかを判定することです。それぞれの切符には乗車駅と降車駅が記載されています。この切符でできるのは、「乗車駅で乗って、降車駅で降りる」ことだけではなく、途中乗車や途中下車も許されています。 </p> <p> この鉄道網にはS 個の駅があり、そのうちR 組の駅は隣り合っていて、他の駅を経由せずに双方向に鉄道で移動することができます。隣り合った駅を結ぶ線路はひとつしかありません。隣り合った駅の間の距離は、この線路に沿って測った距離です。ある駅からある駅までの...
p01898
<link rel="stylesheet" href="css/description.css" type="text/css" /> <script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script> <h2>A: 席取り - Taking a Seat -</h2> <h3>物語</h3> <p> A君はある試験を受けるために試験会場の教室に入った。 ただ、A君はとても神経質なタイプだ。 そのため、状況によってA君が座りたくない席がもしかしたらあるかもしれない。 そこで、A君はある条件を...
p00620
<H1><font color="#000000">Problem F:</font> Line Puzzle</H1> <p> プログラミングでパズルを解いてみよう。 </p> <p> <i>n</i> &times; <i>n</i> の数字が格子状に並んでいる。数字のいくつかは丸で囲まれており、これらを起点と呼ぶことにする。パズルのルールは以下のとおりである: </p> <ul> <li>各起点から縦・横に進む1本の線を引く(斜めには引けない)。</li> <li>通った数字の和が起点の数字と同じになるように線を伸ばす。</li> <li>線は枝分かれしてはいけない。</li> <li>線はすでに引かれた数字を通る...
p01932
<!-- - - - - - 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...
p03325
<span class="lang-en"> <p>Score: <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length <var>N</var>, <var>a = </var>{<var>a_1, a_2, a_3, ..., a_N</var>}.<br/> Snuke, an empl...
p01318
<h1><font color="#000">Problem E:</font> Immortal Jewels</h1> <!-- <h3><U>不死の宝石</U></h3> --> <p>English text is not available in this practice contest.</p> <p>ある時ある貴族が,ある貧乏な国のおてんばで勇敢なお姫様に惚れ込み結婚を申し込んだ.お姫様は貴族にある条件を出した.その条件とは「不死の宝石」と呼ばれている宝石を大量に持ってくることであった.不死の宝石は,ある山の特定の場所でしか取ることができない非常に希少な宝石である.しかも大変壊れやすいため,採取するには特別...
p02867
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are two integer sequences of <var>N</var> elements each: <var>A_1,...,A_N</var> and <var>B_1,...,B_N</var>. Determine if it is possible to do the following operation at most <var>N-2</var> times (...
p03775
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>N</var>.<br/> For two positive integers <var>A</var> and <var>B</var>, we will define <var>F(A,B)</var> as the larger of the following: the number of digits in the decimal ...
p01748
<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> <p> <var>n</var> 個の都市と <var>n ...
p00509
<H1>問題5</H1> <br/> <p>  J中学校の運動会で次のようなクラス対抗の競技を行なうことになった. 各クラスから生徒代表の男女 n ペア<br/> <br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   (男子生徒 b<SUB>1</SUB>, 女子生徒 g<SUB>1</SUB>), (男子生徒 b<SUB>2</SUB>, 女子生徒 g<SUB>2</SUB>), … , (男子生徒 b<SUB>n</SUB>, 女子生徒 g<SUB>n</SUB>) <br/> <br/> を選び, 0 から 9 までの数字が書かれた旗を自由に選んでもらい (それぞれの旗は十分な個数ある), 横...
p02534
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>K</var>. Print the string obtained by repeating the string <code>ACL</code> <var>K</var> times and concatenating them.</p> <p>For example, if <var>K = 3</var>, print <code>...
p00159
<H1>理想の体型</H1> <p> 肥満度を表す指数としてBMI(Body Mass Index)があります。BMIの値は以下の式で計算します。 </p> <center> <p> BMI = 体重(kg) / (身長(m))<sup>2</sup> </p> </center> <p> BMIの値が標準値に近いほど「理想の体型」と考えられます。そこで、BMIの標準値を 22 とした場合、対象者の情報を入力とし、最も「理想の体型」に近い人の情報を出力するプログラムを作成してください。 </p> <p> 対象者の数を <var>n</var> とすると、各対象者には重複のないように1 以上 <var>n</var> 以...
p02164
<h1>Problem C: Satake likes straight</h1> <h2>Problem</h2> <p> Satake君は曲がったことが嫌いです。<br/> 例えば、鉛筆や箸、家が曲がった形をしているのは嫌いですし、右折や左折などの行動をとることも嫌いです。 </p> <p> さて、XY 平面上で暮らすSatake君は $N$ 個のお店 $(X_{1},Y_{1}),(X_{2},Y_{2}), \ldots , (X_{N},Y_{N})$ で買い物をするようお使いを頼まれました。座標 $(0, 0)$ にある家から $(1, 0)$ の方向を向いた状態で出発し、すべてのお店で買い物をしたあと、家に帰ります...
p02471
<H1>Extended Euclid Algorithm</H2> <br/> <p> Given positive integers <var>a</var> and <var>b</var>, find the integer solution (<var>x</var>, <var>y</var>) to <var>ax + by = gcd(a, b)</var>, where <var>gcd(a, b)</var> is the greatest common divisor of <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <pre> <var>a</...
p02021
<h2>G: 労働 (Working)</h2> <p>コウさんはこれから $N$ 日間、毎日<b>同じ件数の</b>仕事をすることにした。</p> <p>$N$ 日間のうち $i$ 日目には仕事が $A_i$ 件追加される。</p> <p>コウさんには今溜まっている仕事はなく、$N$ 日目までにすべての仕事が終わっている必要はない。</p> <p>一日で最大何件の仕事ができるか。</p> <p>ただしコウさんは優秀なので、仕事が存在する限り何件でも仕事をすることができる。</p> <h3>入力</h3> <p>1 行目には $N$が与えられる。</p> <p>2 行目には $N$ 個の整数 $A_1, A_2, A_3, \d...
p02888
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has <var>N</var> sticks that are distinguishable from each other. The length of the <var>i</var>-th stick is <var>L_i</var>.</p> <p>He is going to form a triangle using three of these sticks. ...
p03260
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given integers <var>A</var> and <var>B</var>, each between <var>1</var> and <var>3</var> (inclusive).</p> <p>Determine if there is an integer <var>C</var> between <var>1</var> and <var>3</var> (...
p02922
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi's house has only one socket.</p> <p>Takahashi wants to extend it with some number of power strips, each with <var>A</var> sockets, into <var>B</var> or more empty sockets.</p> <p>One power str...
p03630
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a board with an <var>H \times W</var> grid. Each square in the grid is painted in black or white. The square at the <var>i</var>-th row from the top and <var>j</var>-th column from the left is b...
p01162
<H1><font color="#000">Problem I:</font> The Extreme Slalom</H1> <p> Automobile Company Moving has developed a new ride for switchbacks. The most impressive feature of this machine is its mobility that we can move and turn to any direction at the same speed. </p> <p> As the promotion of the ride, the company started ...
p01498
<H1><font color="#000">Problem D: </font>King Slime</H1> <p> There is a grid of size <i>W</i> &times; <i>H</i> surrounded by walls. Some cells in the grid are occupied by slimes. The slimes want to unite with each other and become a "King Slime". </p> <p> In each move, a slime can move to east, west, south and north...
p01532
<h1> Problem B War II</h1> <h2> 第二次ProblemB大戦</h2> <p> R大学の2D好きの人たち (2DRespecters)は,A津大学で開催されるプログラミングの練習合宿に参加する. この練習合宿では,参加者たちが自作のプログラミング問題を持ち寄り,練習に用いる. 今年は,2DRespectersの面々は手軽に作問できるB問題の作問担当者に立候補したため,B問題担当者の座を争うことになった. </p> <p> 戦いの舞台は,とある自販機である. この自販機は,90円のジュースを1種類だけ販売しており,お手頃価格で購入できることで有名である. ただし,自販機には,10円玉と100円玉の2つ...
p01861
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>D: みゃんぱすーれつ - Myampus Sequence -</h2> <h3>物語</h3> <p> みゃんぱすー. ウチ,田舎の分校に通う小学一年生なん. </p> <p> あんなー,今日の授業はプログラミングだったん. みんな苦戦してたけど,まっつんのにぃにぃ,凄い勢いでタイピングしてたん. さすが中三なんなー. </p> <p> にぃにぃ,プログラムが完成してどこか行ってしまったん. そんで...
p00773
<h3>Tax Rate Changed</h3> <p> VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. </p> <p> Our store uses the following rules to calculate the after-tax prices. </p> <ul> <li> When the VAT rate is <i>x</i>%, for an item with the before-tax price of <i>p...
p00289
<h1>アカ・ベコ捕獲作戦</h1> <p> 怪盗アカ・ベコは大胆にも、ツルガジョーから銀のシャチホコを盗み去った。警部であるあなたは、アカ・ベコが仲間のコボウ氏にシャチホコを渡すらしいという情報を手に入れた。ただ、コボウ氏はアカ・ベコのアジトまで出向けないので、アジトの外で渡すらしい。あなたはアカ・ベコを待ち伏せして捕まえることにした。この町は古い城下町なので、道が複雑に入り組んでいて、どの道も一方通行になっている。アカ・ベコがアジトから受け渡し場所までどの経路を通るのかはわからないが、人員不足のため、待ち伏せ場所は1つに設定しなければならない。 </p> <p> あなたは、アジトを含むいくつかの地点を選び、それらをつな...
p00323
<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> 会津特産の貴金属であるアイヅニウムをリサイク...
p03919
<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> ...
p01924
<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> <h3>海岸線</h3> <p>海岸には毎秒波が押し寄せる...
p00636
<H1><font color="#000000">Problem 10:</font> The Last Dungeon</H1> <p> 勇者ポン太はいよいよ最終ダンジョンの目前までやってきた。ここは、悪の帝王ボロモスの砦の前に広がる闇の荒野であり、かなり強者のモンスターが、それぞれの縄張りを守っている。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_lastDangion1"><br> <p>図1:荒野</p> </center> <p> 荒野は図1に示すように、南西を原点(0, 0)とした 4 &times...
p00266
<H1>イヅア国語辞典</H1> <p> あなたはイヅア国の公用語であるイヅア語の国語辞典と、イヅア語のアルファベット(文字の一覧表) を手に入れました。イヅア語のアルファベットにはN 種類の文字があります。イヅア語の国語辞典に現れる単語の順番は、イヅア語のアルファベット順に並んでいます。 </p> <p> 辞典を見ると、載っているどの単語もN 文字で、しかも、N 種類の文字をひとつずつ含んでいることがわかりました。さらに調べてみると、辞典にはN 種類の文字の可能な並び方がすべて書かれていることを発見しました。 </p> <p> この発見から、あなたはある単語が辞典の何番目に出てくるかわかるようになりました。この知識を利...
p01027
<h1>Problem L: WW</h1> <h2>Problem</h2> <p> 19XX年、nつの国で連合国軍が結成された。連合国軍に属する各国では、敵軍の侵略から自国を守るために国内に1つ以上の拠点を作り、周囲を警戒している。図1は連合国の例を示し、長方形が各国を、その中にある円がその国の拠点を表す。 </p> <br> <center> <img width="680" src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_RitsCamp14Day2_WW1.png" alt="図1"><br> 図1 </center> <br> <p> 敵軍が侵略...
p01477
<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...
p02172
<h1>Problem K: Gold Rush</h1> <h2>Problem</h2> <p> moritaoy君とは、コンピュータのなかで暮らしている謎の大学生です。<br> moritaoy君が暮らしている区画は、縦に $2^H$ 、横に $2^W$ 、の大きさのある二次元空間 $S= \{ (p,q) \in \mathbb{Z}^2 | 0 \leq p \lt 2^H, 0 \leq q \lt 2^W \} $ として表されます。<br> moritaoy君はいくつかの非負整数を要素とする二次元ベクトルを持っていて、この空間上を足し算を用いて移動します。<br> moritaoy君が $(a,b...
p03299
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let us consider a grid of squares with <var>10^9</var> rows and <var>N</var> columns. Let <var>(i, j)</var> be the square at the <var>i</var>-th column <var>(1 \leq i \leq N)</var> from the left and <v...
p03763
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string.</p> <p>He will receive a headline which contains one of the strings <var>S_1,......
p02871
<span class="lang-en"> <div class="part"> <section> <h3>Problem Setting</h3></section> </div> <div class="part"> <section> <h3>Overview</h3> <ul> <li><strong>Concept:</strong> In this programming contest, you will run a delivery service. Customers will place orders with your shop. Each order has a unique <var>\text{ID}...
p03333
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi and Aoki will play a game with a number line and some segments. Takahashi is standing on the number line and he is initially at coordinate <var>0</var>. Aoki has <var>N</var> segments. The <va...
p03626
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a board with a <var>2 \times N</var> grid. Snuke covered the board with <var>N</var> dominoes without overlaps. Here, a domino can cover a <var>1 \times 2</var> or <var>2 \times 1</var> square.<...
p02934
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a sequence of <var>N</var> integers <var>A_1, \ldots, A_N</var>.</p> <p>Find the (multiplicative) inverse of the sum of the inverses of these numbers, <var>\frac{1}{\frac{1}{A_1} + \ldots + \fr...
p00909
<H1><font color="#000">Problem F: </font>Never Wait for Weights</H1> <p> In a laboratory, an assistant, Nathan Wada, is measuring weight differences between sample pieces pair by pair. He is using a balance because it can more precisely measure the weight difference between two samples than a spring scale when the sa...
p03276
<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> candles placed on a number line. The <var>i</var>-th candle from the left is placed on coordinate <var>x_i</var>. Here, <var>x_1 &lt; x_2 &lt; ... &lt; x_N</var> holds.</p> <p>Ini...
p04049
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given an undirected tree, let the distance between vertices <var>u</var> and <var>v</var> be the number of edges on the simple path from <var>u</var> to <var>v</var>. The diameter of a tree is the maxim...
p02037
<h1>A: タイル貼り</h1> <h2>問題</h2> <p> 縦 $h$ , 横 $w$ の大きさの長方形の壁に, 縦 $a$ , 横 $b$ の大きさの長方形のタイルを出来るだけたくさん貼りたい. </p> <p> タイルを貼る際は以下の条件を満たす必要がある.<br> <ul> <li>タイルを重ねてはいけない.</li> <li>タイルを斜めに貼ってはいけない. すなわち, タイルのどの縁も, 壁のどの縁に対しても平行, または垂直である.</li> <li>タイルの向きを変えない. すなわち, 縦横を入れ替えない.</li> </ul> </p...
p02467
<H1>Prime Factorization</H1> <br/> <p> Factorize a given integer <var>n</var>. </p> <H2>Input</H2> <pre> <var>n</var> </pre> <p> An integer <var>n</var> is given in a line. </p> <H2>Output</H2> <p> Print the given integer <var>n</var> and <span>:</span>. Then, print prime factors in ascending order. If <var>n</v...
p00374
<H1>Iron Bars</H1> <p> A boy PCK had <var>N</var> straight iron bars, which were serially indexed. Unfortunately, the first <var>M</var> bars (0 &le; <var>M</var> &le; <var>N</var>) among them were bent during transportation. They all suffered a perpendicular bend at one point. </p> <p> He is planning to make a cub...
p02349
<H1>Range Add Query (RAQ)</H1> <p> Write a program which manipulates a sequence <var>A</var> = {<var>a<sub>1</sub>, a<sub>2</sub>, . . . , a<sub>n</sub></var>} with the following operations: </p> <ul> <li><var>add(s, t, x)</var>: add <var>x</var> to <var>a<sub>s</sub></var>, <var>a<sub>s+1</sub></var>, ..., <var>...
p01836
<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>Shortest Bridge</h2> <p> Ther...
p00724
<h1><font color="#000">Problem C:</font> Hexerpents of Hexwamp</h1> <!-- end en only --> <p> Hexwamp is a strange swamp, paved with regular hexagonal dimples. Hexerpents crawling in this area are serpents adapted to the environment, consisting of a chain of regular hexagonal sections. Each section fits in one dimpl...
p02719
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given any integer <var>x</var>, Aoki can do the operation below.</p> <p>Operation: Replace <var>x</var> with the absolute difference of <var>x</var> and <var>K</var>.</p> <p>You are given the initial va...
p03558
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Find the smallest possible sum of the digits in the decimal notation of a positive multiple of <var>K</var>.</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>2 \leq K...
p01565
<h1>Move On Dice</h1> <p>There is a cube on a rectangle map with <var>H</var>-rows and <var>W</var>-columns grid. Two special squares a start and a goal are marked on the map. Initially, the cube is on the start square. Let's repeat to roll it and take it to the goal square. Rolling the cube means to select one of ...