question_id stringlengths 6 6 | content stringlengths 1 27.2k |
|---|---|
p00444 |
<H1> おつり </H1>
<h2>問題</h2>
<p>
太郎君はよくJOI雑貨店で買い物をする. JOI雑貨店には硬貨は500円,100円,50円,10円,5円,1円が十分な数だけあり,いつも最も枚数が少なくなるようなおつりの支払い方をする.太郎君がJOI雑貨店で買い物をしてレジで1000円札を1枚出した時,もらうおつりに含まれる硬貨の枚数を求めるプログラムを作成せよ.
</p>
<p>
例えば入力例1の場合は下の図に示すように,4を出力しなければならない.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_... |
p00151 |
<H1>Grid</H1>
<p>
There is a n × n grid D where each cell contains either 1 or 0.
</p>
<p>
Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction.
</p>
<p>
For example, the consecutive 1s with g... |
p00501 |
<H1>看板 (Signboard) </H1>
<br/>
<h2> 問題</h2>
<p>
JOI 君はお店の看板を作ることにした.
</p>
<p>
文字が等間隔に書かれた古い看板が N 枚ある.JOI 君は古い看板からいくつかの文字を消すことで看板を作る.残った文字列がお店の名前になっていて,しかも残った文字が等間隔に並んでいるようにしたい.看板は 1 枚の古い看板から作らなければならず,古い看板を切ったりつなげたりしてはならない.
</p>
<p>
お店の名前と N 枚の古い看板の情報が与えられた時,JOI 君が作ることができる看板の枚数を求めるプログラムを作成せよ.ただし, 1 枚の古い看板から作ることが... |
p01740 |
<p>
You have a board with height two and width <var>W</var>.
The board is divided into 1x1 cells.
Each row of the board is numbered 1 and 2 from top to bottom and each column is numbered 1 to <var>W</var> from left to right.
We denote a cell at the <var>i</var>-th row in the <var>j</var>-th column by <var>(i, j)</var>... |
p00852 |
<H1><font color="#000">Problem H:</font> The Best Name for Your Baby</H1>
<p>
In the year 29XX, the government of a small country somewhere on the earth introduced a law restricting first names of the people only to traditional names in their culture, in order to preserve their cultural uniqueness. The linguists of t... |
p03287 | <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> boxes arranged in a row from left to right. The <var>i</var>-th box from the left contains <var>A_i</var> candies.</p>
<p>You will take out the candies from some consecutive boxes... |
p01310 |
<h1><font color="#000">Problem H:</font> あみだくじ</h1>
<p>
なつめは大のねこ好きである。なつめは今日も日課としている野良ねこのブラッシングをするために,いつも野良ねこが集まってくる校庭の一角に向かうことにした。
</p>
<p>
そのスポットに今日は <var>n</var> 匹のねこが集まってきた。なつめは全員をブラッシングしてやりたかったのだが,ちょうどそこに来る直前に突然用事が出来てしまい,時間的に一匹しかブラッシングしてやれないことになってしまった。ブラッシングはどのねこも楽しみにしているので,一匹だけやると他のねこが嫉妬してしまう。そこでねこたちを納得させるために... |
p03403 | <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> sightseeing spots on the <var>x</var>-axis, numbered <var>1, 2, ..., N</var>.
Spot <var>i</var> is at the point with coordinate <var>A_i</var>.
It costs <var>|a - b|</var> yen (th... |
p01594 |
<h2 align="center">Problem D: Exportation in Space</h2>
<p>In an era of space travelling, Mr. Jonathan A. Goldmine exports a special
material named "Interstellar Condensed Powered Copper". A piece of it consists
of several spheres floating in the air. There is strange force affecting between
the spheres so that their... |
p03053 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given a grid of squares with <var>H</var> horizontal rows and <var>W</var> vertical columns, where each square is painted white or black.
<var>HW</var> characters from <var>A_{11}</var> to <var>... |
p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... |
p00385 | <h1>Disc</h1>
<p>
A mysterious device was discovered in an ancient ruin. The device consists of a disc with integers inscribed on both sides, a bundle of cards with an integer written on each of them and a pedestal within which the cards are placed. The disc rotates when the bundle of cards is put into the pedestal. O... |
p03950 | <span class="lang-en">
<p>Score : <var>1600</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>There is a rectangle in the <var>xy</var>-plane, with its lower left corner at <var>(0, 0)</var> and its upper right corner at <var>(W, H)</var>. Each of its sides is parallel to the <var>x</var>-axis ... |
p02642 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given is a number sequence <var>A</var> of length <var>N</var>.</p>
<p>Find the number of integers <var>i</var> <var>\left(1 \leq i \leq N\right)</var> with the following property:</p>
<ul>
<li>For ever... |
p02357 |
<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>Sliding Minimum Element</H1>
<p>
For a g... |
p01982 | <h3>一般化うるう年</h3>
<!-- begin ja only -->
<p>通常,西暦 <i>x</i> 年がうるう年か否かは以下のように定義されている.</p>
<ol>
<li><i>x</i> が 400 の倍数であれば,うるう年である.</li>
<li>そうでないとき,<i>x</i> が 100 の倍数であれば,うるう年ではない.</li>
<li>そうでないとき,<i>x</i> が 4 の倍数であれば,うるう年である.</li>
<li>そうでないとき,うるう年ではない.</li>
</ol>
<p>これは次のように一般化できる.ある数列 <i>A<sub>1</sub>, ..., A<sub>n</... |
p00690 |
<h1>
A Long Ride on a Railway</h1>
<p>
Travelling by train is fun and exciting. But more than that indeed. Young
challenging boys often tried to purchase the longest single tickets and to
single ride the longest routes of various railway systems. Route planning was
like solving puzzles. However, once assisted by co... |
p03815 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke has decided to play with a six-sided die. Each of its six sides shows an integer <var>1</var> through <var>6</var>, and two numbers on opposite sides always add up to <var>7</var>.</p>
<p>Snuke wi... |
p01828 |
<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>M and A</h2>
<p>
The CEO of th... |
p02707 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>A company has <var>N</var> members, who are assigned ID numbers <var>1, ..., N</var>.</p>
<p>Every member, except the member numbered <var>1</var>, has exactly one immediate boss with a smaller ID numbe... |
p03546 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Joisino the magical girl has decided to turn every single digit that exists on this world into <var>1</var>.</p>
<p>Rewriting a digit <var>i</var> with <var>j</var> <var>(0≤i,j≤9)</var> costs <var>c_{i,... |
p01081 |
<h1>Problem J: Char Swap</h1>
<h2>Problem</h2>
<p>
長さが偶数の文字列<var>S</var>が与えられる。<br>
あなたは、文字列<var>S</var>の隣り合った2つの文字を入れ替える操作を何回でも行うことができる。<br>
文字列<var>S</var>を回文にするためには、最小で何回の操作を行う必要があるだろうか?<br>
回文にすることが不可能な場合は-1を出力せよ。
</p>
<h2>Input</h2>
<p>入力は以下の形式で与えられる。</p>
<pre>
<var>S</var>
</pre>
<p>
1行に文字列<var>S</va... |
p03116 | <span class="lang-en">
<p>Score : <var>1000</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p><font color="red"><strong>Red bold fonts show the difference from C1.</strong></font></p>
<p>There is an infinitely large triangular grid, as shown below.
Each point with integer coordinates contains a... |
p00413 | <h1>海苔(のり)</h1>
<p>
ヒバラ海の浜辺の集落では海苔の生産が盛んです。海苔はすべて長方形に成型されます。海苔を天日干しするときは、2枚の海苔を同じ敷物の上に乗せて、1枚目の上辺と2枚目の上辺が平行になるように置きます。アルバイトのゲンムさんは平行に置くことはできるのですが、まだ慣れていないため重なった部分ができてしまうことがあります。重なった部分は売り物にならないので、重なっていない部分の海苔の面積を求めておく必要があります。
</p>
<p>
同じ敷物の上に置いた2枚の海苔それぞれの左下端の位置と幅と高さが与えられたとき、重なっていない部分の海苔の面積を出力するプログラムを作成せよ。
</p>
<h2>入... |
p00043 |
<H1>パズル</H1>
<p>
1 〜 9 の数字を 14 個組み合わせて完成させるパズルがあります。与えられた 13 個の数字にもうひとつ数字を付け加えて完成させます。
</p>
<p>
パズルの完成条件は
</p>
<ul>
<li>同じ数字を2つ組み合わせたものが必ずひとつ必要です。</li>
<li>残りの12 個の数字は、3個の数字の組み合わせ4つです。<br>
3個の数字の組み合わせ方は、同じ数字を3つ組み合わせたものか、または3つの連続する数字を組み合わせたものです。ただし、9 1 2 のような並びは連続する数字とは認められません。</li>
<li>同じ数字は4 回まで使えます。</li>
</ul>
... |
p02584 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi, who lives on the number line, is now at coordinate <var>X</var>. He will make exactly <var>K</var> moves of distance <var>D</var> in the positive or negative direction.</p>
<p>More specifical... |
p01202 |
<H1><font color="#000">Problem A:</font> Dance Dance Revolution</H1>
<p>
<i>Dance Dance Revolution</i> is one of the most popular arcade games in Japan. The rule of this game is very
simple. A series of four arrow symbols, <i>up</i>, <i>down</i>, <i>left</i> and <i>right</i>, flows downwards on the screen in time
to ... |
p04000 | <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. At first, all cells were painted white.</p>
<p>Snuke painted <var>N</var> of these cells. The <var>i</var>-th ( <var>1 \leq i \leq N</var>... |
p01652 |
<h2>Problem Statement</h2>
<p>
One day in a forest, Alice found an old monolith.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ancientCommemorative1"><br/>
<br/>
</center>
<p>
She investigated the monolith, and found this was a sentence written in an old language.
A sentence consist... |
p00940 |
<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 F
Deadlock Detection</... |
p03395 | <span class="lang-en">
<p>Score : <var>700</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Aoki is playing with a sequence of numbers <var>a_{1}, a_{2}, ..., a_{N}</var>. Every second, he performs the following operation :</p>
<ul>
<li>Choose a positive integer <var>k</var>. For each element ... |
p03680 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi wants to gain muscle, and decides to work out at AtCoder Gym.</p>
<p>The exercise machine at the gym has <var>N</var> buttons, and exactly one of the buttons is lighten up.
These buttons are n... |
p02992 | <span class="lang-en">
<p>Score : <var>600</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Find the number of sequences of length <var>K</var> consisting of positive integers such that the product of any two adjacent elements is at most <var>N</var>, modulo <var>10^9+7</var>.</p>
</section>
<... |
p01347 |
<H1><font color="#000">Problem I: </font>How to Create a Good Game</H1>
<p>
A video game company called ICPC (International Company for Playing and Competing) is now developing a new arcade game. The new game features a lot of branches. This makes the game enjoyable for everyone, since players can choose their routes... |
p01717 |
<h1>問題 F : Social Monsters</h1>
<h2>問題文</h2>
<p>
不思議な生き物と人間が互いに助け合って生きている世界.
この世界では自分で捕まえたモンスター同士を戦わせる大会が盛んに行われており,
多くの少年少女達が世界一のトレーナーを目指している.
</p>
<p>
バトルでは自分が捕まえたモンスターからパーティを作り,パーティ同士の対戦となる.
モンスターのペアには相性があり,相性が非常に悪い場合と普通の場合がある.
相性が非常に悪い場合,そのペアのモンスターを同じパーティに入れることはできない.
相性が普通の場合には,<i>友情度</i>という数値で相性の良さ... |
p02838 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> integers. The <var>i</var>-th integer is <var>A_i</var>.</p>
<p>Find <var>\sum_{i=1}^{N-1}\sum_{j=i+1}^{N} (A_i \mbox{ XOR } A_j)</var>, modulo <var>(10^9+7)</var>.</p>
<details>
<s... |
p00805 |
<H1><font color="#000">Problem C:</font> Fishnet</H1>
<p>
A fisherman named Etadokah awoke in a very small island. He could see calm, beautiful and blue sea around the island. The previous night he had encountered a terrible storm and had reached this uninhabited island. Some wrecks of his ship were spread around him... |
p02091 |
<h2>D: XORANDORBAN</h2>
<h3>Problem Statement</h3>
<p>You are given a positive integer <var>N</var>. Your task is to determine a set <var>S</var> of <var>2^N</var> integers satisfying the following conditions:</p>
<ul>
<li> All the integers in <var>S</var> are at least <var>0 </var> and less than <var>2^{N+1}</var>.... |
p00556 |
<h1>ぬいぐるみの整理 (Plush Toys)</h1>
<h2>問題</h2>
<p>
ある JOI 関係者は,おもちゃ屋で働いている.今日は,店内にあるぬいぐるみコーナーの整理をすることになった.
</p>
<p>
ぬいぐるみコーナーの棚には,N 個のぬいぐるみが左から右に一列に並べられている.棚は仕切りにより N 個の区画に区切られており,1 つの区画に 1 個のぬいぐるみを置く.このおもちゃ屋は合計 M 種類のぬいぐるみを売っており,それぞれ 1 から M までの番号が付けられている.棚に並べられた N 個のぬいぐるみは,それぞれこの M 種類のうちのいずれかである.また,それぞれの種類のぬいぐるみは,少な... |
p00106 |
<H1>Discounts of Buckwheat</H1>
<p>
Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves.
</p>
<p>
One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ... |
p00311 |
<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>
浩と健次郎の兄弟は猪苗代湖に魚釣りをしに来ました... |
p01853 |
<h1 id="b-平均値の嘘-lie-with-mean-value">B : 平均値の嘘 / Lie with Mean Value</h1>
<h2 id="問題文">問題文</h2>
<p>R 大学情報理工学部 <var>1</var> 回生の学生 <var>n</var> 人が, プログラミング演習 1 という講義の期末試験を受験する. 試験は <var>m</var> 点満点である.つまり,<var>1</var> 人の学生の取りうる点数は <var>0</var> 以上 <var>m</var> 以下の整数である.</p>
<p>担当の先生は意地が悪いので,平均値と中央値の差が最大になるような点数分布が気になっ... |
p00741 |
<h1><font color="#000000">Problem B:</font> How Many Islands?</h1>
<p>
You are given a marine area map that is a mesh of squares, each
representing either a land or sea area.
Figure B-1 is an example of a map.
</p>
<p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_2009B2"><br>
Figure B-1... |
p02286 | <H1>Treap</H1>
<p>
A binary search tree can be unbalanced depending on features of data. For example, if we insert $n$ elements into a binary search tree in ascending order, the tree become a list, leading to long search times. One of strategies is to randomly shuffle the elements to be inserted. However, we should ... |
p01500 |
<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 F:
Rabbit Jumping
</h2>... |
p01150 |
<H1><font color="#000">Problem B:</font> Eight Princes</H1>
<p>
Once upon a time in a kingdom far, far away, there lived eight princes. Sadly they were on very
bad terms so they began to quarrel every time they met.
</p>
<p>
One day, the princes needed to seat at the same round table as a party was held. Since they
w... |
p03497 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi has <var>N</var> balls. Initially, an integer <var>A_i</var> is written on the <var>i</var>-th ball.</p>
<p>He would like to rewrite the integer on some balls so that there are at most <var>K<... |
p03182 | <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Consider a string of length <var>N</var> consisting of <code>0</code> and <code>1</code>.
The score for the string is calculated as follows:</p>
<ul>
<li>For each <var>i</var> (<var>1 \leq i \leq M</var... |
p03478 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Find the sum of the integers between <var>1</var> and <var>N</var> (inclusive), whose sum of digits written in base <var>10</var> is between <var>A</var> and <var>B</var> (inclusive).</p>
</section>
</d... |
p01445 |
<H1><font color="#000">Problem I:</font> Mobile Network</H1>
<p>
The trafic on the Internet is increasing these days due to smartphones. The wireless carriers
have to enhance their network infrastructure.
</p>
<p>
The network of a wireless carrier consists of a number of base stations and lines. Each line connects t... |
p03028 | <span class="lang-en">
<p>Score : <var>1000</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We will host a rock-paper-scissors tournament with <var>N</var> people. The participants are called Person <var>1</var>, Person <var>2</var>, <var>\ldots</var>, Person <var>N</var>.
For any two partici... |
p01015 |
<script src="./IMAGE/varmath.js" charset="UTF-8"></script>
<h1>Problem J: J's Final Problem</h1>
<h2>Problem</h2>
<p>
不思議なダンジョンとは構造の変化を伴うダンジョンである。不思議なダンジョンは階層が深いものから浅いものまで様々なものがあり、深い階層には凶悪なモンスターが生息していたり、財宝が眠っていたりする。ジェイは不思議なダンジョンを研究している研究者である。ある日、新しいダンジョンを掘っていたところ、とても大きく深いダンジョンに繋がってしまった。ジェイはこのダンジョンを「ジェイの最終問題」と名付けた。こ... |
p03881 | <span class="lang-en">
<p>Score : <var>1000</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><style>
#nck {
width: 30px;
height: auto;
}
</style>
<p>There are two (6-sided) dice: a red die and a blue die.
When a red die is rolled, it shows <var>i</var> with probability <var>p_i<... |
p02793 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given are <var>N</var> positive integers <var>A_1,...,A_N</var>.</p>
<p>Consider positive integers <var>B_1, ..., B_N</var> that satisfy the following condition.</p>
<p>Condition: For any <var>i, j</var... |
p00254 |
<H1>すべての数は6174に通ず</H1>
<p>
0 から 9 の数字からなる四桁の数 N に対して以下の操作を行う。
</p>
<ol>
<li> N の桁それぞれの数値を大きい順に並べた結果得た数を L とする</li>
<li> N の桁それぞれの数値を小さい順に並べた結果得た数を S とする</li>
<li> 差 L-S を新しい N とする(1回分の操作終了)</li>
<li> 新しい N に対して 1. から繰り返す</li>
</ol>
<p>
このとき、全桁が同じ数字(0000, 1111など)である場合を除き、あらゆる四桁の数はいつかは 6174になることが知られている。例えば N = 2012の... |
p02269 |
<H1>Search III</H1>
<p>
Your task is to write a program of a simple <i>dictionary</i> which implements the following instructions:
</p>
<ul>
<li><b>insert <i>str</i></b>: insert a string <i>str</i> in to the dictionary</li>
<li><b>find <i>str</i></b>: if the distionary contains <i>str</i>, then print '<span>yes</spa... |
p01916 |
<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>A: アルファベットブロック</h2>
<p>名川 若菜 (なかわ わかな) ちゃんは回文が大好きだ。なぜなら、自分の名前もまた回文であるからである。</p>
<p>わかなちゃんはアルファベットブロックがいくつか入っているセットを手に入れた。アルファベットブロックというのは... |
p00604 |
<H1><font color="#000000">Problem J:</font> Cheating on ICPC</H1>
<p>
Peter loves any kinds of cheating. A week before ICPC, he broke into Doctor's PC and sneaked a look at all the problems that would be given in ICPC. He solved the problems, printed programs out, and brought into ICPC. Since electronic preparati... |
p02639 | <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have five variables <var>x_1, x_2, x_3, x_4,</var> and <var>x_5</var>.</p>
<p>The variable <var>x_i</var> was initially assigned a value of <var>i</var>.</p>
<p>Snuke chose one of these variables and... |
p03301 | <span class="lang-en">
<p>Score : <var>2000</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> boxes arranged in a row from left to right. The <var>i</var>-th box from the left contains <var>a_i</var> manju (buns stuffed with bean paste).
<span style="color:#C06000">Sugim<... |
p01296 |
<H1><font color="#000">Problem D:</font> Futon</H1>
<p>
The sales department of Japanese Ancient Giant Corp. is visiting a hot spring resort for their
recreational trip. For deepening their friendships, they are staying in one large room of a
Japanese-style hotel called a ryokan.
</p>
<p>
In the ryokan, people sleep... |
p03751 | <span class="lang-en lang-child hidden-lang">
<div class="part">
Max Score: <var>250</var> Points <br/>
<section>
<h3>Problem Statement</h3>
Mr.X, who the handle name is <var>T</var>, looked at the list which written <var>N</var> handle names, <var>S_1, S_2, ..., S_N</var>. <br/>
But he couldn't see some ... |
p02843 | <span class="lang-en">
<p>Score: <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3>
<p>AtCoder Mart sells <var>1000000</var> of each of the six items below:</p>
<ul>
<li>Riceballs, priced at <var>100</var> yen (the currency of Japan) each</li>
<li>Sandwiches, priced at <var>101</var> yen ... |
p00487 |
<H1> 微生物実験(Bug Party)</H1>
<p>
あなたはJust Odd Inventions 社を知っているだろうか? この会社の業務は「ただ奇妙な発明(just odd inventions)」をすることである.ここでは略してJOI 社と呼ぶ.
</p>
<p>
JOI 社では多くの微生物を1 つのシャーレに生きたまま閉じ込める研究をしている.調査対象の微生物は<i>N</i> 匹存在し,1, 2, ... , <i>N</i> という番号がついている.各微生物はシャーレに閉じ込められると,foo (fatally odd object) と呼ばれる有害物質を一瞬のうちにシャーレ内に放出する.各微生物が放... |
p02140 | <h1>Problem D: Gridgedge</h1>
<h2>Problem</h2>
<p> 左上が$(0, 0)$、 右下が$(R-1, C-1)$である$R \times C$マスのグリッドがある。あるマス($e$, $f$)にいるとき、そこから$(e+1, f)$, $(e-1, f)$, $(e, f+1)$, $(e, f-1)$, $(e, 0)$, $(e, C-1)$, $(0, f)$, $(R-1, f)$にはコスト$1$で移動できる。ただしグリッドの外に出ることはできない。マス$(a_i, a_j)$から$(b_i, b_j)$へ移動するとき、最短経路のコストと、最短経路の組み合わせの総数を$10^9 ... |
p02455 | <h1>Set: Search</h1>
<p>
For a set $S$ of integers, perform a sequence of the following operations. Note that <u>each value in $S$ must be unique</u>.
</p>
<ul>
<li>insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.</li>
<li>find($x$): Report the number of $x$ in $S$ (... |
p00468 |
<H1>パーティー</H2>
<h2>問題</h2>
<p>
あなたはクリスマスパーティーに学校内の自分の友達と,自分の友達の友達を招待することにした.
あなたの通う学校の生徒数は n 人であり,それぞれの生徒には 1 から n までの番号が割り振られている.
あなたの番号は 1 である.
あなたの手元には,誰と誰が友達であるかを記したリストがある.
このリストをもとに,
あなたがクリスマスパーティーに招待する生徒数を求めるプログラムを作成せよ.
</p>
<h2>入力</h2>
<p>
入力は複数のデータセットからなる.各データセットは以下の形式で与えられる.
</p>
<p>
データセットの1 行目には学校の生徒... |
p00192 |
<H1>立体駐車場</H1>
<table>
<tr>
<td style="vertical-align:top">
<p>
街中には駐車場の利用効率を上げるため、立体式やタワー式などの様々な駐車場があります。その中には、ひとつの駐車スペースに図のような「2段式駐車装置」を設置し、2台分の駐車スペースを確保している駐車場もあります。この2段式駐車装置は1台を昇降式のパレット(車を乗せる平らな鉄板)に乗せて上段に駐車させ、もう1台を下段に駐車することができます。
</p>
<p>
このような2段式駐車装置を用いている駐車場では、上段の車を出し入れするのに、その都度、下段に駐車されている車を出して、退かす必要があるので、... |
p02005 | <h1>Problem B. Colorful Drink</h1>
<!--
Time Limit: 2 sec
Memory Limit: 512 MB
-->
<p>
In the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order.
</p>
<p>
Yo... |
p00038 |
<H1>ポーカー</H1>
<p>
ポーカーの手札データを読み込んで、それぞれについてその役を出力するプログラムを作成してください。ただし、この問題では、以下のルールに従います。
</p>
<ul>
<li>ポーカーはトランプ 5 枚で行う競技です。</li>
<li>同じ数字のカードは 5 枚以上ありません。</li>
<li>ジョーカーは無いものとします。</li>
<li>以下のポーカーの役だけを考えるものとします。(番号が大きいほど役が高くなります。)</li>
</ul>
<ol style="margin-left:40px">
<li>役なし(以下に挙げるどれにも当てはまらない)</li>
<li>ワンペア... |
p01279 |
<H1><font color="#000">Problem G:</font> Defend the Bases</H1>
<p>
A country Gizevom is being under a sneak and fierce attack by their foe. They have to deploy one or
more troops to every base immediately in order to defend their country. Otherwise their foe would take
all the bases and declare "All your base are bel... |
p03244 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>A sequence <var>a_1,a_2,... ,a_n</var> is said to be /\/\/\/ when the following conditions are satisfied:</p>
<ul>
<li>For each <var>i = 1,2,..., n-2</var>, <var>a_i = a_{i+2}</var>.</li>
<li>Exactly tw... |
p01783 |
<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>D - LR</h2>
<h3>Problem Statem... |
p00891 |
<H1><font color="#000">Problem H:</font> Where's Wally</H1>
<p>
Do you know the famous series of children's books named "Where's Wally"? Each of the books contains a variety of pictures of hundreds of people. Readers are challenged to find a person called Wally in the crowd.
</p>
<p>
We can consider "Where's Wally" ... |
p01629 |
<h1>Problem C: ホテル探し</h1>
<h2>Problem Statement</h2>
<p>
会津合宿に参加予定の高槻さんは、家が貧乏であまりお金を持っていない。彼女は、合宿のためにホテルを探しているが、なるべくお金を節約できるプランにするために、悩み中である。宿泊の合計金額が安くなるホテルの泊まり方を求めて、彼女に教えてあげよう。
</p>
<p>
宿泊するホテルの候補数は、N個であり、各ホテルをホテル1、ホテル2、...、ホテルNと呼ぶこととする。彼女は、これからD泊分の予約をこれらのホテルから選ぶことにしている。候補のホテルは全て、1泊ごとに宿泊料金が変動することがあるため、入力では各ホテルごとに... |
p03614 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given a permutation <var>p_1,p_2,...,p_N</var> consisting of <var>1</var>,<var>2</var>,..,<var>N</var>.
You can perform the following operation any number of times (possibly zero):</p>
<p>Operat... |
p02906 | <span class="lang-en">
<p>Score : <var>700</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke's mother gave Snuke an undirected graph consisting of <var>N</var> vertices numbered <var>0</var> to <var>N-1</var> and <var>M</var> edges.
This graph was connected and contained no parallel edges... |
p01107 |
<h3><u>Go around the Labyrinth</u></h3>
<p>
Explorer Taro got a floor plan of a labyrinth.
The floor of this labyrinth is in the form of a two-dimensional grid.
Each of the cells on the floor plan corresponds to a room and is indicated whether it can be entered or not.
The labyrinth has only one entrance located at ... |
p03090 | <span class="lang-en">
<p>Score : <var>700</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given an integer <var>N</var>.
Build an undirected graph with <var>N</var> vertices with indices <var>1</var> to <var>N</var> that satisfies the following two conditions:</p>
<ul>
<li>The graph ... |
p01557 |
<h1>Reverse Sort</h1>
<p>1 ∼ NまでのN個の数字の順列A<sub>1</sub>, A<sub>2</sub>, ……, A<sub>N</sub>が与えられる。
この順列に対して区間[i, j](1 ≤ i ≤ j ≤ N)の数字の順序を逆順にする操作reverse(i, j)を行うことが出来る。
例えば、[1, 2, 3, 4, 5]に対してreverse(2, 4)を適用すると[1, 4, 3, 2, 5]となる。
最小で何回の操作を行えば順列を昇順にソートされた状態にすることが出来るか計算せよ。
</p>
<h2>Input</h2>
<p>入力は以下の形式で与えら... |
p03839 | <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> squares aligned in a row.
The <var>i</var>-th square from the left contains an integer <var>a_i</var>.</p>
<p>Initially, all the squares are white.
Snuke will perform the followin... |
p01804 |
<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>
<!-- begin en only -->
<h3><u>Falling Block Puzzle</u>... |
p00716 |
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1>
<p>
The Ohgas are a prestigious family based on Hachioji. The head of the family,
Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune
by depositing his money to an operation company. You are asked to help
Mr. Ohga maximize his profit by... |
p03993 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> rabbits, numbered <var>1</var> through <var>N</var>.</p>
<p>The <var>i</var>-th (<var>1≤i≤N</var>) rabbit likes rabbit <var>a_i</var>.
Note that no rabbit can like itself, that is... |
p02681 | <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi wants to be a member of some web service.</p>
<p>He tried to register himself with the ID <var>S</var>, which turned out to be already used by another user.</p>
<p>Thus, he decides to register... |
p00346 |
<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>
アイヅ国では、毎年、駅伝大会が開催されています。... |
p01941 |
<h2>D: 優柔不断 - Indecision -</h2>
<h3>問題</h3>
<p>えびちゃんは最近ギャルゲーにハマっていて、今の目標は二人のヒロインを同時に攻略することです。</p>
<p>えびちゃんはいくつかあるイベントを利用してヒロインからの好感度を高めることができますが、各イベントの対象として選べるヒロインはどちらか一人のみです。しかし、えびちゃんは選ばなかったヒロインに対してもフォローを忘れないので、もう片方のヒロインからの好感度もある程度は高めることができます。ただし、イベントには費用がかかるため、必ずしも全てのイベントを行えるわけではありません。</p>
<p>さて、優柔不断なえびちゃんは各... |
p00653 |
<H1>Problem G: School of Killifish</H1>
<p>
Jon is the leader of killifish.
Jon have a problem in these days.
Jon has a plan to built new town in a pond.
Of course new towns should have a school for children. But there are some natural enemies in a pond.
Jon thinks that the place of a school should be the safest place... |
p02394 |
<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>Circle in a Rectangle</H1>
... |
p00203 |
<h1>会津山スキー場の新企画</h1>
<p>
会津山スキー場の経営者である油木屋さんは、上級者向けとして障害物やジャンプ台を配置したコースを用意しました。コースにはいろいろな滑り方があり、シーズン中に全てのパターンの滑り方が出来た利用者には、プレゼントを贈ることになっています。
</p>
<p>
油木屋さんのために、コースの見取り図をもとに滑り方のパターン数を出力するプログラムを作ってあげましょう。
</p>
<!--
<p>
しかし、オープン直前になって、油木屋さんは滑り方のパターン数を記録した書類をなくしてしま
いました。どうにかして書類を作り直したい油木屋さんは、コースの見取り図を片手にあなたに助け
を求... |
p01042 |
<h1>Problem F: Sum of Numbers</h1>
<h2>Problem</h2>
<p>
<var>a</var>以上<var>b</var>以下の整数が書かれたカードがそれぞれ<var>c</var>枚ずつあります。
これら<var>c(b-a+1)</var>枚のカードの中から<var>d</var>枚のカードを選択したとき、それらのカードに書かれている整数の合計が<var>e</var>になる場合の数を1,000,000,007で割った余りを求めてください。
</p>
<h2>Input</h2>
<p>
入力は以下の形式で与えられる。
</p>
<pre>
<var>a</var> <var>... |
p03585 | <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> lines in the <var>xy</var>-plane. The <var>i</var>-th line is represented by <var>A_ix+B_iy=C_i</var>.
Any two lines among the <var>N+2</var> lines, the above <var>N</var> lines p... |
p01412 |
<H1>F: Power of Power</H1>
<p>
ICPC で良い成績を収めるには修行が欠かせない.うさぎは ICPC で勝ちたいので,今日も修行をすることにした.
</p>
<p>
今日の修行は,非常に大きな数の計算を行って,計算力をつけて意識を高めようというものである.大きい数が簡単に出てくる演算として,累乗が挙げられる.
</p>
<p>
<i>N</i> 個の非負整数 <i>A</i><sub>1</sub>, <i>A</i><sub>2</sub>, ..., <i>A</i><sub><i>N</i></sub> がある.これらの並べ替え <i>B</i><sub>1</sub>, <i>B</i><... |
p02117 |
<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 G: Picnic</h1>
... |
p02547 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak performed the following action <var>N</var> times: rolling two dice.
The result of the <var>i</var>-th roll is <var>D_{i,1}</var> and <var>D_{i,2}</var>.</p>
<p>Check if doublets occurred at least t... |
p00080 |
<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>3乗根</H1>
<p>
$x^3 = q$ の解は漸化式 $x_{n+1} =... |
p03706 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Skenu constructed a building that has <var>N</var> floors. The building has an elevator that stops at every floor.</p>
<p>There are buttons to control the elevator, but Skenu thoughtlessly installed onl... |
p02814 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given are a sequence <var>A= {a_1,a_2,......a_N}</var> of <var>N</var> positive even numbers, and an integer <var>M</var>.</p>
<p>Let a <em>semi-common multiple</em> of <var>A</var> be a positive intege... |
p00829 |
<H1><font color="#000">Problem C:</font> Leaky Cryptography</H1>
<p>
The ACM ICPC judges are very careful about not leaking their problems, and all communications are encrypted. However, one does sometimes make mistakes, like using too weak an
encryption scheme. Here is an example of that.
</p>
<p>
The encryption cho... |
p03356 | <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have a permutation of the integers from <var>1</var> through <var>N</var>, <var>p_1</var>, <var>p_2</var>, .., <var>p_N</var>.
We also have <var>M</var> pairs of two integers between <var>1</var> and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.