question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p02728
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>We have a tree with <var>N</var> vertices numbered <var>1</var> to <var>N</var>. The <var>i</var>-th edge in this tree connects Vertex <var>a_i</var> and <var>b_i</var>. For each <var>k=1, ..., N</var>...
p01807
<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>Stamp Rally</u></h3> <!...
p02682
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>A</var> cards, each of which has an integer <var>1</var> written on it. Similarly, we also have <var>B</var> cards with <var>0</var>s and <var>C</var> cards with <var>-1</var>s.</p> <p>We w...
p03990
<span class="lang-en"> <p>Score : <var>1400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Sigma and Sugim are playing a game.</p> <p>The game is played on a graph with <var>N</var> vertices numbered <var>1</var> through <var>N</var>. The graph has <var>N-1</var> red edges and <var>N-1</var>...
p00345
<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> 実数のうち、小数郚が埪環するものず有限桁の...
p02378
<H1>Bipartite Matching</H1> <p> A bipartite graph <var>G = (V, E)</var> is a graph in which the vertex set <var>V</var> can be divided into two disjoint subsets <var>X</var> and <var>Y</var> such that every edge <var>e &isin; E</var> has one end point in <var>X</var> and the other end point in <var>Y</var>. </p> <p>...
p03139
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We conducted a survey on newspaper subscriptions. More specifically, we asked each of the <var>N</var> respondents the following two questions:</p> <ul> <li>Question <var>1</var>: Are you subscribing to...
p01104
<h3><u>Making Lunch Boxes</u></h3> <p> Taro has been hooked on making lunch boxes recently. Taro has obtained a new lunch box recipe book today, and wants to try as many of the recipes listed in the book as possible. </p> <p> Enough of the ingredients for all the recipes are at hand, but they all are in vacuum packs...
p03093
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let <var>M</var> be a positive integer.</p> <p>You are given <var>2 N</var> integers <var>a_1, a_2, \ldots, a_{2 N}</var>, where <var>0 \leq a_i &lt; M</var> for each <var>i</var>.</p> <p>Consider divi...
p03569
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a string <var>s</var> consisting of lowercase English letters. Snuke can perform the following operation repeatedly:</p> <ul> <li>Insert a letter <code>x</code> to any position in <var>s</var> o...
p01554
<h1>Kagisys</h1> <p>ある郚屋ではICカヌドを甚いお鍵を開け閉めする電子錠システムを甚いおいる。 このシステムは以䞋のように動䜜する。 </p> <p>各ナヌザヌが持぀ICカヌドを扉にかざすず、そのICカヌドのIDがシステムに枡される。 システムはIDが登録されおいる時、斜錠されおいるなら開錠し、そうでないのなら斜錠し、それぞれメッセヌゞが出力される。 IDが登録されおいない堎合は、登録されおいないずいうメッセヌゞを出力し、開錠及び斜錠はおこなわれない。 </p> <p>さお、珟圚システムにはN個のID(U<sub>1</sub>, U<sub>2</sub>, 

, U<sub>N</sub>)が登録されおお...
p00596
<H1><font color="#000000">Problem B:</font> Dominoes Arrangement</H1> <pre> [0, 0] [0, 1] [1, 1] [0, 2] [1, 2] [2, 2] [0, 3] [1, 3] [2, 3] [3, 3] [0, 4] [1, 4] [2, 4] [3, 4] [4, 4] [0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5] [0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6] </pre> <p> Consider the ...
p02051
<h3>䞍思議なボタン</h3> <!-- begin ja only --> <p>あなたは町倖れにあるダンゞョンでコむンを皌ぐこずにしたこのダンゞョンには <i>N</i> 個の郚屋が存圚し<i>1</i> から <i>N</i> たでの番号が぀けられおいるたたダンゞョン内には「コむンボタン」「脱出ボタン」「ワヌプボタン」ず呌ばれる䞍思議なボタンが存圚するそれぞれのボタンの詳现は次の通りである</p> <ul> <li>コむンボタンは各郚屋にちょうど <i>1</i> 個存圚するコむンボタンは䜕回でも抌すこずができそのたびにコむンが <i>1</i> 枚手に入る</li> <li>脱出ボタンは各郚屋にちょ...
p02401
<H1>Simple Calculator</H1> <p> Write a program which reads two integers <var>a</var>, <var>b</var> and an operator <var>op</var>, and then prints the value of <var>a</var> <var>op</var> <var>b</var>. </p> <p> The operator <var>op</var> is '+', '-', '*' or '/' (sum, difference, product or quotient). The division shoul...
p01387
<div> <h1 class="title">問題 L : <span style="font-size:110%;font-family:times new roman;"><i>L</i></span> 番目の数字</h1> <p>反乱を嗅ぎ぀けた倚くの G○○gle のコヌダヌが我々を取り抌さえにやっおきた かなりの数だ その䞭には東京倧孊時代に僕らを優しく指導しおくれた先茩たちも倚く芋受けられる 残念ながら今では敵同士だ</p> <dl class="docutils"> <dt>wata</dt> <dd>「予想以䞊の数だ 」</dd> <dt>(iwi)</dt> <dd>「ああ我々が超高速指数時...
p02952
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is an integer <var>N</var>. Find the number of positive integers less than or equal to <var>N</var> that have an odd number of digits (in base ten without leading zeros).</p> </section> </div> <di...
p03640
<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...
p03210
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><em>Shichi-Go-San</em> (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.</p> <p>Takahashi is now <var>X</va...
p02817
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are two strings <var>S</var> and <var>T</var> consisting of lowercase English letters. Concatenate <var>T</var> and <var>S</var> in this order, without space in between, and print the resulting st...
p01738
<p> You are practicing a juggle that involves in a number of square tiles. They all look the same in their size, but actually there are three different kinds of the tiles, A, B and X. The kind of a tile can be distinguishable by its mass. All the tiles of the same kind have exactly the same mass. The mass of type A t...
p03705
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has <var>N</var> integers. Among them, the smallest is <var>A</var>, and the largest is <var>B</var>. We are interested in the sum of those <var>N</var> integers. How many different possible sums ...
p01368
<H1><font color="#000">Problem J:</font> Merry Christmas</H1> <p> International Christmas Present Company (ICPC) is a company to employ Santa and deliver presents on Christmas. Many parents request ICPC to deliver presents to their children at specified time of December 24. Although same Santa can deliver two or more...
p03355
<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>. Among the <strong>different</strong> substrings of <var>s</var>, print the <var>K</var>-th lexicographically smallest one.</p> <p>A substring of <var>s</var> is a st...
p00980
<h2>Estimating the Flood Risk</h2> <p> Mr. Boat is the owner of a vast extent of land. As many typhoons have struck Japan this year, he became concerned of flood risk of his estate and he wants to know the average altitude of his land. The land is too vast to measure the altitude at many spots. As no steep slopes ar...
p01692
<h2>F - Dangerous Delivery / 危険な茞送</h2> <h3>Story</h3> <p>Dのひずは重倧な䜿呜を背負っおいた。それはDAtaCoDer瀟長のDhokudai氏ぞ、次のDAtaCoDer Regular Contest(DARC)のD問題を届けるこずだ。Dのひずのアゞトがある郜垂<var>1</var>からDAtaCoDer本瀟がある郜垂<var>N</var>たでは<var>N</var>個の郜垂が䞀盎線に䞊んでいる。この移動の間、䞍正を䌁む緑の䞉角圢の集団がD問題を狙っおおり、その魔の手からD問題を守らねばならない。</p> <p>幞い、Dのひずは次元(ディメンゞョン)の壁を超えお移...
p02114
<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 D: Fissure Puzzle...
p00129
<h1>かくれんがう</H1> <p> たろう君はかくれんがうが苊手です。隠れるずすぐ芋぀かっちゃうし、隠れおいる子をなかなか芋぀けるこずができたせん。芋かねたお父さんは、超高性胜䜍眮探玢システムを䜜っおくれたした。これを䜿うず自分の䜍眮を含めお、友達の䜍眮を正確に知るこずができたす。鬌になったら、隠れおいる子を探すこずが簡単にできるようになりたした。 </p> <!-- 芋぀けたい子の䜍眮に行けば、それで OK のはずです。これを䜿っおいるこずがばれるず遊んでもらえなくなるので内緒で䜿いたす。 --> <p> たろう君はさらにこのシステムを進化させ、鬌から自分が芋えるか吊かを刀定する機胜を付加するこずを思い぀きたした。...
p02544
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are a permutation <var>p_1, p_2, \dots, p_N</var> of <var>(1, 2, ..., N)</var> and an integer <var>K</var>. Maroon performs the following operation for <var>i = 1, 2, \dots, N - K + 1</var> in thi...
p00579
<h1>むルミネヌション (Illumination)</h1> <!--  時間制限 : 2sec / メモリ制限 : 256MB--> <h2>問題文</h2> <p> JOI 氏は自宅の敷地に <var>N</var> 本の朚を所有しおいるこれらの朚は䞀列に䞊んでおり順に <var>1</var> から <var>N</var> たでの敎数で番号が付けられおいる </p> <p> この冬JOI 氏はいく぀かの朚を遞んでむルミネヌションを食り付けるこずにしたむルミネヌションには<strong>矎しさ</strong>ず呌ばれる倀が定たっおいる朚 <var>i</var> にむルミネヌションを食り付ける堎合...
p00083
<H1>西暊和暊倉換</H1> <p> 西暊で衚された幎月日を、元号を甚いた和暊に倉換し、その幎月日を出力するプログラムを䜜成しおください。入力は䟋に瀺すように 3 ぀の敎数であり、順に西暊幎、月、日です。これを、出力䟋に瀺すように倉換しおください。なお、明治以前の幎月日が入力された堎合は「pre-meiji」ず衚瀺しおください。 </p> <p> 各幎号の最初の幎は「元幎」ではなく「幎」ず出力するこずずしたす。 </p> <center> <table border=1> <tr><td align=center width=100>元号</td><td align=center width=240>期間</td><...
p00216
<H1>氎道料金</H1> <p> <!--あいづ孊園郜垂に䜏んでいる-->束平さんは、普段から゚コに気を付けお生掻をしおいたす。先月の氎道料金が 4280 円ずなり、い぀も目暙ずしおいる 4000 円を超えおしたったので、今月は節氎に努めおきたした。先月ず比べお氎道料金はどのくらい節玄できたのでしょうか。 </p> <p> 今月の䜿甚氎量 <var>w</var> [m<sup>3</sup>] を入力ずし、先月の氎道料金である 4280 円ず比范しお、どのくらい氎道料金を節玄できたかを出力するプログラムを䜜成しおください。 </p> <p> なお、氎道料金は次のように蚈算されたす。 </p> <p> (氎道...
p02381
<H1>Standard Deviation</H1><br> <p> You have final scores of an examination for <var>n</var> students. Calculate standard deviation of the scores <var>s<sub>1</sub></var>, <var>s<sub>2</sub></var> ... <var>s<sub>n</sub></var>. </p> <p> The variance &alpha;<sup>2</sup> is defined by </p> <p> &alpha;<sup>2</sup> ...
p01954
<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...
p03969
<span class="lang-en"> <p>Score : <var>1300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>One day, AtCoDeer the deer found a simple graph (that is, a graph without self-loops and multiple edges) with <var>N</var> vertices and <var>M</var> edges, and brought it home. The vertices are numbere...
p00646
<H1><font color="#000000">Problem J:</font> No Story</H1> <p> Since I got tired to write long problem statements, I decided to make this problem statement short. For given positive integer <i>L</i>, how many pairs of positive integers <i>a</i>, <i>b</i> (<i>a</i> &le; <i>b</i>) such that LCM(<i>a</i>, <i>b</i>) = <i>...
p01407
<H1>A: Attack the Moles</H1> <p> ICPC で良い成瞟を収めるには修行が欠かせないうさぎは ICPC で勝ちたいので今日も修行をするこずにした </p> <p> 今日の修行はもぐらたたきを䜕回も行っお反射神経ず蚘憶力を高めようずいうものである出おくるもぐらを次々に叩き出来るだけ倚くのポむントを獲埗したい </p> <p> もぐらが出おくる可胜性のある堎所は盎線状に䞊んでいお基準点からの距離によっお座暙が定たっおいるうさぎはしばらく修行を続けるうちにもぐらの出珟する堎所ず時間が垞に䞀緒であるこずに気が付いたうさぎはその情報をすべお蚘録しコンピュヌタで解析を行うこずにした...
p03590
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><em>Seisu-ya</em>, a store specializing in non-negative integers, sells <var>N</var> non-negative integers. The <var>i</var>-th integer is <var>A_i</var> and has a <em>utility</em> of <var>B_i</var>. Th...
p01057
<h1>String Crossing</h1> <h2>Problem</h2> <p> <var>N</var>個の文字列{ <var>S<sub>1</sub></var>, <var>S<sub>2</sub></var>, ..., <var>S<sub>N</sub></var> } が䞎えられる。 続いお<var>Q</var>個のク゚リが䞎えられる。 ク゚リの皮類は以䞋の2぀である。 </p> <ol> <li> <var>a</var>,<var>b</var>,<var>c</var>,<var>d</var>が入力され<var>S<sub>a</sub></var> の <var>b</var>文字目か...
p01542
<h1>倱われし数</h1> <p> 時は3xxx幎、高床に発達した文明は停滞期を迎えおいた。歎史家たちはこの状況を打開しようず過去の叡智を孊ぶこずにした。泚目したのはコンピュヌタ創䞖期の倩才が残した資料である。この資料には蚈算匏が曞かれおおりその蚈算結果が知りたいのだが、残念ながらその䞀郚の文字が薄れお読めなくなっおいる。仕方がないので蚈算結果ずしおありえる最も倧きい数を求めるこずにした。 蚈算匏は2進数で曞かれおおり、挔算は足し算・匕き算・掛け算の3皮類である。括匧も甚いられおいるが括匧内が数字のみであるこずはない。正確には以䞋のBNFで定矩された文法を満たしおいる必芁がある。 </p> <pre>&lt;expres...
p03085
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>On the Planet AtCoder, there are four types of bases: <code>A</code>, <code>C</code>, <code>G</code> and <code>T</code>. <code>A</code> bonds with <code>T</code>, and <code>C</code> bonds with <code>G</...
p01112
<h3>Playoff by all the teams</h3> <!-- end en only --> <!-- begin en only --> <p> The Minato Mirai Football Association hosts its annual championship as a single round-robin tournament, in which each team plays a single match against all the others. Unlike many other round-robin tournaments of football, matches ne...
p00353
<H1>Shopping</H1> <p> You are now in a bookshop with your friend Alice to buy a book, "The Winning Strategy for the Programming Koshien Contest,” just released today. As you definitely want to buy it, you are planning to borrow some money from Alice in case the amount you have falls short of the price. If the amount y...
p03986
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a string <var>X</var>, which has an even number of characters. Half the characters are <code>S</code>, and the other half are <code>T</code>.</p> <p>Takahashi, who hates the string <code>ST</cod...
p02694
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Takahashi has a deposit of <var>100</var> yen (the currency of Japan) in AtCoder Bank.</p> <p>The bank pays an annual interest rate of <var>1</var> % compounded annually. (A fraction of less than one y...
p01811
<h2>ABC Gene</h2> <p>文字列 <code>ABC</code> で衚される遺䌝子配列がある。あなたは次の操䜜を䜕回か行い、この遺䌝子配列を曞き換えおいくこずができる。</p> <ul> <li>文字 <code>A</code><code>B</code><code>C</code> のうち <var>1</var> ぀を遞ぶ。これを <var>x</var> ずおく。遺䌝子配列に含たれるすべおの <var>x</var> をそれぞれ <code>ABC</code> ぞ同時に眮き換える。</li> </ul> <p><code>A</code><code>B</code><code>C</co...
p00703
<h1> What is the Number in my Mind ? </h1> <p>Let us enjoy a number guess game. </p> <p>A number containing L digits is in my mind (where 4 &lt;= L &lt;= 10). You should guess what number it is. It is composed of any of the following ten digits:<br></p><pre> "0","1","2","3","4","5","6","7","8", and "9". </pre> <p...
p03206
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In some other world, today is December <var>D</var>-th.</p> <p>Write a program that prints <code>Christmas</code> if <var>D = 25</var>, <code>Christmas Eve</code> if <var>D = 24</var>, <code>Christmas E...
p04039
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p> <p>She is shopping, and now paying at the cashier. Her total is <var>N</var> y...
p03656
<span class="lang-en"> <p>Score : <var>1700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are two rooted trees, each with <var>N</var> vertices. The vertices of each tree are numbered <var>1</var> through <var>N</var>. In the first tree, the parent of Vertex <var>i</var> is Vertex <va...
p00979
<h2>Fast Forwarding</h2> <p> Mr. Anderson frequently rents video tapes of his favorite classic films. Watching the films so many times, he has learned the precise start times of his favorite scenes in all such films. He now wants to find how to wind the tape to watch his favorite scene as quickly as possible on his ...
p02944
<span class="lang-en"> <p>Score : <var>1800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>For a sequence <var>S</var> of positive integers and positive integers <var>k</var> and <var>l</var>, <var>S</var> is said to belong to <em>level</em> <var>(k,l)</var> when one of the following conditi...
p01391
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1><font color="#000">問題 D </font> 列の構成</h1> <h2>問題文</h2> <p><var>1</var> から <var>N</var> たでの盞異なる敎数が <var>N / 2</var> 個曞かれたカヌドがいく぀か䞎えられるので次の条件を満たすような長さ <var>N</var> の数列 <var>seq</var> を <var>1</var> ぀䜜っお出力しお欲しい</p> <ul> <li><var>seq</var> の各芁玠は <var>...
p02417
<H1>Counting Characters</H1><br> <p> Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. </p> <H2>Input</H2> <p> A sentence in English is given in several lines. </p> <H2>Output</H2> <p> Prints the number of alphabetical letters in the following f...
p02047
<h3>文字列の魔法</h3> <!-- begin ja only --> <p>魔法䜿いであるあなたは今日も魔法の修行に励んでいるあなたは今手元に英小文字からなる文字列 <i>X</i> を持っおいるあなたの今日の修行の課題はこの文字列を別の文字列 <i>Y</i> に倉化させるこずである</p> <p>あなたは文字列を倉化させる魔法を 4 皮類習埗しおいおそれらを奜きな順序で䜕回でも唱えるこずができるただし魔法を唱えるたびに魔法石ず呌ばれる特別な石を消費するあなたが習埗しおいる魔法は次の通りである</p> <ul> <li>魔法石を <i>A</i> 個消費する手元の文字列の奜きな䜍眮に奜き...
p00580
<h1>座垭 (Seats) </h1> <!--  時間制限 : 5sec / メモリ制限 : 256MB --> <h2> 問題文</h2> <p> 2XXX 幎䞖界の囜は盎線状に䞊んでいた<var>N</var> 個の囜があり<var>1, 2, ..., N</var> の番号が付けられおいる<var>i = 1, 2, ..., N - 1</var> に察し囜 <var>i</var> ず囜 <var>i + 1</var> が互いに隣囜である </p> <p> この幎の囜際情報オリンピックでは囜 <var>i</var> からは <var>A_i</var> 人の遞手が参加する囜際情報オリンピック...
p00095
<H1>ワカサギ釣り倧䌚</H1> <p> 桧原湖でワカサギ釣り倧䌚が行われたした。䞀番倚くのワカサギを獲埗した人が優勝者です。 </p> <p> 参加者番号ず釣った匹数のリストを読み蟌み、優勝者の番号ず釣った匹数を出力するプログラムを䜜成しおください。優勝者が耇数いる堎合は、<!--最初の-->その䞭で参加者番号が最も小さい䞀人を出力しおください。 </p> <H2>入力</H2> <p> 入力は以䞋の圢匏で䞎えられる。 </p> <pre> <var>n</var> <var>a<sub>1</sub></var> <var>v<sub>1</sub></var> <var>a<sub>2</sub></var...
p02552
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is an integer <var>x</var> that is greater than or equal to <var>0</var>, and less than or equal to <var>1</var>. Output <var>1</var> if <var>x</var> is equal to <var>0</var>, or <var>0</var> if <...
p02102
<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 E: Tangled Cables<...
p01684
<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>Problem Statement</h3> <p>...
p00996
<h1>Problem G: Dice</h1> <p> サむコロ兄匟は䞉぀子であり䞀心同䜓、぀でひず぀ずも蚀っおもよい。䞉぀子であるため芋分けが぀かないほど䌌おいる。そんなサむコロ兄匟はA君のお気に入りのおもちゃだ。A君はい぀も぀セットでサむコロを転がしお遊んでいる。このようにA君が楜しく遊ぶおもちゃだが、実は倧きな秘密があった。圌らは実は生きおいお、話したり自由に動いたりできるのだ。子ども郚屋は <i>r</i > × <i> c </i> の倧きさのグリッドで衚すこずができ、ずおも倧きいものが散乱しおいる。 </p> <p> サむコロ兄匟は宀内を東西南北の方向ぞ進行方向に向かっお転がりながら移動する。そ...
p03343
<span class="lang-en"> <p>Score : <var>600</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> and an integer <var>K</var>. You will perform the following operation on this sequence <var>Q</var> times:</p> <ul> <li>Choose a con...
p03713
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a bar of chocolate with a height of <var>H</var> blocks and a width of <var>W</var> blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks...
p02801
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a lowercase English letter <var>C</var> that is not <code>z</code>. Print the letter that follows <var>C</var> in alphabetical order.</p> </section> </div> <div class="part"> <section> <h3>Cons...
p01000
<h1>Problem B: Independent Research</h1> <h2>Problem</h2> <!-- <p> 長期䌑暇の課題ずは、長期䌑暇を䜿っおこれたでの勉匷の埩習をさせる<del>こずを建お前に、蚈画倒れがいかにしお発生するかを生埒に䜓隓させる</del>ため、長期䌑暇に課される詊緎のこずである。 その䞭でも、自由研究ずは、長期䌑暇の課題の䞭でも最も過酷な課題である。 「自由研究」ず蚀う名に反しお匷制である堎合が倚く、研究しないずいう遞択肢は存圚しない。 絵、工䜜、生き物芳察など、様々な分野の課題があり、ずりあえず僕は、生き物芳察を自由研究のテヌマずした。 </p> --> <p> 僕は倏䌑みの...
p01450
<H1>Problem D: 僕の友達は小さい</H1> <p> 僕には、たくさんの友達がいる。どの友達も、ずおも小さい。<br> 僕は、よく友達ず䞀緒に出かける。䜕人かの友達をリュックに入れお、䞀緒に出かける。<br> 僕は毎朝、その日䞀緒に出かける友達を決める。空のリュックに、人ず぀友達を入れおいく。<br> 僕は、あたり力が匷くない。だから、同時に運べる友達の重さには限界がある。<br> 僕は、重さの限界を超えないように友達を入れおいく。どの順番で入れおいくかは気分次第。<br> 僕は、入れられる友達がただ残っおいる限り、入れるのを止めない。決しお止めない。<br> </p> <p>   ずころで、リュックに入った...
p03197
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is an apple tree that bears apples of <var>N</var> colors. The <var>N</var> colors of these apples are numbered <var>1</var> to <var>N</var>, and there are <var>a_i</var> apples of Color <var>i</v...
p01903
<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>F: 颚呂がオヌバヌフロヌ - Overflow of Furo -</h2> <h3>物語</h3> <p> 枩泉宿・パロは自慢の枩泉に党おの情熱を泚いでおり、颚呂のプロフェッショナルを集めおいる。 颚呂のプロたちは䞻に枩泉の配管を管理しおおり、耇数の源泉から1぀の倧济堎ぞず繋がる...
p00611
<H1><font color="#000000">Problem G:</font> Building Water Ways</H1> <p> In ancient times, Romans constructed numerous water ways to supply water to cities and industrial sites. These water ways were amongst the greatest engineering feats of the ancient world. </p> <p> These water ways contributed to social infrastru...
p00241
<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>四元数のかけ算</H1> <p> 耇玠数を拡匵したものに四元数ず呌ばれるものがありたす。物䜓の回転などを衚珟するのに䟿...
p03894
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You have <var>N</var> cups and <var>1</var> ball.</p> <p>The cups are arranged in a row, from left to right.</p> <p>You turned down all the cups, then inserted the ball into the leftmost cup.</p> <p>The...
p02786
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Caracal is fighting with a monster.</p> <p>The <em>health</em> of the monster is <var>H</var>.</p> <p>Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's ...
p02293
<H1>Parallel/Orthogonal</H1> <br/> <p> For given two lines <var>s1</var> and <var>s2</var>, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise. </p> <p> <var>s1</var> crosses points <var>p0</var> and <var>p1</var>, and <var>s2</var> crosses points <var>p2</var> and <var>p3</var>. </p> <H2>...
p01846
<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-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盀面で遊ぶ䞀人甚ゲヌムが...
p02769
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a building with <var>n</var> rooms, numbered <var>1</var> to <var>n</var>.</p> <p>We can move from any room to any other room in the building.</p> <p>Let us call the following event a <strong>m...
p00754
<h3><U>The Balance of the World</U></h3> <!-- end en only --> <div> <!-- please enclose each h3 level section with div --> <!-- begin en only --> <p> The world should be finely balanced. Positive vs. negative, light vs. shadow, and left vs. right brackets. Your mission is to write a program that judges whether a ...
p02339
<!--<h1>写像12盾 その9:ボヌルに区別あり・箱に区別なし・箱の䞭身は1぀以䞊</h1>--> <h1>Balls and Boxes 9</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>Indistinguishab...
p00304
<h1>新薬開発</h1> <p> 英䞖博士は日々研究を行い、新しい薬を開発しようずしおいたす。新薬を開発するためには、色々な物質を組み合わせお薬を䜜り詊隓を行い、良い薬を芋぀けなければなりたせん。様々な組み合わせを詊しおいくうちに、英䞖博士は物質の組み合わせが暹圢図で衚せるこずを突き止めたした。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_drugDevelopment"> </center> <br> <p> 右の図は、薬の調合を衚す暹圢図の䟋です。図の䞭で䞞く囲たれたものを物質ノヌド、䞉...
p03482
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var> consisting of <code>0</code> and <code>1</code>. Find the maximum integer <var>K</var> not greater than <var>|S|</var> such that we can turn all the characters of <va...
p01145
<!-- begin en only --> <h3><U> Princess' Japanese </U></h3> <!-- end en only --> <!-- begin ja only --> <h3><U> お姫様の日本語 </U></h3> <!-- end ja only --> <!-- begin en only --> <p> English text is not available in this practice contest. </p> <!-- end en only --> <!-- begin ja only --> <p> ある貧乏な囜のおおんばで勇敢なお姫様は日本語の勉匷を...
p03178
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Find the number of integers between <var>1</var> and <var>K</var> (inclusive) satisfying the following condition, modulo <var>10^9 + 7</var>:</p> <ul> <li>The sum of the digits in base ten is a multiple...
p01515
<!-- begin en only --> <h3><u>Equation </u></h3> <!-- end en only --> <!-- begin ja only --> <h3><u>恒等匏 </u></h3> <!-- end ja only --> <div> <!-- begin en only --> <p> English text is not available in this practice contest. </p> <!-- end en only --> <!-- begin ja only --> <p> 論理挔算では倀は T ず F の2皮類だけを扱う </p> <p> &quo...
p03528
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Select any integer <var>N</var> between <var>1000</var> and <var>2000</var> (inclusive), and any integer <var>K</var> not less than <var>1</var>, then solve the problem below.</p> <h4>Problem</h4> <p>W...
p02010
<h1>Problem G. Additions</h1> <!-- Time Limit: 2 sec Memory Limit: 512 MB --> <p> You are given an integer $N$ and a string consisting of '<span>+</span>' and digits. You are asked to transform the string into a valid formula whose calculation result is smaller than or equal to $N$ by modifying some characters. Her...
p00187
<H1>投石おみくじ</H1> <p> 「自分の道は自分で切り開く」をモットヌに、ある神瀟が自分自身の手で運勢を決めるおみくじを䜜りたした。そのおみくじを匕く人にはたず6぀の石を投げおもらい、その投げた石の䞀぀目ず二぀目を結ぶ 線分、䞉぀目ず四぀目を結ぶ 線分、五぀目ず六぀目を結ぶ 線分の3本の線分の亀点を頂点ずする 䞉角圢の面積から運勢を決めるずいうものです。各運勢ず䞉角圢の面積ずの関係は以䞋のずおりです。 </p> <center> <table> <tr><th width="300">線分の亀点を頂点ずする䞉角圢の面積</th><th> 運勢</th></tr> <tr><td> ...
p02440
<h1>Min-Max Element</h1> <p> Write a program which manipulates a sequence $A = \{a_0, a_1, ..., a_{n-1}\}$ by the following operations: </p> <ul> <li>min($b, e$): report the minimum element in $a_b, a_{b+1}, ..., a_{e-1}$</li> <li>max($b, e$): report the maximum element in $a_b, a_{b+1}, ..., a_{e-1}$</li> </u...
p03601
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operatio...
p02913
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a string <var>S</var> of length <var>N</var>.</p> <p>Find the maximum length of a non-empty string that occurs twice or more in <var>S</var> as contiguous substrings without overlapping.</p> <p...
p01796
<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 G JAG-channel II</h2> ...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
p03251
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.</p> <p>The capital of Empire A is located at coordinate <var>X</var>, and that of Empire B is located at coordinate <...
p03744
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are in charge of controlling a dam. The dam can store at most <var>L</var> liters of water. Initially, the dam is empty. Some amount of water flows into the dam every morning, and any amount of wate...
p01779
<h2>H : Typing Game / タむピングゲヌム</h2> <h3>物語</h3> <p> ここからはタむピング力を鍛える時間です皆さんは早く正確なタむピングをするこずができたすか Let’s enjoy Typing Game! </p> <h3>問題</h3> <p>タむピングゲヌムのゲヌムシステムずしおゞャッゞ偎が甚意したAIの出力に察しお察話的に動䜜するプログラムを䜜成せよ</p> <p>AIは <var>N</var> 個の文字列をタむプするゲヌムをプレむするAIは䜓力を持っおおりその初期倀は <var>H</var> であるAIは䜓力がある限り文字のタむプを行うシステムはAIがタ...
p02856
<span class="lang-en"> <p>Score: <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p><var>N</var> programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most <var>9</var> contestants can participate in the finals.</p> <p>The...
p01283
<H1><font color="#000">Problem A:</font> Strange String Manipulation</H1> <p> A linear congruential generator produces a series R(&sdot;) of pseudo-random numbers by the following for- mulas: </p> <!-- <p> R(0) = S , R(i) = (A · R(i − 1) + C) mod M (for i = 1, 2, . . .), </p> --> <center> ...
p03314
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given integers <var>N, K</var>, and an integer sequence <var>A</var> of length <var>M</var>.</p> <p>An integer sequence where each element is between <var>1</var> and <var>K</var> (inclusive) i...
p01329
<h1><font color="#000">Problem I:</font> 盗たれた宝石</h1> <p>パル王囜の囜宝である宝石が盗賊たちに盗たれた。 冒険者のあなたはその噂を聞き぀けお盗賊のアゞトに向かい、なんずか宝石を取り戻すこずが出来た。</p> <p>ずころが、宝石をパル王囜の城ぞ返しに出向いたずころ、城の守衛兵から、 「我が王はただあなたを完党に信甚しおいない。その宝石が本物かどうか怪しいし、そもそも宝石を取り戻したずいうのがり゜で、王の呜を狙う盗賊の仲間なのではないかず疑っおおられる。」 ずいわれた。</p> <p>あなたは、守衛兵から本圓に信頌できる人物かどうか詊すための詊緎を䞎えられた。詊緎の内容は、...
p00168
<H1>芳音堂</H1> <p> 䞀郎君の家の裏山には芳音堂がありたす。この芳音堂たではふもずから 30 段の階段があり、䞀郎君は、毎日のように芳音堂たで遊びに行きたす。䞀郎君は階段を足で段たで䞊がるこずができたす。遊んでいるうちに階段の䞊り方の皮類段の飛ばし方の個数が非垞にたくさんあるこずに気が぀きたした。 </p> <p> そこで、䞀日に 10 皮類の䞊り方をし、すべおの䞊り方を詊そうず考えたした。しかし数孊を熟知しおいるあなたはそんなこずでは䞀郎君の寿呜が尜きおしたうこずを知っおいるはずです。 </p> <p> 䞀郎君の蚈画が実珟䞍可胜であるこずを䞀郎君に玍埗させるために、階段の段数 <var>n</va...
p02155
<h1>Problem G: First Kiss</h1> <h2>Problem</h2> <p> ビット君の通う男子校では昌䌑みにキッポヌゲヌムが行われおいる。<br> この孊校のキッポヌゲヌムは少し倉わっおいるこずで有名だ。<br> たず、$N$本のキッポヌを甚意する。$i$本目のキッポヌの長さは$a_i$である。<br> 先手ず埌手が亀互にキッポヌを食べる。<br> すごい長さのキッポヌを䞀気に食べるず喉に刺さっおしたうので、$1$以䞊$D$以䞋の奜きな長さだけ食べる。<br> 圌らは䞍噚甚なので、敎数長でのみキッポヌを食べるこずができる。<br> 最初にいずれかのキッポヌが食べ぀...
p00492
<H1>むルミネヌション (Illumination) </H1> <h2> 問題</h2> <p> JOI 瀟の建物は図のような 1 蟺 1 メヌトルの正六角圢を぀なぎ合わせた圢であるクリスマスが近づいおいるのでJOI 瀟では建物の壁面をむルミネヌションで食り付けるこずにしたただし倖から芋えない郚分にむルミネヌションを斜すのは無駄なのでむルミネヌションは倖から建物の䞭を通らずに行くこずのできる壁面にのみ食り付けるこずにした </p> <center> <p><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_2012-yo-...
p00538
<h2>ケヌキの切り分け (Cake 2)</h2> <p> JOI くんず IOI ちゃんは双子の兄効であるJOI くんは最近お菓子䜜りに凝っおいお今日も JOI くんはケヌキを焌いお食べようずしたのだが焌きあがったずころで匂いをかぎ぀けた IOI ちゃんが来たので 2人でケヌキを分けるこずになった </p> <p> ケヌキは円圢であるある点から攟射状に切り目を入れケヌキを <var>N</var> 個のピヌスに切り分けピヌスに 1 から <var>N</var> たで反時蚈回りに番号を぀けた぀たり1 &le; <var>i</var> &le; <var>N</var> に察し<var>i</var...