question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p02654
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> lamps numbered <var>1</var> to <var>N</var>, and <var>N</var> buttons numbered <var>1</var> to <var>N</var>. Initially, Lamp <var>1, 2, \cdots, A</var> are on, and the other lamps ...
p00669
<h1>Problem A: K Cards</h1> <p> ある日、先生は次のようなゲームを思いついた。<br> ゲームは 1 から 10 までの数がひとつ書かれたカードを n 枚使用し、以下のように進む。<br> </p> <ol> <li>先生が n 枚のカードを数が見えるようにして横一列に黒板に貼り付け、ある整数 k (k &ge; 1) を生徒に宣言する。横一列に並べられた n 枚のカードについて、連続した k 枚のカードの積の最大値を C<sub>k</sub> とする。また、先生が並べた時点での C<sub>k</sub> を C<sub>k</sub>' とおく。</li> <li>生徒は 1. で貼られたカー...
p03946
<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...
p00393
<h1>Beautiful Sequence</h1> <p> Alice is spending his time on an independent study to apply to the Nationwide Mathematics Contest. This year’s theme is "Beautiful Sequence." As Alice is interested in the working of computers, she wants to create a beautiful sequence using only 0 and 1. She defines a "Beautiful" sequenc...
p02204
<h2>コンテストTシャツ (Contest T-shirts)</h2> <p>Segtree 君は、 $M$ 枚のコンテストTシャツを持っています。</p> <p>彼は今から $N$ 日間、コンテストTシャツだけで過ごそうと考え、$i = 1, 2, 3, \dots, N$ に対して「 $i$ 日目に $A_i$ 枚目のTシャツを着る」という $N$ 個の計画を立てました。</p> <p>しかし、今の計画のままだと洗濯が間に合わない可能性があるので、必要に応じて計画を変更し、2日連続で同じ服を着ないようにしたいです。</p> <p>変更する必要のある計画の個数の最小値を求めてください。なお、与えられた制約の元で、計画の変更によ...
p00239
<H1>カロリー計算</H1> <!-- <p> 天高く馬肥ゆる秋。そろそろ食べ物が美味しくなる季節です。高校生のよしお君 も、テレビや読書のお供についついお菓子に手が伸びてしまいます。そのせいか最近体重は増える一方で、健康的にもよろしくありません。しかしどうしても直ぐに間食がやめられないよしお君は、お菓子の栄養素やカロリーが制限された場合に、食べたいお菓子を、食べてもよいお菓子と食べてはいけないお菓子に分類することにしました。 </p> --> <p> 食べ物には3大栄養素と呼ばれる「たんぱく質」「脂質」「炭水化物」の3つの栄養素が含まれています。1g(グラム)あたりたんぱく質と炭水化物は 4 kcal(キロカロリー)、脂...
p01078
<h1>Problem G: Star</h1> <h2>Problem</h2> <p> 半径1の円に内接する正<var>N</var>/<var>K</var>角形の面積を求めよ。 </p> <p> ただし、正<var>N</var>/<var>K</var>角形を 「円周上に等間隔に<var>N</var>個の点を取り、 <var>K</var>-1個おきにそれぞれの点を結んだ一番外側の図形」 と定義する。 </p> <p> 例えば、5/2角形は次のように描くことができる。 まず、半径1の円周上に等間隔に5つの点を取る。<br /><br/> <img src="https://judgeapi.u-ai...
p03045
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> cards placed face down in a row. On each card, an integer <var>1</var> or <var>2</var> is written.</p> <p>Let <var>A_i</var> be the integer written on the <var>i</var>-th card.</p...
p01582
<H1><font color="#000">Problem B:</font> Cover Time</H1> <p> Let <i>G</i> be a connected undirected graph where <i>N</i> vertices of <i>G</i> are labeled by numbers from 1 to <i>N</i>. <i>G</i> is simple, i.e. <i>G</i> has no self loops or parallel edges. </p> <p> Let <i>P</i> be a particle walking on vertices of <i...
p01428
<script type="text/javascript" src="./varmath.js" charset="UTF-8"></script> <h2>問題文</h2> <p> お菓子の魔女 CHARLOTTE は<i>巴マミ</i>とクッキーゲームを楽しんでいる.クッキーゲームは <var>8\times 8</var> の格子状に区切られたテーブルクロスの上にチーズクッキーとチョコレートクッキーを置いて行われる.各格子には高々 <var>1</var> 個のチョコレートクッキーまたはチーズクッキーしか置くことはできない. </p> <p> お菓子の魔女はチーズクッキーを,<i>巴マミ</i>はチョコレートクッキーを交...
p03415
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a <var>3×3</var> square grid, where each square contains a lowercase English letters. The letter in the square at the <var>i</var>-th row from the top and <var>j</var>-th column from the left is...
p03100
<span class="lang-en"> <p>Score : <var>2000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a connected graph with <var>N</var> vertices and <var>M</var> edges. The vertices are numbered <var>1</var> to <var>N</var>. The <var>i</var>-th edge is an undirected edge of length <var>...
p01097
<h3>3D Printing</h3> <p> We are designing an installation art piece consisting of a number of cubes with 3D printing technology for submitting one to Installation art Contest with Printed Cubes (ICPC). At this time, we are trying to model a piece consisting of exactly <i>k</i> cubes of the same size facing the same...
p03550
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a deck consisting of <var>N</var> cards. Each card has an integer written on it. The integer on the <var>i</var>-th card from the top is <var>a_i</var>.</p> <p>Two people X and Y will play a gam...
p02711
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a three-digit integer <var>N</var>. Does <var>N</var> contain the digit <var>7</var>?</p> <p>If so, print <code>Yes</code>; otherwise, print <code>No</code>.</p> </section> </div> <div class="p...
p03803
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Alice and Bob are playing <em>One Card Poker</em>.<br/> One Card Poker is a two-player game using playing cards. </p> <p>Each card in this game shows an integer between <code>1</code> and <code>13</cod...
p00686
<h1> Where's Your Robot?</h1> <p> You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are <i>m</i> columns of tiles from west to east, and <i>n</i> rows of tiles from south to north (1 <= <i>m, n</i> <= 100). Each tile is given a pair of coord...
p01994
<h2>F: 01 文字列と窓 (Binary String with Slit)</h2> <h3>問題</h3> <p>文字の種類が <var>0</var> と <var>1</var> のみからなる文字列 <var>S</var> が与えられます。以下の操作を繰り返すことで、<var>S</var> を <var>T</var> に変えたいです。</p> <ul> <li> 文字列 <var>S</var> 中の最も右側に登場する <var>1</var> を含むように、幅 <var>2</var> のスリットを置く。スリット内には連続した <var>2</var> 文字を必ず含まなければならない。つまり、文字列の端 <v...
p02341
<!--<h1>写像12相 その11:ボールに区別なし・箱に区別なし・箱の中身は1つ以下</h1>--> <h1>Balls and Boxes 11</h1> <table border=""> <tr><th>Balls</th><th>Boxes</th><th>Any way</th><th>At most one ball</th><th>At least one ball</th></tr> <tr><th>Distinguishable</th><th>Distinguishable</th><td>1</td><td>2</td><td>3</td></tr> <tr><th>Indistinguish...
p03383
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is an <var>H \times W</var> grid (<var>H</var> vertical, <var>W</var> horizontal), where each square contains a lowercase English letter. Specifically, the letter in the square at the <var>i</var>...
p00956
<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 K Black and White Boxe...
p03679
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most <var>X</var> days earlier. He gets a stomachache if the "best-by" date of the food is <v...
p01644
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [['\\(','\\)']] } }); </script> <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> <h1 class="ndoc-heading1">Problem K: Collector</h1> <p class="ndoc-to...
p04016
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For integers <var>b (b \geq 2)</var> and <var>n (n \geq 1)</var>, let the function <var>f(b,n)</var> be defined as follows:</p> <ul> <li><var>f(b,n) = n</var>, when <var>n &lt; b</var></li> <li><var>f(b...
p03229
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given <var>N</var> integers; the <var>i</var>-th of them is <var>A_i</var>. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers...
p01214
<H1><font color="#000">Problem H:</font> Petoris</H1> <p> You are playing a puzzle game named <i>petoris</i>. It is played with a board divided into square grids and square tiles each of which fits to a single grid. </p> <p> In each step of the game, you have a board partially filled with tiles. You also have a block...
p02592
<span class="lang-en"> <p>Score : <var>1800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>This is an output-only problem. You shouldn't read anything from the input.</p> <p>In short, your task is to simulate multiplication by using only comparison <var>(x &lt; y)</var> and addition <var>(x ...
p00055
<H1>数列</H1> <p> 次のように定義されている数列があります。 </p> <ul> <li>すべての偶数番目の項は一つ前の項に 2 を掛けたものと等しい数である。</li> <li>すべての奇数番目の項は一つ前の項を 3 で割ったものと等しい数である。</li> </ul> <p> この数列の初項 <var>a</var> を読み込み、初項から第 10 項までの和 <var>s(10)</var> を出力するプログラムを作成してください。 </p> <H2>Input</H2> <p> 入力は複数のテストケースからなります。各テストケースとして、数列の初項を表す実数 <var>a</var> (1.0 &...
p02068
<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: ...
p00405
<h1>アカベコ20</h1>   <p> 「アカベコ20」は、イヅア地方の専用劇場で公演を開催しているグループです。アカベコ20のそれぞれのメンバーは、ある一定の日数ごとに公演に参加することになっています。 </p> <p> 今日の公演ではメンバーが全員参加していました。プロデューサーであるあなたは、メンバーから、今後の公演のメンバーの組み合わせを教えてほしい、と頼まれました。あなたは、公演に参加するメンバーの組み合わせがいくつあるのかを数えることにしました。 </p> <p> アカベコ20のメンバー数と、それぞれのメンバーが公演に参加する周期が1日単位で与えられたとき、参加するメンバーの組み合わせが何通りあるかを数えるプログラム...
p02438
<h1>Splice</h1> <p> For $n$ lists $L_i$ $(i = 0, 1, ..., n-1)$, perform a sequence of the following operations. </p> <ul> <li>insert($t$, $x$): Insert an integer $x$ at the end of $L_t$.</li> <li>dump($t$): Print all elements in $L_t$.</li> <li>splice($s$, $t$): Transfer elements of $L_s$ to the end of $L_t$. ...
p00110
<H1>覆面算</H1> <p> 数式の一部を隠してしまって、隠した数字を探す問題を覆面算といいます。今回は、数式の中のある数字のいくつかを X で隠してしまった式を扱います。以下の数式を入力して、結果を出力するプログラムを作成してください。 </p> <p> 数式</p> <ul> <li>「数字列 + 数字列 = 数字列」の形で、1 行の単純な足し算式です。</li> <li> 「数字列」は、数字 0 から 9 と文字 X の並びです。</li> <!--<li> 「数字列」は、8 桁以下の整数を表すものとします。</li>--> <li> 2 桁以上の「数字列」の左端の数字は 0 ではないものとします。</li>...
p00540
<h2>舞踏会 (Ball)</h2> <p> IOI 王国では,王女である JOI 姫の誕生日を祝って舞踏会が開かれることになった. </p> <p> 舞踏会には <var>N</var> 人の貴族が参加する予定である.<var>N</var> は奇数である.貴族には 1 から <var>N</var> までの番号が付けられている.それぞれの貴族には踊りのうまさという整数が定められており,貴族 <var>i</var> (1 &le; <var>i</var> &le; <var>N</var>) の踊りのうまさは <var>D<sub>i</sub></var> である. </p> <p> 舞踏会では JOI 姫を含...
p02087
<h1>J: 左崎・右男</h1> <h2>問題文</h2> <p>左崎さんと右男さんは、長さ $N$ の数列 $a_1, a_2, \dots ,a_n$ を使ったゲームで遊ぶのが好きです。 このゲームでは左崎さんと右男さんで交互に以下の操作を行います。</p> <ul> <li>左崎さんの手番では $1 \leq k \leq n$ を指定し、$a_1, a_2, \dots ,a_k$ の値をそれぞれ $1$ ずつ減らす。</li> <li>右男さんの手番では $1 \leq k \leq n$ を指定し、$a_k, a_{k+1}, \dots ,a_n$ の値をそれぞれ $1$ ずつ減らす。</li> </ul> <p>...
p00813
<H1><font color="#000">Problem C:</font> GIGA Universe Cup</H1> <p> Following FIFA World Cup, a larger competition called ``GIGA Universe Cup'' is taking place somewhere in our universe. Both FIFA World Cup and GIGA Universe Cup are two rounds competitions that consist of the first round, also known as ``group league,...
p01701
<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> <meta http-equiv="X-UA-Compatibl...
p01351
<H1>Problem C: Usagitobi</H1> <p> <i>m</i> &times; <i>n</i> マスの盤がある. <i>i</i> 行<i>j</i> 列のマスを(<i>i</i>, <i>j</i>) (0 &le; <i>i</i> &lt; <i>m</i>, 0 &le; <i>j</i> &lt; <i>n</i>) で表す. </p> <p> うさぎは(<i>x</i>, <i>y</i>) にいるとき, ((<i>x</i> + <i>a</i>) mod <i>m</i>, (<i>y</i> + <i>b</i>) mod <i>n</i>) または((<i>x</i> + <i>...
p02984
<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> mountains in a circle, called Mountain <var>1</var>, Mountain <var>2</var>, <var>...</var>, Mountain <var>N</var> in clockwise order. <var>N</var> is an <em>odd</em> number.</p> <...
p03696
<span class="lang-en"> <p>Score : <var>400</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> consisting of <code>(</code> and <code>)</code>. Your task is to insert some number of <code>(</code> and <code>)</code> into <var>S</var> to o...
p01185
<H1><font color="#000">Problem E:</font> Hide-and-seek</H1> <p> <i>Hide-and-seek</i> is a children’s game. Players hide here and there, and one player called <i>it</i> tries to find all the other players. </p> <p> Now you played <i>it</i> and found all the players, so it’s turn to hide from <i>it</i>. Since you have ...
p03442
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a tree with <var>N</var> vertices. The vertices are numbered <var>0</var> through <var>N-1</var>, and the edges are numbered <var>1</var> through <var>N-1</var>. Edge <var>i</var> connect...
p03012
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> weights indexed <var>1</var> to <var>N</var>. The mass of the weight indexed <var>i</var> is <var>W_i</var>.</p> <p>We will divide these weights into two groups: the weights with i...
p00794
<H1><font color="#000">Problem G:</font> Walking Ant</H1> <p> Ants are quite diligent. They sometimes build their nests beneath flagstones. </p> <p> Here, an ant is walking in a rectangular area tiled with square flagstones, seeking the only hole leading to her nest. </p> <center> <img src="https://judgeapi.u-aizu....
p01886
<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>Share the Ruins Preservation</...
p02253
<h1>Activity Selection Problem</h1> <p>There are $n$ acitivities with start times $\{s_i\}$ and finish times $\{t_i\}$. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be performed by a single person.</p> <h2>Input</h2> <pre> $n$ $s_1$ $t_1$ $s_2$ $...
p02603
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>To become a millionaire, M-kun has decided to make money by trading in the next <var>N</var> days. Currently, he has <var>1000</var> yen and no stocks - only one kind of stock is issued in the country w...
p03911
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>On a planet far, far away, <var>M</var> languages are spoken. They are conveniently numbered <var>1</var> through <var>M</var>.</p> <p>For <em>CODE FESTIVAL 20XX</em> held on this planet, <var>N</var> p...
p02316
<H1>Knapsack Problem</H1> <br/> <p> You have <var>N</var> kinds of items that you want to put them into a knapsack. Item <var>i</var> has value <var>v<sub>i</sub></var> and weight <var>w<sub>i</sub></var>. </p> <p> You want to find a subset of items to put such that: </p> <ul> <li>The total value of the items is as l...
p02746
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For a non-negative integer <var>K</var>, we define a fractal of level <var>K</var> as follows:</p> <ul> <li>A fractal of level <var>0</var> is a grid with just one white square.</li> <li>When <var>K &gt...
p01869
<!-- - - - - - 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>E: 28<...
p03854
<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> consisting of lowercase English letters. Another string <var>T</var> is initially empty. Determine whether it is possible to obtain <var>S = T</var> by performing the...
p00281
<h2>親方の給料計算</h2> <p> ワシはパイプつなぎ組合の親方じゃ。職人を工事現場に派遣し、現場でパイプをつながせておる。去年は工事が増えて大儲けするかと思ったのじゃが、ちょっと給料の出し方がまずくてのぅ。ウチとしては大赤字になってしまったのじゃよ…。そこで、今年は職人たちへの給料の出し方を工夫したいのじゃ。 </p> <p> 職人たちの給料は、工事の種類とこなした回数で決めておる。つまり、<br> 職人の給料 = 種類 1 の単価 &times; 種類 1 をこなした回数<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&...
p03507
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In your garden, there is a long and narrow flowerbed that stretches infinitely to the east. You have decided to plant <var>N</var> kinds of flowers in this empty flowerbed. For convenience, we will call...
p03157
<span class="lang-en"> <p>Score : <var>300</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, where each square is painted black or white.</p> <p>You are given <var>H</var> strings <var>S_1, S_2, ..., S_H</var>, each of length <var...
p01490
<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 E: HullMarathon </h2>...
p00452
<H1>ダーツ </H1> <h2>問題</h2> <p> あなたは以下のルールでダーツゲームをすることになった. </p> <p> あなたは,矢を的(まと)に向かって 4 本まで投げることができる.必ずしも 4 本全てを投げる必要はなく,1 本も投げなくてもかまわない.的は N 個の部分に区切られていて,各々の部分に点数 P<sub>1</sub>,..., P<sub>N</sub> が書か れている.矢が刺さった場所の点数の合計 S があなたの得点の基礎となる.S があらかじめ決められたある点数 M 以下の場合は S がそのままあなたの得点となる.しかし,S が M を超えた場合はあなたの得点は 0 点となる...
p02195
<h2>Bichrome Tree Connectivity</h2> <p>木が与えられます。</p> <p>はじめ、すべての頂点は白いです。</p> <p>白い頂点の色を反転すると黒になり、黒い頂点の色を反転すると白になります。</p> <p>二種類のクエリを処理してください。</p> <p>一種類目のクエリでは、頂点<var>v</var>の色を反転します。</p> <p>二種類目のクエリでは、白い頂点<var>v</var>から白い頂点とそれらを結ぶ辺だけを使ってたどり着ける頂点の個数を答えます。</p> <h3>入力</h3> <pre> <var>N Q</var> <var>a_1 b_1</var> <var>a_...
p00002
<H1>Digit Number</H1> <p> Write a program which computes the digit number of sum of two integers <var>a</var> and <var>b</var>. </p> <H2>Input</H2> <p> There are several test cases. Each test case consists of two non-negative integers <var>a</var> and <i>b</i> which are separeted by a space in a line. The input ter...
p01243
<H1><font color="#000">Problem J:</font> Castle Wall</H1> <p> A new lord assumed the position by the death of the previous lord in a Far Eastern province. </p> <p> The new greedy lord hates concave polygons, because he believes they need much wasted area to be drawn on paper. He always wants to modify them to convex ...
p02896
<span class="lang-en"> <p>Score : <var>2000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For each of the <var>K^{NM}</var> ways to write an integer between <var>1</var> and <var>K</var> (inclusive) in every square in a square grid with <var>N</var> rows and <var>M</var> columns, find the v...
p04041
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><em>Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.</em></p> <p>Iroha is looking for <em><var>X,Y,Z</var>-Haiku</em> (defined below)...
p03784
<span class="lang-en"> <p>Score : <var>1300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><font color="red"><strong>This is an interactive task.</strong></font></p> <p>AtCoDeer the deer came across <var>N</var> people. For convenience, the people are numbered <var>0</var> through <var>N-1</...
p00901
<H1><font color="#000">Problem H: </font>ASCII Expression</H1> <p> Mathematical expressions appearing in old papers and old technical articles are printed with typewriter in several lines, where a fixed-width or monospaced font is required to print characters (digits, symbols and spaces). Let us consider the followin...
p01613
<h1>A: Grid Mori / グリッド森</h1> <p>とある富豪の森さんが,グリッド状に区分けされた土地の <em>n</em> 区画を買って, 4つの工場 A, B, C, D を建てようとしている.</p> <p>まず,土地全体の幅 <em>w</em> を1以上 <em>n</em> 以下の値で決定する. この土地の 1 番左上の区画を (0, 0) とする. そして, (0, 0) の区画を1番目に, (1, 0) の区画を2番目に購入する. このように, <em>i</em> 番目に (<em>x</em>, <em>y</em>) の区画を購入した後に, <em>i</e...
p01306
<h1><font color="#000">Problem D:</font> 単位変換器</h1> <p> 国際単位系(SI)では、kilo, mega, giga などの接頭辞を使って、「数値 + 接頭辞 + 単位」という形でさまざまな物理量を表記する。たとえば、「3.5 kilometers」, 「5.1 milligrams」 といった具合である。 </p> <p> 一方、これらの物理量は指数表記を使って「3.5 * 10^3 meters」、「5.1 * 10^-3 grams」のように表すことも可能である。 </p> <p> 物理量の測定は必ず誤差を含む。そこで、測定された物理量がどれだけの精度を持つかを表...
p03291
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>The <em>ABC number</em> of a string <var>T</var> is the number of triples of integers <var>(i, j, k)</var> that satisfy all of the following conditions:</p> <ul> <li><var>1 ≤ i &lt; j &lt; k ≤ |T|</var>...
p00844
<H1><font color="#000">Problem I:</font> Shy Polygons</H1> <p> You are given two solid polygons and their positions on the <i>xy</i>-plane. You can move one of the two along the <i>x</i>-axis (they can overlap during the move). You cannot move it in other directions. The goal is to place them as compactly as possible...
p02879
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Having learned the multiplication table, Takahashi can multiply two integers between <var>1</var> and <var>9</var> (inclusive) together. He cannot do any other calculation.</p> <p>Given are two integers...
p01756
<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>S</var> と, <var>m...
p00517
<H1>問題 3: 超都観光 (Super Metropolis) </H1> <br/> <h2>問題</h2> <p> JOI 君は,IOI 国にある超都という都市の観光ツアーを計画することになった. </p> <p> 超都は,南北方向にまっすぐに伸びる W 本の道路と,東西方向にまっすぐに伸びる H 本の道路により,碁盤の目の形に区分けされている. </p> <p> 南北方向の W 本の道路には,西から順に 1, 2, ... , W の番号が付けられている.また,東西方向の H 本の道路には,南から順に 1, 2, ... , H の番号が付けられている.西から i 番目の南北方向の道路と,南から j 番目の...
p00147
<h1>福縞軒</h1> <p> 「福縞軒」は行列のできる人気のラーメン屋です。でも最近、お客さんの間から「待ち時間が長いのに、店に入ったら空席があるのは許せない」という声が聞こえるようになってきました。どうしてそんな不満が出るのか調べたいのですが、お店が開いているあいだは忙しくて、実際の行列の様子を調べることができません。しかし、長年の経験からお客さんが来る間隔や人数は分かっているので、それをもとに待ち時間の分析をすることにしました。 </p> <p> 店内にはカウンターに向かって 17 の席があります。開店時間は正午で、お客さんは次のようにやってきます。 </p> <ul> <li>0 番から 99 番までの 1...
p03907
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is an undirected connected graph with <var>N</var> vertices numbered <var>1</var> through <var>N</var>. The lengths of all edges in this graph are <var>1</var>. It is known that for each <var>i (...
p00628
<H1><font color="#000000">Problem P02:</font> Yes, I have a number</H1> <p> 博士: ペーター君「Yes, I have a number」って知ってるかい? </p> <p> ぺーター: このまえテレビでやってましたよ。文章に含まれる各単語の文字数で何かを覚えるというものですよね。 「Yes, I have a number」 だから、「3.14という数字」という意味になって円周率を覚えるためのキーワードになっているんですよね。 </p> <p> 博士: ペーター君、それは違うんじゃ。 これは、3.1416 と解釈せねばならぬのじゃ。円周率は3.1...
p02615
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Quickly after finishing the tutorial of the online game <em>ATChat</em>, you have decided to visit a particular place with <var>N-1</var> players who happen to be there. These <var>N</var> players, incl...
p00278
<H1>勉強会</H1> <p> プログラマー養成校のアカベ高校には、生徒自身で運営するユニークな勉強会があります。プログラマーは新しい技術を常に取り入れることが大切なので、この勉強会を通して自学自習の習慣を身につけることがこの活動のねらいです。 </p> <p> 生徒は全部で<var>N</var>人おり、それぞれが入学時のプログラミングコンテストの結果で得られたスコアを持っています。勉強会では<var>N</var>人の生徒のうち何人かがリーダーになり、各リーダーがそれぞれのグループを運営するとともに、自らの運営するグループに参加します。 </p> <p> リーダー以外の生徒は、自分のスコアよりも低いスコアのリーダーが...
p02245
<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>8 Puzzle</H1> <p> The g...
p01890
<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>Non-redundant Drive</h2> <p> ...
p00782
<H1><font color="#000">Problem C:</font>Mobile Phone Coverage</H1> <p> A mobile phone company ACMICPC (Advanced Cellular, Mobile, and Internet-Connected Phone Corporation) is planning to set up a collection of antennas for mobile phones in a city called Maxnorm. The company ACMICPC has several collections for locatio...
p03004
<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> points in a two-dimensional plane. The initial coordinates of the <var>i</var>-th point are <var>(x_i, y_i)</var>. Now, each point starts moving at a speed of 1 per second, in a d...
p01039
<h1>Problem C: Manhattan Warp Machine 1</h1> <h2>Problem</h2> <p> とある宇宙では、1次元の整数座標点上に星が存在し、宇宙人達はマンハッタンワープ装置を使い、星間を移動している。<br> このワープ装置には、<var>N</var>個のボタンが付いており、ボタン<var>i</var>を押すと、現在いる星からのマンハッタン距離が<var>d<sub>i</sub></var>である任意の星にコスト<var>c<sub>i</sub></var>でワープすることができる。<br> 今、点0の星にいるある宇宙人が点<var>x</var>の星に行きたいと考えている。<br...
p03454
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For a positive integer <var>n</var>, let us define <var>f(n)</var> as the number of digits in base <var>10</var>.</p> <p>You are given an integer <var>S</var>. Count the number of the pairs of positive ...
p01469
<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...
p01193
<H1><font color="#000"></font>First Experience</H1> <!-- Problem E--> <p> After spending long long time, you had gotten tired of computer programming. Instead you were inter- ested in electronic construction. As your first work, you built a simple calculator. It can handle positive integers of up to four decimal digit...
p01486
<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 A: CatChecker </h2> ...
p03141
<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> dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish <var>1</var>, Dish <var>2</var>, ..., Dish <var>N</var>.</p> <p>When Takahashi ...
p03511
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two strings <var>s</var> and <var>t</var> consisting of lowercase English letters and an integer <var>L</var>.</p> <p>We will consider generating a string of length <var>L</var> by concate...
p00297
<h1>天体観測</h1> <p> ある晴れた夜の帰り道、空を見上げるとそこには無数の星。強く輝く星々、かすかに見える星々、いろ いろな明るさの星々が夜空を彩っています。 </p> <p> あなたはふと思いました。この星空に自分の星座があったらどんなに素敵だろうと。そこであなたはひとつの基準を決め、部屋の窓から見える星々を適当につなげて自分の星座を作ることにしました。その基準とは、「どの2つの星を選んでも、それらの明るさの差がある定数 <var>d</var> 以下になるような星のグループを作り、その中で一番大きいものを自分の星座にしよう!」というものです。例えば、図のような窓から見える夜空を考えてみましょう(外側の長方形は...
p03842
<span class="lang-en"> <p>Score : <var>1400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer sequence <var>a</var> of length <var>N</var>. How many permutations <var>p</var> of the integers <var>1</var> through <var>N</var> satisfy the following condition?</p> <ul> <li...
p02750
<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> stores called Store <var>1</var>, Store <var>2</var>, <var>\cdots</var>, Store <var>N</var>. Takahashi, who is at his house at time <var>0</var>, is planning to visit some of thes...
p02300
<H1>Convex Hull</H1> <br/> <p> Find the convex hull of a given set of points <var>P</var>. In other words, find the smallest convex polygon containing all the points of <var>P</var>. Here, in a convex polygon, all interior angles are less than or equal to 180 degrees. </p> <p> Please note that you should find all th...
p01605
<h2>replace</h2> <h2>Problem Statement</h2> <p>文字列<var>S</var>が与えられる. 以下の処理を<var>Q</var>個順番に行う.</p> <ul class="list1" style="padding-left:16px;margin-left:16px"><li><var>S</var>に含まれる文字<var>c_i</var>を全て同時に文字列<var>p_i</var>で置き換える.</li></ul> <p>最後に文字列<var>S</var>の<var>A</var>文字目から<var>B</var>文字目まで(1-indexed)を出力せよ.</...
p03638
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a grid with <var>H</var> rows and <var>W</var> columns of squares. Snuke is painting these squares in colors <var>1</var>, <var>2</var>, <var>...</var>, <var>N</var>. Here, the following conditi...
p00917
<H1><font color="#000">Problem D: </font>Clock Hands</H1> <p> We have an analog clock whose three hands (the second hand, the <i>minute</i> hand and the <i>hour</i> hand) rotate quite smoothly. You can measure two angles between the second hand and two other hands. </p> <p> Write a program to find the time at which ...
p03792
<span class="lang-en"> <p>Score : <var>1300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a square-shaped grid with <var>N</var> vertical rows and <var>N</var> horizontal columns. We will denote the square at the <var>i</var>-th row from the top and the <var>j</var>-th column from ...
p02880
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Having learned the multiplication table, Takahashi can multiply two integers between <var>1</var> and <var>9</var> (inclusive) together.</p> <p>Given an integer <var>N</var>, determine whether <var>N</v...
p01255
<H1><font color="#000">Problem F:</font> Webby Subway</H1> <p> You are an officer of the Department of Land and Transport in Oykot City. The department has a plan to build a subway network in the city central of Oykot. </p> <p> In the plan, <i>n</i> subway lines are built, and each line has two or more stations. Beca...
p03268
<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...
p02029
<h2>O: 千咲ちゃんと遠足 (Chisaki and Picnic)</h2> <p>幼稚園生の千咲ちゃんは、遠足にお菓子をもっていくことにした。</p> <p>お菓子は $N$ 個あって、$i$ 番目のお菓子は値段が $A_i$ 円で、美味しさが $B_i$ である。</p> <p>千咲ちゃんには友達が $M$ 人いて、$j$ 番目の友達は、値段が $C_j$ 円以上のお菓子を $D_j$ 個以上千咲ちゃんがもっていると泣きわめく。</p> <p>友達が泣きわめいてしまうと千咲ちゃんはかなしいので、そうならないようにお菓子をもっていきたい。</p> <p>お菓子の美味しさの合計は最大でいくつになるか求めて、千咲ちゃんを助けな...
p00014
<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>Integral</H1> <p> Write a program which com...
p02183
<h2>B: テトリス</h2> <h3>問題</h3> <p> 縦 4 マス x 横 10 マスの長方形からなる盤面を考えます。 縦 1 マス x 横 1 マスぶんの正方形をブロックと呼びます。 </p> <p>ブロックを 4 つ繋げたものをテトロミノと呼び、以下の 7 種類(およびこれらに対して 90 度回転を任意回行ったもの)があります。</p> <!--<object data="img/mino.png" type="image/png" width="640"></object>--> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/ACPC201...