submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 1
value | status stringclasses 1
value | code_size int64 26 8.99k | cpu_time float64 0 100 | memory float64 2.57k 99k | code stringlengths 26 8.99k | input stringlengths 2 906 | output stringlengths 2 686 | problem_description stringlengths 415 9.48k |
|---|---|---|---|---|---|---|---|---|---|---|
s715901262 | p02576 | Python | Accepted | 62 | 25 | 9,084 | N,X,T = map(int,input().split())
cnt = -(-N//X)
print(cnt * T) | 20 12 6
| 12
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi loves takoyaki - a ball-shaped snack.</p>
<p>With a takoyaki machine, he can make at most <var>X</var> pieces of takoyaki at a time, taking <var>T</var> minutes regardless of the number of pie... |
s227404596 | p03694 | Python | Accepted | 523 | 19 | 9,148 | # クリスマスもあと半年となり、トナカイのAtCoDeer君はプレゼントを配る計画を立てることにしました。
# TopCoDeer通りにはN個の家が並んでいます。i個目の家は座標aiにあります。彼はこのすべての家にプレゼントを配ることにしました。
# 好きな場所から開始し好きな場所で終了することができる時、最小の移動距離を求めなさい。
N = int(input())
a = list(map(int,input().split()))
print(max(a) - min(a)) | 4
2 3 7 9
| 7
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.<br/>
There are <var>N</var> houses along <em>TopCoDeer street</em>. The <var>i</var>-th hous... |
s559547612 | p02567 | Python | Accepted | 1,753 | 81 | 14,848 | import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
import os, zlib, base64
open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$}SA&2Hm15WWY<I}lj3krE|{7kgL)ac-Mq_tINx2(m=mglS4k%ig571ikgvK0t5np+H~Cmp;bMkQ7CcRDM=4V3EW5`{v__d`HTMc2$cjGOu@{+LkL?uBW#J-_qlwg{(J5ez9ltD=FEgsbxzFDT@aq=WJeHY}*R{t$b5(UY8kJND5|-kIM... | 5 5
1 2 3 2 1
2 1 5
3 2 3
1 3 1
2 2 4
3 1 3
| 3
3
2
6
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given an array <var>a_0, a_1, ..., a_{N-1}</var> of length <var>N</var>. Process <var>Q</var> queries of the following types.</p>
<p>The type of <var>i</var>-th query is represented by <var>T_i<... |
s556371913 | p03533 | Python | Accepted | 223 | 60 | 61,592 | A=["KIHBR","KIHABR","AKIHBR","KIHBAR","KIHBRA","AKIHABR","AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA"]
s=input()
if s in A:
print("YES")
else:
print("NO") | KIHBR
| YES
| <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>.</p>
<p>Takahashi can insert the character <code>A</code> at any position in this string any number of times.</p>
<p>Can he change <var>S</var> into <code>AKIHABARA</... |
s196419657 | p00607 | Python | Accepted | 4,936 | 20 | 5,632 | class Editer:
def __init__(self, text):
# カーソルの位置
self.row = 0 #行
self.col = 0 #列
# 編集中のテキスト
self.text = [list(t) + ['\n'] for t in text]
# バッファー
self.buffer = []
def row_head(self):
return 0
def row_tail(self):
return len(self.text)... | hyo
ni
END_OF_TEXT
f
d
f
f
k
p
p
e
y
a
k
y
y
n
y
-
| honihoni
honi
|
<H1><font color="#000000">Problem C:</font> Emacs-like Editor</H1>
<p>
Emacs is a text editor which is widely used by many programmers.
</p>
<p>
The advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pushing <span>f</span>... |
s668216812 | p03398 | Python | Accepted | 465 | 39 | 28,396 | print[0,1,2,12,84,770,8340,106400,1546888,25343766,461133960,232367169,627905865,632459808,928262728,919805769,382796331,887217496,639768068,869694124,205875097,205589953,487772376,239955313,998339621,31622834,902930073,146839084,449786840,982224660,865803735,21834818,721531716,26008837,471774471,69010090,700009308,776... | 3
| 12
| <span class="lang-en">
<p>Score : <var>1600</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Let <var>X = 10^{100}</var>. Inaba has <var>N</var> checker pieces on the number line, where the <var>i</var>-th checker piece is at coordinate <var>X^{i}</var> for all <var>1 \leq i \leq N</var>.</p>
... |
s009469424 | p00020 | Python | Accepted | 29 | 10 | 4,604 | print raw_input().swapcase()
| this is a pen.
| THIS IS A PEN.
|
<H1>Capitalize</H1>
<p>
Write a program which replace all the lower-case letters of a given text with the corresponding captital letters.
</p>
<H2>Input</H2>
<p>
A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200.
</p>
<H2>... |
s125064404 | p02312 | Python | Accepted | 2,432 | 60 | 7,348 | from math import acos, hypot, isclose, sqrt
from typing import List, Tuple
def intersection(circle: Tuple[int, int, int],
polygon: List[Tuple[float, float]]) -> float:
x, y, r = circle
area = 0.0
for p1, p2 in zip(polygon, polygon[1:] + [polygon[0]]):
ps = seg_intersection(circle... | 3 5
1 1
4 1
5 5
| 4.639858417607
|
<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>Intersection of a Circle and a Polygon</H1>... |
s948499044 | p00354 | Python | Accepted | 79 | 20 | 5,588 | ans=["thu","fri","sat","sun","mon","tue","wed"]
i=int(input())
print(ans[i%7])
| 1
| fri
|
<!--<H1>X-th day of September</H1>-->
<h1>Day of Week</h1>
<p>
The 9th day of September 2017 is Saturday. Then, what day of the week is the X-th of September 2017?
</p>
<p>
Given a day in September 2017, write a program to report what day of the week it is.
</p>
<h2>Input</h2>
<p>
The input is given in t... |
s949780828 | p01858 | Python | Accepted | 1,281 | 10 | 6,464 | K = int(raw_input())
nakaji = isono = 0
for I, N in zip([raw_input() for i in xrange(K)], [raw_input() for i in xrange(K)]):
lose1 = lose2 = False
if I == "kougekida" and isono == 0: lose1 = True
if N == "kougekida" and nakaji == 0: lose2 = True
if lose1 and lose2: continue
elif lose1:
print... | 3
tameru
tameru
tameru
tameru
kougekida
tameru
| Nakajima-kun
|
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>-->
<h2>A: 磯野、あれやろうぜ! - Sendame -</h2>
<h3>物語</h3>
<p>中島「磯野〜,あれやろうぜ!」</p>
<p>磯野「あれって何だよ,中島」</p>
<p>中島「ほら,あれだよ,あれ.なぜか文字で表さなきゃならないから,説明しづらいな〜」</p>
<p>磯野「いや,図や写真も入れられるみたいだぞ?」</p>
<img src="https://judgeapi.u-aizu... |
s971614031 | p00435 | Python | Accepted | 348 | 20 | 5,716 | x = input()
str_list = list(x)
dict_ = {
"D":"A",
"E":"B",
"F":"C",
"G":"D",
"H":"E",
"I":"F",
"J":"G",
"K":"H",
"L":"I",
"M":"J",
"N":"K",
"O":"L",
"P":"M",
"Q":"N",
"R":"O",
"S":"P",
"T":"Q",
"U":"R",
"V":"S",
"W":"T",
"X":"U",
"Y":"V",
"Z":"W",
"A":"X",
"B":"Y",
"C":"Z"
}
for a in str_list:
print(dict_... | MRL
| JOI
|
<H1>シーザー暗号</H1>
<h2>問題</h2>
<p>
ガイウス・ユリウス・カエサル(Gaius Julius Caesar),英語読みでジュリアス・シーザー(Julius Caesar)は,古代ローマの軍人であり政治家である.カエサルは,秘密の手紙を書くときに, 'A' を 'D' に, 'B' を 'E' に, 'C' を 'F' に,というように3つずらして表記したという記録が残っている.
</p>
<p>
大文字のアルファベット26文字だけからなる文字列を,カエサルがしたように3文字ずつずらす変換を施し得られた文字列がある.このような文字列を元の文字列に戻すプログラムを作成せよ.
</p>
<p>
各文字の変... |
s938943334 | p00433 | Python | Accepted | 162 | 20 | 4,192 | a_score = sum(map(int, raw_input().split()))
b_score = sum(map(int, raw_input().split()))
if a_score > b_score: print a_score
else: print b_score | 100 80 70 60
80 70 80 90
| 320
|
<H1>得点</H1>
<h2>問題</h2>
<p>
JOI高校の2人の生徒 A さんと B さんは,情報,数学,理科,英語の4教科の試験を受けた. A さんと B さんのこれら4教科の得点が与えられると, Aさんの合計点 S と Bさんの合計点 T のうち大きな方を出力するプログラムを作成せよ.ただし,同点の場合は S (= T) を出力せよ.
</p>
<H2>入力</H2>
<p>
<!--入力ファイルは2行からなる.-->
入力は2行からなる.
</p>
<p>
1行目は4つの整数が1つの空白を区切りとして書かれており,それぞれ順に, A さんの情報の得点,数学の得点,理科の得点,英語の得点を表している.
<... |
s169448030 | p01905 | Python | Accepted | 97 | 20 | 5,580 | # AOJ 2805: Tournament
# Python3 2018.7.11 bal4u
N, M = map(int, input().split())
print(N-1-M)
| 2 0
| 1
|
<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>A: トーナメント</h1>
<h2>問題</h2>
<p>
AOR イカちゃんとあなたは、トーナメント形式の卓球大会... |
s089387393 | p03167 | Python | Accepted | 2,418 | 99 | 80,800 | ''' ===============================
-- @uthor : Kaleab Asfaw
-- Handle : kaleabasfaw2010
-- Bio : High-School Student
==============================='''
# Fast IO
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file): self._fd = file.fil... | 3 4
...#
.#..
....
| 3
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>There is a grid with <var>H</var> horizontal rows and <var>W</var> vertical columns.
Let <var>(i, j)</var> denote the square at the <var>i</var>-th row from the top and the <var>j</var>-th column from t... |
s664158188 | p02255 | Python | Accepted | 1,048 | 20 | 5,600 | length=int(input())
firstArray=input()
listForArray=list(map(int,firstArray.split()))
listForPrint=[firstArray]
def insertionSort(list,length):
index=1
while index<length:
if listForArray[index]<=listForArray[index-1]:
for index2 in range(0,index):
if listForArray[index2-1]... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
|
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... |
s444434531 | p03891 | Python | Accepted | 137 | 73 | 61,900 | a=int(input())
b=int(input())
c=int(input())
d=c*3-a-b
g=c*2-d
h=c*2-b
i=c*2-a
e=c*3-a-g
f=c*3-d-i
print(a,b,d)
print(e,c,f)
print(g,h,i) | 8
3
5
| 8 3 4
1 5 9
6 7 2
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>A <var>3×3</var> grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the to... |
s073784356 | p03388 | Python | Accepted | 1,554 | 29 | 9,444 | q=int(input())
ab=[list(map(int,input().split())) for _ in range(q)]
from math import floor
for a,b in ab:
# a*bをぎりぎりまで攻めたい
# (1,1)とかはもったいない。(1,a*b-1)は良い。片方は√a*b未満で、片方は√a*bより大きい組み合わせ。
# a==bならa未満の整数yについて適切な数字xを選べばy*x<a*bとできる。xは他のxと被らないように選択できる。
if a==b:
print(2*a-2)
else:
# t,t+1 組み合... | 8
1 4
10 5
3 3
4 11
8 9
22 40
8 36
314159265 358979323
| 1
12
4
11
14
57
31
671644785
| <span class="lang-en">
<p>Score : <var>700</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p><var>10^{10^{10}}</var> participants, including Takahashi, competed in two programming contests.
In each contest, all participants had distinct ranks from first through <var>10^{10^{10}}</var>-th.</p>
<... |
s934603618 | p02696 | Python | Accepted | 123 | 64 | 61,860 | a,b,n=map(int,input().split())
x=min(b-1,n) #上記よりxとしてmin(B-1,N)を選ぶのが最善
print((a*x)//b-a*(x//b)) | 5 7 4
| 2
| <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given are integers <var>A</var>, <var>B</var>, and <var>N</var>.</p>
<p>Find the maximum possible value of <var>floor(Ax/B) - A × floor(x/B)</var> for a non-negative integer <var>x</var> not greater tha... |
s107222901 | p02801 | Python | Accepted | 37 | 62 | 61,668 | print(chr(ord(input().strip()) + 1))
| a
| b
| <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... |
s970409947 | p02715 | Python | Accepted | 934 | 96 | 69,056 | n, k = map(int, input().split())
mod = 10**9 + 7
# For each X, in 1<= X <= K, let us find the number of sequences {A1, A2, .., An} with GCD = X.
# The necessary and sufficient condition of the greatest common divisor being a multiple of X
# is that all the A1, ..., AN are multiples of X. The number of such sequences ... | 3 2
| 9
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Consider sequences <var>\{A_1,...,A_N\}</var> of length <var>N</var> consisting of integers between <var>1</var> and <var>K</var> (inclusive).</p>
<p>There are <var>K^N</var> such sequences. Find the su... |
s893956280 | p02909 | Python | Accepted | 113 | 21 | 8,832 | S = input()
if S == 'Sunny':
print('Cloudy')
elif S == 'Cloudy':
print('Rainy')
else:
print('Sunny') | Sunny
| Cloudy
| <span class="lang-en">
<p>Score: <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3>
<p>The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...</p>
<p>Given is a string <var>S</var> representing the weather in the town tod... |
s113807170 | p02735 | Python | Accepted | 623 | 91 | 74,104 | H, W = map(int,input().split())
grid = [input() for _ in range(H)]
dp = [[float('inf')]*(W) for _ in range(H)]
dp[0][0] = 0 if grid[0][0] == '.' else 1
for i in range(H):
for k in range(W):
if i+1 < H:
if grid[i][k] == '.' and grid[i+1][k] == '#':
dp[i+1][k] = min(dp[i][k]+1,dp[i... | 3 3
.##
.#.
##.
| 1
| <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Consider a grid with <var>H</var> rows and <var>W</var> columns of squares. Let <var>(r, c)</var> denote the square at the <var>r</var>-th row from the top and the <var>c</var>-th column from the left.
... |
s498456168 | p00007 | Python | Accepted | 138 | 10 | 4,708 | import math
price = 100000.0
n = int(raw_input())
for i in range(n):
price = math.ceil((price * 1.05) / 1000) * 1000
print int(price)
| 5
| 130000
|
<H1>Debt Hell</H1>
<p>
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week.
</p>
<p>
Write a program which computes the amount of the debt in <var>n</var> wee... |
s889897473 | p02847 | Python | Accepted | 122 | 28 | 8,972 | def resolve():
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']
s = input()
print(7-week.index(s))
resolve() | SAT
| 1
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given is a string <var>S</var> representing the day of the week today.</p>
<p><var>S</var> is <code>SUN</code>, <code>MON</code>, <code>TUE</code>, <code>WED</code>, <code>THU</code>, <code>FRI</code>, ... |
s045969688 | p00606 | Python | Accepted | 1,068 | 20 | 6,400 | time = -1
place = ["a","b","c","d","e","f","g","h","i"]
empty_count={}
for i in place:
empty_count[i] = 0
count_d = empty_count.copy()
def reset():
global d
global count_d
d={"a":["a","a","b","d"],"b":["a","e","c","b"],"c":["b","f","c","c"],"d":["a","e","g","d"],"e":["b","d","f","h"],"f":["c","e","i","f"],"g":["d... | 1
E A C
1
E B C
2
E A B
0
| 0.00000000
0.25000000
0.06250000
|
<H1><font color="#000000">Problem B:</font> Cleaning Robot</H1>
<p>
Dr. Asimov, a robotics researcher, loves to research, but hates houseworks and his house were really dirty. So, he has developed a cleaning robot.
</p>
<p>
As shown in the following figure, his house has 9 rooms, where each room is identified by an ... |
s981851807 | p03742 | Python | Accepted | 61 | 67 | 61,644 | print(["Alice","Brown"][-1<=eval(input().replace(*" -"))<=1]) | 2 1
| Brown
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Alice and Brown loves games. Today, they will play the following game.</p>
<p>In this game, there are two piles initially consisting of <var>X</var> and <var>Y</var> stones, respectively.
Alice and Bob ... |
s322831715 | p02415 | Python | Accepted | 81 | 20 | 5,548 | def main():
print(input().swapcase())
if __name__ == '__main__':
main()
| fAIR, LATER, OCCASIONALLY CLOUDY.
| Fair, later, occasionally cloudy.
|
<H1>Toggling Cases</H1><br>
<p>
Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.
</p>
<H2>Input</H2>
<p>
A string is given in a line.
</p>
<H2>Output</H2>
<p>
Print the converted string in a line. Note that you do not need to convert any characters othe... |
s885658910 | p02939 | Python | Accepted | 126 | 67 | 9,304 | s = input()
ans = 0
a = b = ""
for i in s:
b += i
if a != b:
a = b
b = ""
ans += 1
print(ans)
| aabbaa
| 4
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given is a string <var>S</var> consisting of lowercase English letters. Find the maximum positive integer <var>K</var> that satisfies the following condition:</p>
<ul>
<li>There exists a partition of <v... |
s594356635 | p00148 | Python | Accepted | 66 | 10 | 4,188 | while 1:
try: print '3C%02d' %((input()-1)%39+1)
except: break | 50
5576
5577
5578
| 3C11
3C38
3C39
3C01
|
<H1>キャンディーとクラス旗</H1>
<p>
3年C組では、平成19年11月10日の体育祭で使用する「クラス旗」を、将来のクラス会の時にも使うことにしました。そこで「クラス旗」を保管する生徒を決めるために、先生が先日差し入れてくれた大量のキャンディーを使って次のようなゲームを行うことにしました。
</p>
<ul>
<li>各生徒は生徒番号の順に1個ずつキャンディーを取ります。</li>
<li>一巡してもキャンディーが残っていたら、最初の生徒番号の人から順々にキャンディーを取り続けます。</li>
<li>最後のキャンディーを取った人が「クラス旗」を保管する生徒になります。</li>
</ul>
<p>
3年C組の... |
s908556789 | p02553 | Python | Accepted | 71 | 29 | 8,984 | a, b, c, d = map(int, input().split())
print(max([a*c, b*c, a*d, b*d])) | 1 2 1 1
| 2
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given are integers <var>a,b,c</var> and <var>d</var>.
If <var>x</var> and <var>y</var> are integers and <var>a \leq x \leq b</var> and <var>c\leq y \leq d</var> hold, what is the maximum possible value ... |
s511681237 | p02945 | Python | Accepted | 173 | 23 | 9,172 | A,B=map(int,input().split())
if (A+B)>=(A-B) and (A+B)>=(A*B):
print(A+B)
elif (A-B)>=(A+B) and (A-B)>=(A*B):
print(A-B)
elif (A*B)>=(A+B) and (A*B)>=(A-B):
print(A*B) | -13 3
| -10
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have two integers: <var>A</var> and <var>B</var>.</p>
<p>Print the largest number among <var>A + B</var>, <var>A - B</var>, and <var>A \times B</var>.</p>
</section>
</div>
<div class="part">
<sectio... |
s250337778 | p02419 | Python | Accepted | 495 | 20 | 5,564 | def main():
Counter = 0
Text_W = input()
while True:
Text_T = input()
if "END_OF_TEXT" in Text_T:
temp = Text_T.lower().split()
for i in range(len(temp)):
Counter += 1 if Text_W == temp[i] else 0
break
else:
temp = Text... | computer
Nurtures computer scientists and highly-skilled computer engineers
who will create and exploit "knowledge" for the new era.
Provides an outstanding computer environment.
END_OF_TEXT
| 3
| <H1>Finding a Word</H1><br>
<p>
Write a program which reads a word <var>W</var> and a text <var>T</var>, and prints the number of word <var>W</var> which appears in text <var>T</var>
</p>
<p>
<var>T</var> consists of string <var>T<sub>i</sub></var> separated by space characters and newlines. Count the number of <va... |
s697218269 | p03136 | Python | Accepted | 273 | 26 | 8,896 | # listを並び替えてif-elseで条件分岐
N = int(input())
L = list(map(int, input().split()))
descending_L = sorted(L, reverse=True)
# print(descending_L)
other_side = sum(descending_L[1:])
if descending_L[0] < other_side:
print('Yes')
else:
print('No')
| 4
3 8 5 1
| Yes
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Determine if an <var>N</var>-sided polygon (not necessarily convex) with sides of length <var>L_1, L_2, ..., L_N</var> can be drawn in a two-dimensional plane.</p>
<p>You can use the following theorem:<... |
s678635123 | p02321 | Python | Accepted | 1,174 | 20 | 5,628 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
def branchAndBound(N, items, lim_w):
items.sort(key=lambda x: x[0] / x[1], reverse=True)
Value = []
Weight = []
Ratio = []
for v, w in items:
Value.append(v)
Weight.append(w)
Ratio.append(v / w)
def upperbound(cur, cur_w, cur_v):... | 4 5
4 2
5 2
2 1
8 3
| 13
|
<H1>Huge Knapsack Problem</H1>
<br/>
<p>
You have <var>N</var> 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 large... |
s827019671 | p02859 | Python | Accepted | 28 | 28 | 8,836 | r = int(input())
print(r*r) | 2
| 4
| <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>r</var>.</p>
<p>How many times is the area of a circle of radius <var>r</var> larger than the area of a circle of radius <var>1</var>?</p>
<p>It can be proved that the answer is... |
s171758791 | p03369 | Python | Accepted | 39 | 20 | 8,704 | s=input()
print((s.count('o'))*100+700) | oxo
| 900
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs <var>700</var> yen (the currency of Japan), plus <var>100</var> yen for each kind of topping (boiled egg, sliced pork, green onions).</p>
<p>... |
s006555876 | p02399 | Python | Accepted | 208 | 20 | 5,624 | #coding:utf-8
'''
a ÷ b : d (整数)
a ÷ b の余り : r (整数)
a ÷ b : f (浮動小数点数)
'''
a, b = map(int, input().split())
d = a // b
r = a % b
f = a / b
print('%d %d %.8f' % (d, r, f))
| 3 2
| 1 1 1.50000
|
<H1>A/B Problem</H1>
<p>
Write a program which reads two integers <var>a</var> and <var>b</var>, and calculates the following values:
</p>
<ul>
<li><var>a</var> ÷ <var>b</var>: <var>d</var> (in integer)</li>
<li>remainder of <var>a</var> ÷ <var>b</var>: <var>r</var> (in integer)</li>
<li><var>a... |
s996136946 | p01859 | Python | Accepted | 1,204 | 20 | 5,608 | li, ri = map(int, input().split())
ln, rn = map(int, input().split())
ISONO = True
NAKAJIMA = False
def search(li, ri, ln, rn, turn):
if li == None and ri == None:
return False
if ln == None and rn == None:
return True
if turn == ISONO:
ret = False
if li and ln:
ret = ret or search(li, ri,... | 3 2
2 2
| NAKAJIMA
|
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>-->
<h2>B: 中島、あれやろうぜ! - Match Peas War -</h2>
<h3>問題</h3>
<p>中島「うぅっ・・・」</p>
<p>磯野「中島,大丈夫か?」</p>
<p>中島「・・・なんだか嫌な夢を見ていた気がするよ」</p>
<p>磯野「どんな夢だい?」</p>
<p>中島「無限に遊ぶ夢」</p>
<p>磯野「意味わからん.まぁいいや,中島,あれやろうぜ!」</p>
<p>中島「あれ... |
s209541683 | p00081 | Python | Accepted | 299 | 10 | 4,232 | import sys
for s in sys.stdin:
x1,y1,x2,y2,xq,yq = map(float,s.split(","))
dx,dy = x2-x1,y2-y1
det = dx*dx+dy*dy
y0 = dx*(y1*dx-x1*dy) + dy*(yq*dy+xq*dx)
x0 = -dy*(y1*dx-x1*dy) + dx*(yq*dy+xq*dx)
x0 /= det
y0 /= det
xp = x0+(x0-xq)
yp = y0+(y0-yq)
print xp,yp | 1.0,0.0,-1.0,0.0,1.0,1.0
1.0,0.0,0.0,-1.0,3.0,0.0
0.0,1.0,0.0,-1.0,1.0,1.0
| 1.000000 -1.000000
1.000000 2.000000
-1.000000 1.000000
|
<H1>線対称</H1>
<p>
平面上の異なる 3 点 <var>P1(x1,y1)</var>, <var>P2(x2,y2)</var>, <var>Q(xq,yq)</var> の座標の組を読み込んで、点 <var>P1</var> 点<var>P2</var> を通る直線を対称軸として点 <var>Q</var> と線対称の位置にある点 <var>R(x,y)</var> を出力するプログラムを作成してください。なお、点 <var>Q</var> は、その対称軸上にないものとします。
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/i... |
s848963629 | p02016 | Python | Accepted | 74 | 20 | 5,540 | s = input()
if s == "ani":
print("square1001")
else:
print("e869120")
| ani
| square1001
| <h2>B: 双子 (Twins)</h2>
<p>とある双子は、自分たちのどちらが兄でどちらが弟かがあまり知られていないことに腹を立てた。</p>
<p>"ani" と入力されたら "square1001"、"otouto" と入力されたら "e869120" と出力するプログラムを作りなさい。</p>
<h3>入力</h3>
<p>入力として "ani" または "otouto" という文字列のどちらかが与えられます。</p>
<h3>出力</h3>
<p>"e869120" または "square1001" を、問題文の通りに出力してください。最後の改行を忘れないようにしましょう。</p>
<h3>入力例1</h3>
... |
s731849660 | p02022 | Python | Accepted | 116 | 100 | 18,516 | n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
print(sum(a)*sum(b))
| 3 2
3 1 5
2 4
| 54
| <h2>H: 慈悲 (Mercy)</h2>
<p>サンタクロースは、クリスマスなのにプログラミングをやっている集団を見つけた。</p>
<p>サンタクロースは彼らを可哀想に思ったので、ケーキをプレゼントすることにした。</p>
<p>クリームが $N$ 種類あって、美味しさは $A_1, A_2, A_3, \dots, A_N$ である。</p>
<p>スポンジが $M$ 種類あって、美味しさは $B_1, B_2, B_3, \dots, B_M$ である。</p>
<p>クリーム 1 種類とスポンジ 1 種類を組み合わせてケーキを作り、その美味しさは (クリームの美味しさ) × (スポンジの美味しさ) になる。</p>
<... |
s386184267 | p00595 | Python | Accepted | 208 | 20 | 4,200 | def gcd(m,n):
while m%n>0:
m,n=n,m%n
else:
return n
while True:
try:
m,n = map(int,raw_input().split())
print gcd(m,n)
except EOFError:
break | 57 38
60 84
| 19
12
|
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... |
s607631239 | p03332 | Python | Accepted | 429 | 94 | 85,200 | n,a,b,k=map(int,input().split())
mod1,mod2=10**9+7,998244353
mod=mod2
fact=[1]*(n+1)
inv=[1]*(n+1)
for i in range(2,n+1):
fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n,1,-1):
inv[i-1]=inv[i]*i%mod
def comb(x,y):return fact[x]*inv[y]%mod*inv[x-y]%mod if x>=y>=0 else 0
ans=0
for i in ra... | 4 1 2 5
| 40
| <span class="lang-en">
<p>Score : <var>700</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi has a tower which is divided into <var>N</var> layers.
Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower.
... |
s858597585 | p03834 | Python | Accepted | 49 | 21 | 9,028 | haike = input().split(',')
print(' '.join(haike)) | happy,newyear,enjoy
| happy newyear enjoy
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>As a New Year's gift, Dolphin received a string <var>s</var> of length <var>19</var>.<br/>
The string <var>s</var> has the following format: <code>[five lowercase English letters],[seven lowercase Engli... |
s963330449 | p02675 | Python | Accepted | 216 | 29 | 9,036 | n = input()
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] =="7" or n[-1] == "9":
print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
print("pon")
else:
print("bon")
| 16
| pon
| <span class="lang-en">
<p>Score: <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3>
<p>The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.</p>
<p>When counting pencils in Japanese, the counter word "本" follows the number. The pro... |
s050443659 | p00111 | Python | Accepted | 620 | 30 | 4,284 | import sys
def f1(s): return "".join([d0[c] for c in s])
d0={"M":"10010","N":"10011"}
a="ABCD";
for i in range(4): d0[a[i]]=format(i,"02b")
a="EFGHIJKL"
for i in range(8): d0[a[i]]=format(i,"03b")
L0="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
L1=" ',-.?"+L0
L2=L0+" .,-'?"
dc={}
a="J,EE,EH,MF,GF,EF,IJ,NG,BB,AB,K,BF,NH,GE,BD,NE,BC,... | ?D-C'KOPUA
| PETER POTTER
|
<H1>博士の暗号</H1>
<p>
博 士 : ?D-C'KOPUA
</p>
<p>
ピーター : どうしたんですか、デビッド博士? わけのわからないことを叫ぶのにはもう慣れましたが、
今日は文章にすらなっていませんよ。
</p>
<p>
博 士 : ほれ。
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_memorableCodes1">
</center>
<br/>
<p>
ピーター : なんですか? この表は......ああ、予選の問題にこんなのがありました。表を使って文字を置き換え... |
s642203400 | p00064 | Python | Accepted | 71 | 30 | 6,548 | import sys,re
print(sum(map(int,re.findall(r"\d+",sys.stdin.read()))))
| Thereare100yenonthetable.Iam17yearsold.
Ishouldgohomeat6pm.
| 123
|
<H1>暗証番号</H1>
<p>
新しい暗証番号は覚えにくいものです。メモするのはダメといわれましたが、覚えられそうにありません。そこで文章の中に数値を埋め込んで暗証番号をメモすることにしました。ここでは全ての数値の和が暗証番号になります。
</p>
<p>
メモされた文章を読み込んで、暗証番号を出力するプログラムを作成してください。
</p>
<H2>Input</H2>
<p>
正の整数が埋め込まれた文章が複数行にわたり与えられます。各行は半角英数字、記号、空白を含む文字列または空行です。
ただし、入力は 1 行あたり 80 文字以内で、暗証番号は 10,000 以下であることが保障されています。
</p>
<... |
s049922902 | p02663 | Python | Accepted | 89 | 71 | 61,448 | H1, M1, H2, M2, K = map(int, input().split())
T = (H2 - H1) * 60 + (M2 - M1)
print(T - K) | 10 0 15 0 30
| 270
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>In this problem, we use the <var>24</var>-hour clock.</p>
<p>Takahashi gets up exactly at the time <var>H_1</var> : <var>M_1</var> and goes to bed exactly at the time <var>H_2</var> : <var>M_2</var>. (S... |
s095304763 | p02542 | Python | Accepted | 8,952 | 51 | 13,828 | code = r'''
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include,/opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
from libcpp cimport bool
from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp.pair c... | 3 3
o..
...
o.#
| 4
| <span class="lang-en">
<p>Score : <var>600</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>There is a board with <var>N</var> rows and <var>M</var> columns.
The information of this board is represented by <var>N</var> strings <var>S_1,S_2,\ldots,S_N</var>.
Specifically, the state of the squar... |
s096910698 | p02052 | Python | Accepted | 401 | 20 | 5,608 | H,W=map(int,input().split())
MAP=[list(input()) for i in range(H)]
BLIST=[]
for i in range(H):
for j in range(W):
if MAP[i][j]=="B":
BLIST.append([i,j])
BLIST.sort(key=lambda x:x[0]+x[1])
ANS=abs(BLIST[0][0]-BLIST[-1][0])+abs(BLIST[0][1]-BLIST[-1][1])
BLIST.sort(key=lambda x:x[0]-x[1])
ANS=m... | 3 3
B.B
..B
.BB
| 4
| <h2>A: Hokkaido University Easy</h2>
<h3>注意</h3>
<p> 問題設定は B 問題と同一のものですが、制約のみが異なりますのでご注意ください。</p>
<h3>物語</h3>
<p> 北海道大学に合格し、新たな生活の始まりに心を躍らせるほむらちゃん。しかし彼女の前には、とてつもなく広いキャンパスが待ち受けていた...。</p>
<p> 「え...次の授業に間に合わないんだけど...」</p>
<h3>問題</h3>
<p> 北海道大学札幌キャンパスは異常に広いことで有名です。札幌キャンパスは縦に <var>H</var> マス、横に <var>W</var> マス並んだ長方形のマス... |
s673025921 | p00333 | Python | Accepted | 98 | 20 | 5,660 | import math
W,H,C=map(int,input().split())
sikaku=math.gcd(W,H)
print(C*(W*H)//(sikaku*sikaku))
| 10 20 5
| 10
|
<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>
会津県では人口増加のためにニュータウンを作ること... |
s541529419 | p00466 | Python | Accepted | 169 | 30 | 6,720 | while(1):
N=int(input())
if(N==0):
exit()
l=[]
for i in range(9):
tmp=int(input())
l.append(tmp)
ans=0
for i in range(9):
ans+=l[i]
a=N-ans
print(a)
| 9850
1050
800
420
380
600
820
2400
1800
980
0
| 600
|
<H1>レシート </H1>
<h2>問題</h2>
<p>
太郎君は10冊の本を購入した.
後日,
レシートをもとに価格を調べようとしたが,
レシートには汚れがあり,
ある本の価格が読み取れなかった.
その本の価格を,
10冊の総額と他の9冊の価格から計算することにした.
</p>
<p>
価格が読み取れなかった本の価格を出力するプログラムを書け.
なお,本の価格はすべて正の整数である.
また,消費税を考慮する必要はない.
</p>
<h2> 入力</h2>
<p>
入力は複数のデータセットからなる.各データセットは以下の形式で与えられる.
</p>
<p>
各データセットは10行からなり,1行に1つずつ正の整数... |
s237164062 | p03252 | Python | Accepted | 250 | 49 | 9,708 | import collections
A = input()
B = input()
A_c = collections.Counter(A)
B_c = collections.Counter(B)
A_c = A_c.values()
B_c = B_c.values()
A_c = list(A_c)
B_c = list(B_c)
A_c.sort()
B_c.sort()
if A_c == B_c:
print("Yes")
else:
print("No")
| azzel
apple
| Yes
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given strings <var>S</var> and <var>T</var> consisting of lowercase English letters.</p>
<p>You can perform the following operation on <var>S</var> any number of times:</p>
<p>Operation: Choose ... |
s150531799 | p03085 | Python | Accepted | 100 | 30 | 8,836 | moji = str(input())
correct = ["A","C","G","T"]
ind = correct.index(moji) + 1
print(correct[ind*-1]) | A
| T
| <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</... |
s110833628 | p03575 | Python | Accepted | 801 | 28 | 9,196 | # Union Find
# xの根を求める
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
# xとyの属する集合の併合
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
# x < y にする
if par[x] > par[y]:
x, y = y, x
... | 7 7
1 3
2 7
3 4
4 5
4 6
5 6
6 7
| 4
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given an undirected connected graph with <var>N</var> vertices and <var>M</var> edges that does not contain self-loops and double edges.<br/>
The <var>i</var>-th edge <var>(1 \leq i \leq M)</var... |
s361106056 | p02700 | Python | Accepted | 1,594 | 27 | 9,208 | '''
問題:
高橋君と青木君がモンスターを闘わせます。
高橋君のモンスターは体力が A で攻撃力が B です。
青木君のモンスターは体力が C で攻撃力が D です。
高橋君→青木君→高橋君→青木君→... の順に攻撃を行います。
攻撃とは、相手のモンスターの体力の値を自分のモンスターの攻撃力のぶんだけ減らすことをいいます。
このことをどちらかのモンスターの体力が 0 以下になるまで続けたとき、
先に自分のモンスターの体力が 0 以下になった方の負け、そうでない方の勝ちです。
高橋君が勝つなら Yes、負けるなら No を出力してください。
'''
'''
制... | 10 9 10 10
| No
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Takahashi and Aoki will have a battle using their monsters.</p>
<p>The health and strength of Takahashi's monster are <var>A</var> and <var>B</var>, respectively, and those of Aoki's monster are <var>C<... |
s676588810 | p02383 | Python | Accepted | 1,197 | 20 | 5,608 | class Dice:
def __init__(self):
# 初期値がない場合
self.t = 1
self.s = 2
self.e = 4
self.w = 8
self.n = 16
self.b = 32
def __init__(self, t, s, e, w, n, b):
# 初期値が指定される場合
self.t = t
self.s = s
self.e = e
self.w = w
... | 1 2 4 8 16 32
SE
| 8
|
<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>Dice I</h1><br>
<p>
Wri... |
s106297760 | p02924 | Python | Accepted | 766 | 68 | 65,624 | import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7
import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): retu... | 2
| 1
| <span class="lang-en">
<p>Score : <var>400</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>For an integer <var>N</var>, we will choose a permutation <var>\{P_1, P_2, ..., P_N\}</var> of <var>\{1, 2, ..., N\}</var>.</p>
<p>Then, for each <var>i=1,2,...,N</var>, let <var>M_i</var> be the remain... |
s003961310 | p03039 | Python | Accepted | 1,389 | 77 | 81,804 | # N, M から相異なる二点を取った時のマンハッタン距離の、二点の取り方についての総和を、
# _{N + M - 2} C _{K - 2} 倍したものが答え。
N, M, K = map(int, input().split())
# コンビネーション前計算。
MOD = 10 ** 9 + 7
table_len = 2 * 10 ** 5 + 10
fac = [1, 1]
for i in range(2, table_len):
fac.append(fac[-1] * i % MOD)
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, M... | 2 2 2
| 8
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have a grid of squares with <var>N</var> rows and <var>M</var> columns. Let <var>(i, j)</var> denote the square at the <var>i</var>-th row from the top and <var>j</var>-th column from the left. We wi... |
s868966337 | p02786 | Python | Accepted | 209 | 24 | 9,032 | H = int(input())
attackcnt = 0
monstercnt = 1
def monster(h, m, a):
if h == 1:
return 0,0,a+m
else:
return monster(int((h/2)),2*m,a+m)
a, b, c = monster(H,monstercnt,attackcnt)
print(c) | 2
| 3
| <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 ... |
s107568243 | p03751 | Python | Accepted | 135 | 37 | 11,020 | from bisect import*
n,*s,t=open(0)
x,y=[sorted(u.replace('?',c)for u in s)for c in'za']
print(*range(bisect_left(x,t)+1,bisect(y,t)+2)) | 2
tourist
petr
e
| 1
| <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 ... |
s644582585 | p01019 | Python | Accepted | 2,232 | 40 | 6,288 | dic = {((0, 0), (0, 1), (0, 2), (0, 3), (0, 4),
(1, 0), (1, 4),
(2, 0), (2, 1), (2, 2), (2, 3), (2, 4)):"0",
((0, 0), (0, 1), (0, 2), (0, 3), (0, 4)):"1",
((0, 0), (0, 2), (0, 3), (0, 4),
(1, 0), (1, 2), (1, 4),
(2, 0), (2, 1), (2, 2), (2, 4)):"2",
((0, 0), (0, 2)... | 4
1 1 1 5
3 3 5 3
4 2 4 4
7 1 7 5
| 2
|
<h1>Problem D: Cheat Case</h1>
<h2>Problem</h2>
<p>
算数のテストを受けることになった俺達は、今から勉強しても赤点を取ってしまうことを確信し、カンニングで乗り切ることを決意した。
</p>
<p>
算数のテスト問題を作成するA先生はテスト用紙を手書きで作ることで知られている。彼がテスト問題を作成している時の筆跡情報を、近所の博士に作ってもらった筆跡盗聴鉛筆で盗み取る作戦だ。だが肝心の筆跡情報から問題を復元するプログラムは博士の技術では作ることができなかった。しかも、たとえ問題が復元できたとしても、俺達の頭脳では問題を解くことができない。どうすることもできなくなった俺達は、プログ... |
s474679248 | p03399 | Python | Accepted | 97 | 32 | 8,928 | A = int(input())
B = int(input())
C = int(input())
D = int(input())
print(min(A, B) + min(C, D))
| 600
300
220
420
| 520
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You planned a trip using trains and buses.
The train fare will be <var>A</var> yen (the currency of Japan) if you buy ordinary tickets along the way, and <var>B</var> yen if you buy an unlimited ticket.... |
s066931644 | p02619 | Python | Accepted | 454 | 34 | 9,452 | D = int(input())
C = [int(T) for T in input().split()]
S = [[] for TD in range(0,D)]
for TD in range(0,D):
S[TD] = [int(T) for T in input().split()]
Type = 26
Last = [0]*Type
SatD = [0]*D
SatA = [0]*(D+1)
for TD in range(0,D):
Test = int(input())-1
Last[Test] = TD+1
SatD[TD] = S[TD][Test]
for TC in ... | 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 1809... | 18398
35037
51140
65837
79325
| <span class="lang-en">
<p>(Please read problem A first. The maximum score you can get by solving this problem B is 1, which will have almost no effect on your ranking.)</p>
<div class="part">
<section>
<h3>Beginner's Guide</h3><p>Let's first write a program to calculate the score from a pair of input and output. You ca... |
s837567878 | p03547 | Python | Accepted | 109 | 26 | 8,764 | x,y=input().split()
if ord(x)>ord(y):
print(">")
elif ord(x)==ord(y):
print("=")
else:
print("<") | A B
| <
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>In programming, hexadecimal notation is often used.</p>
<p>In hexadecimal notation, besides the ten digits <var>0, 1, ..., 9</var>, the six letters <code>A</code>, <code>B</code>, <code>C</code>, <code>... |
s475514980 | p00205 | Python | Accepted | 592 | 30 | 6,740 | from sys import stdin
readline = stdin.readline
R, S, P = 1, 2, 3 # rock, scissors, paper
W, L, D = 1, 2, 3 # win, lose, draw
rps = {
(R, S, P): {R: D, S: D, P: D},
(R, S): {R: W, S: L},
(S, P): {S: W, P: L},
(R, P): {P: W, R: L},
(R,): {R: D},
(S,): {S: D},
(P,): ... | 1
2
3
2
1
1
2
2
2
1
0
| 3
3
3
3
3
1
2
2
2
1
|
<H1>じゃんけん</H1>
<p>
仲良し 5 人組でじゃんけんをすることになりました。じゃんけんとは、グー、チョキ、パーという 3つの手があり、グーとチョキの勝負ならグーが「勝ち」・チョキが「負け」、チョキとパーなら、チョキが「勝ち」・パーが「負け」、パーとグーならパーが「勝ち」・グーが「負け」というルールです。全員が同じ手、またはグー、チョキ、パー全てが出た場合は「あいこ」となります。
</p>
<p>
5 人のじゃんけんの手を入力とし、それぞれの人の勝敗を出力するプログラムを作成してください。じゃんけんの手は、グーは 1、チョキは 2、パーは 3 の数字で表します。勝敗は「勝ち」を 1、「負け」を 2、「あいこ... |
s654739039 | p00884 | Python | Accepted | 706 | 50 | 4,384 | def dfs(dg, gs, ms, used, v):
if used[v]:
return dg[gs[v]]
used[v] = 1
me = ms[v]
for i in xrange(len(me)):
if me[i] in dg:
ret = dfs(dg, gs, ms, used, gs.index(me[i]))
for e in ret:
if e not in dg[gs[v]]:
dg[gs[v]].append(e)
... | 2
development:alice,bob,design,eve.
design:carol,alice.
3
one:another.
another:yetanother.
yetanother:dave.
3
friends:alice,bob,bestfriends,carol,fran,badcompany.
bestfriends:eve,alice.
badcompany:dave,carol.
5
a:b,c,d,e.
b:c,d,e,f.
c:d,e,f,g.
d:e,f,g,h.
e:f,g,h,i.
4
aa:bb.
cc:dd,ee.
ff:gg.
bb:cc.
0
| 4
1
6
4
2
|
<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... |
s683866336 | p02629 | Python | Accepted | 278 | 63 | 61,920 | n=int(input())
data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans=[]
res=n
while res>0:
m=res%26
res=(res-1)//26
if m==0:
ans.append('z')
else:
ans.append(data[m-1])
ans.reverse()
print(*ans,sep='') | 2
| b
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p><var>1000000000000001</var> dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered <var>1</var> through <var>1000000000000001</var>, but he g... |
s184117978 | p00133 | Python | Accepted | 120 | 20 | 4,192 | x = [list(raw_input()) for _ in [0]*8]
for i in [1,2,3]:
x = zip(*x[::-1])
print i*90
for e in x: print "".join(e) | #*******
#*******
#*******
#*******
#*******
#*******
#*******
########
| 90
########
#*******
#*******
#*******
#*******
#*******
#*******
#*******
180
########
*******#
*******#
*******#
*******#
*******#
*******#
*******#
270
*******#
*******#
*******#
*******#
*******#
*******#
*******#
########
|
<H1>パターンの回転</H1>
<p>
8 文字 × 8 行のパターンを右回りに 90 度、180 度、270 度回転させて出力するプログラムを作成してください。
</p>
<H2>Input</H2>
<p>
8 文字 × 8 行からなるパターンが与えられます。文字は、英数字、半角シャープ '#' 、アスタリスク '*' からなります。
</p>
<H2>Output</H2>
<p>
次の形式で、回転させたパターンを出力してください。
</p>
<pre>
90(半角数字固定)
90度回転させたパターン
180(半角数字固定)
180度回転させたパターン
270(半角数字固定)
27... |
s856390280 | p00177 | Python | Accepted | 184 | 10 | 4,448 | from math import *
r=pi/180
while 1:
a,b,c,d=e=map(lambda x: float(x)*r,raw_input().split())
if e==[-r]*4:break
print int(round(6378.1*acos((sin(a)*sin(c)+cos(a)*cos(c)*cos(d-b))))) | 35.68 139.77 51.15 359.82
1.37 103.92 41.78 272.25
51.15 359.82 -34.58 301.52
-1 -1 -1 -1
| 9609
15092
11112
|
<H1>2都市間の距離</H1>
<p>
地球上の2 都市の北緯と東経を入力とし、地表距離を計算して出力するプログラムを作成してください。ただし、地球は半径 6,378.1 km の球とし、2 点間の地表距離とはこの球面に沿った最短距離です。また、南半球でも南緯は用いずに北緯 0 ~ -90 度を用い、グリニッジ子午線の西でも西経は用いずに東経 180 ~ 360 度を用いることとします。地表距離は km 単位で求め、小数点以下は四捨五入し、整数値として出力してください。
</p>
<p>
以下に主要都市の北緯、東経の例を示します。
</p>
<center>
<table>
<tr><th width="120">地... |
s593335456 | p03589 | Python | Accepted | 269 | 87 | 9,108 | import sys
from math import ceil,floor
N=int(input())
b=3501
for h in range(ceil(3*N/4),b):
for w in range(1,floor(3*N/4)+1):
if 4*h*w-N*h-N*w>0:
if N*h*w % (4*h*w-N*h-N*w)==0:
n=N*h*w//(4*h*w-N*h-N*w)
print(h,n,w)
sys.exit()
| 2
| 1 2 2
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given an integer <var>N</var>.</p>
<p>Find a triple of positive integers <var>h</var>, <var>n</var> and <var>w</var> such that <var>4/N = 1/h + 1/n + 1/w</var>.</p>
<p>If there are multiple solu... |
s448860285 | p01486 | Python | Accepted | 132 | 20 | 7,864 | import re
b=s=input()
while 1:
s=re.sub(r'(m|e)mew(e|w)','\\1\\2',s)
if b==s:break
b=s
print(['Rabbit','Cat'][s=='mew']) | mmemewwemeww
| Cat
|
<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>
... |
s562087105 | p02138 | Python | Accepted | 1,129 | 20 | 5,604 | A, B = map(int, input().split())
score = 0
score_a = A * 2
score_b = B * 2
a = A
b = B
while True :
score_b -= a
if score_b <= 0 :
break
else :
score += 1
if score_b < b :
b = score_b
score_a -= b
if score_a <= 0 :
break
else :
score += 1... | 20 10
| 0
| <h1>Problem B: U&U</h1>
<h2>Problem</h2>
<p>
$2$つのチーム、チームUKUとチームうしがある。最初、チームUKUには$N$人、チームうしには$M$人の人がいる。
チームUKUとチームうしは「U&U」というゲームを行うことにした。「U&U」は$2$つのチームで共通のスコアを持っており、互いに協力しあい共通のスコアを最小化することが目的である。「U&U」は最初、すべての人の体力が$2$で、共通のスコアは$0$の状態で以下のような手順で進められる。
</p>
<ol>
<li>チームUKUの人は1人ずつ、チームうしの誰か$1$人に対してちょ... |
s874128894 | p00125 | Python | Accepted | 190 | 20 | 4,408 | import datetime
while 1:
y1,m1,d1,y2,m2,d2=map(int,raw_input().split(" "))
if y1==m1==d1==y2==m2==d2==-1: break
a=datetime.date(y1,m1,d1)
b=datetime.date(y2,m2,d2)
print (b-a).days | 2006 9 2 2006 9 3
2006 9 2 2006 11 11
2004 1 1 2005 1 1
2000 1 1 2006 1 1
2000 1 1 2101 1 1
-1 -1 -1 -1 -1 -1
| 1
70
366
2192
36890
|
<h1>日数</h1>
<p>
2 つの日付を入力とし、その 2 つの日付けの間の日数を出力するプログラムを作成してください。
</p>
<p>
日付 1 (<var>y<sub>1</sub>, m<sub>1</sub>, d<sub>1</sub></var>) は日付 2 (<var>y<sub>2</sub>, m<sub>2</sub>, d<sub>2</sub></var>) と同じか、あるいはそれ以前の日付とします。日付 1 は日数に含め、日付 2 は含めません。また、うるう年を考慮にいれて計算してください。うるう年の条件は次のとおりとします。
</p>
<ul>
<li>西暦年が 4 で割り切れ... |
s910774303 | p03434 | Python | Accepted | 264 | 29 | 9,124 | n=int(input())
n_list=list(map(int,input().split()))
alice=[]
bob=[]
while(n_list!=[]):
a=max(n_list)
alice.append(a)
n_list.remove(a)
if(n_list==[]):
break
b=max(n_list)
bob.append(b)
n_list.remove(b)
print(sum(alice)-sum(bob)) | 2
3 1
| 2
| <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> cards. A number <var>a_i</var> is written on the <var>i</var>-th card.<br/>
Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. ... |
s564050683 | p00647 | Python | Accepted | 656 | 30 | 5,608 | # AOJ 1062: It's our delight!!
# Python3 2018.6.8 bal4u
# 昼11:00-14:59, 夕18:00-20:59, 深夜21:00-01:59
tt = [[660, 899], [1080, 1259], [1260, 1559]]
ss = ["lunch", "dinner", "midnight"]
while True:
n = int(input())
if n == 0: break
cnt, ok = [0]*3, [0]*3
for i in range(n):
hm, MM = input().split()
hh, mm = map(i... | 5
12:57 59
20:12 15
12:19 21
18:52 03
16:09 14
0
| lunch 100
dinner 50
midnight no guest
|
<h1>Problem A: It's our delight!!</h1>
<p>
You are a student of University of Aizu.
And you work part-time at a restaurant.
</p>
<p>
Staffs of the restaurant are well trained to be delighted to provide more delicious products faster.
</p>
<p>
The speed providing products particularly depends on skill of the staff.
S... |
s836118871 | p03643 | Python | Accepted | 28 | 71 | 61,628 | N = input()
print('ABC' + N) | 100
| ABC100
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>This contest, <em>AtCoder Beginner Contest</em>, is abbreviated as <em>ABC</em>.</p>
<p>When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 6... |
s869746509 | p02541 | Python | Accepted | 4,691 | 66 | 9,948 | from functools import lru_cache # お好みで。あると同じ素因数分解をするときに楽できる。
# 参考1: https://qiita.com/Kiri8128/items/eca965fe86ea5f4cbb98
# 参考2: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
# 参考3: https://ja.wikipedia.org/wiki/%E3%83%9D%E3%83%A9%E3%83%BC%E3%83%89%E3%83%BB%E3%83%AD%E3%83%BC%E7%B4%A0%E5%9B%A0%E6%95... | 11
| 10
| <span class="lang-en">
<p>Score : <var>600</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given is an integer <var>N</var>.
Find the minimum possible positive integer <var>k</var> such that <var>(1+2+\cdots+k)</var> is a multiple of <var>N</var>.
It can be proved that such a positive integer... |
s744927939 | p02534 | Python | Accepted | 194 | 20 | 9,156 | K = int(input())
if K == 1:
print("ACL")
elif K == 2:
print("ACLACL")
elif K == 3:
print("ACLACLACL")
elif K == 4:
print("ACLACLACLACL")
elif K == 5:
print("ACLACLACLACLACL") | 3
| ACLACLACL
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>You are given an integer <var>K</var>.
Print the string obtained by repeating the string <code>ACL</code> <var>K</var> times and concatenating them.</p>
<p>For example, if <var>K = 3</var>, print <code>... |
s599370316 | p02116 | Python | Accepted | 38 | 70 | 7,696 | n = int(input())
print((n+1) &- (n+1)) | 2
| 1
|
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<h1>Problem F: nCm</h1>
<h2>Problem</h2>
<p>
整数<var>n</var>が与えられた時、<var>nCm</var>(異なる<var>n</var>個のものから<var>m</var>個を選ぶ組み合わせの数)が偶数となるような最小の<var>m</var>を出力せよ。
</p>
<h2>Input... |
s531599360 | p00290 | Python | Accepted | 82 | 20 | 5,580 | A,B=map(int,input().split());print(A*B)
#Sourcecodeshouldbelongerthan50characters
| 20 2
| 40
|
<h1>椅子の総数</h1>
<p>
選手のみなさん、パソコン甲子園にようこそ。パソコン甲子園の本選は会津大学で行われ、会場内では
1つの机に1チームが割り当てられます。パソコン甲子園は1チーム2人なので、チーム数×2脚の椅子が必要です。大学では、他にも様々なイベントの会場設営で机と椅子を準備する機会がありますが、必要な机と椅子の数も様々です。そこで、あるイベントに対して準備する机の数と、机1つあたりに必要な椅子の数が与えられたとき、必要な椅子の総数を計算するプログラムを作成してください。
</p>
<h2>入力</h2>
<p>
入力は以下の形式で与えられる。
</p>
<pre>
<var>d</var> <var>c... |
s410157215 | p00377 | Python | Accepted | 315 | 20 | 5,592 | friends=input()
friends=friends.split()
friends_all=friends[0]
friends_cakes=friends[1]
person=int(friends_all)+1
cakes=input()
cakes_amount=0
for a in cakes.split():
cakes_amount+=int(a)
one_person=cakes_amount//person
if cakes_amount%person!=0:
one_person+=1
else:
pass
print(one_person)
| 5 4
5 5 6 5
| 4
| <h1>Cake Party</h1>
<p>
I’m planning to have a party on my birthday. Many of my friends will come to the party. Some of them will come with one or more pieces of cakes, but it is not certain if the number of the cakes is a multiple of the number of people coming.
</p>
<p>
I wish to enjoy the cakes equally among... |
s312499772 | p02423 | Python | Accepted | 184 | 20 | 5,604 | x = int(input())
MASK = (1 << 32) - 1
print("{:032b}".format(x))
print("{:032b}".format(~x & MASK))
print("{:032b}".format((x << 1) & MASK))
print("{:032b}".format((x >> 1) & MASK))
| 8
| 00000000000000000000000000001000
11111111111111111111111111110111
00000000000000000000000000010000
00000000000000000000000000000100
| <h1>Bit Operation I</h1>
<p>
Given a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely.
</p>
<ul>
<li>Inversion: change the state of each bit to the opposite state</li>
<li>Logical left shift: shift left by 1</... |
s628560987 | p03543 | Python | Accepted | 61 | 30 | 8,976 | a,b,c,d=input()
print("Yes" if a==b==c or b==c==d else "No")
| 1118
| Yes
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>We call a <var>4</var>-digit integer with three or more consecutive same digits, such as <var>1118</var>, <strong>good</strong>.</p>
<p>You are given a <var>4</var>-digit integer <var>N</var>. Answer th... |
s902118425 | p00364 | Python | Accepted | 162 | 20 | 5,620 | n, t = map(int, input().split())
min_height = 0
for _ in range(n):
x, h = map(int, input().split())
min_height = max(min_height, h / x * t)
print(min_height)
| 3 10
6 4
4 2
3 2
| 6.666667
| <H1>Bange Hills Tower</H1>
<p>
A project is underway to build a new viewing tower in Bange town called “Bange Hills Tower” whose selling point will be the gorgeous view of the entire main keep of Wakamatsu Castle from top to bottom. Therefore, the view line from the top of the tower must reach the bottom of the keep w... |
s049136734 | p00046 | Python | Accepted | 123 | 10 | 4,644 | moutain = []
try:
while True:
moutain.append(float(raw_input()))
except:
print max(moutain) - min(moutain)
| 3776.0
1819.0
645.2
2004.1
1208.6
| 3130.8
|
<H1>標高差</H1>
<p>
今まで登ったことのある山の標高を記録したデータがあります。このデータを読み込んで、一番高い山と一番低い山の標高差を出力するプログラムを作成してください。
</p>
<H2>Input</H2>
<p>
入力は以下の形式で与えられます。
</p>
<pre class="exp">
山の高さ
...
...
</pre>
<p>
山の高さが複数行に渡って与えられます。入力される値はすべて 0 以上 1,000,000 以下の実数です。入力される山の高さの数は 50 以下です。
</p>
<H2>Output</H2>
<p>
一番高い山と一番低い山の標高差を実数で出力する。出力は0... |
s894564994 | p03840 | Python | Accepted | 220 | 62 | 61,880 | l=list(map(int,input().split()))
if l[0]==0 or l[3]==0 or l[4]==0:
print((l[0]//2)*2+(l[3]//2+l[4]//2)*2+l[1])
else:
print(max((l[0]//2)*2+(l[3]//2+l[4]//2)*2+l[1],((l[0]-1)//2)*2+((l[3]-1)//2+(l[4]-1)//2)*2+l[1]+3)) | 2 1 1 0 0 0 0
| 3
| <span class="lang-en">
<p>Score : <var>600</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>A <em>tetromino</em> is a figure formed by joining four squares edge to edge.
We will refer to the following seven kinds of tetromino as I-, O-, T-, J-, L-, S- and Z-tetrominos, respectively:</p>
<div s... |
s752793706 | p02247 | Python | Accepted | 100 | 20 | 5,568 | T = input()
P = input()
p = len(P)
for i in range(len(T)-p+1):
if T[i:i+p]==P:
print(i)
| aabaaa
aa
| 0
3
4
|
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... |
s987811335 | p02606 | Python | Accepted | 141 | 29 | 9,060 | n = input()
n = n.split(" ")
conta = 0
for num in range(int(n[0]), int(n[1])+1):
if num % int(n[2]) == 0:
conta += 1
print(conta) | 5 10 2
| 3
| <span class="lang-en">
<p>Score : <var>100</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>How many multiples of <var>d</var> are there among the integers between <var>L</var> and <var>R</var> (inclusive)?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li>All val... |
s623172701 | p03910 | Python | Accepted | 118 | 73 | 68,464 | N = int(input())
K = 0
k = 0
while K < N:
k += 1
K += k
while N > 0:
if N >= k:
print(k)
N -= k
k -= 1 | 4
| 1
3
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>The problem set at <em>CODE FESTIVAL 20XX Finals</em> consists of <var>N</var> problems.</p>
<p>The score allocated to the <var>i</var>-th <var>(1≦i≦N)</var> problem is <var>i</var> points.</p>
<p>Takah... |
s780594958 | p03636 | Python | Accepted | 47 | 27 | 8,980 | s = input()
print(s[0] + str(len(s)-2) + s[-1]) | internationalization
| i18n
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>The word <code>internationalization</code> is sometimes abbreviated to <code>i18n</code>.
This comes from the fact that there are <var>18</var> letters between the first <code>i</code> and the last <cod... |
s556719303 | p03419 | Python | Accepted | 251 | 30 | 9,108 | n, m = map(int, input().split())
if n >= 2 and m >= 2:
print((n-2)*(m-2))
elif (n == 1 and m >= 3) or (n >= 3 and m == 1):
print(max(n, m)-2)
elif (n == 1 and m == 2) or (n == 2 and m == 1):
print(0)
elif (n == 1 and m == 1):
print(1) | 2 2
| 0
| <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 infinitely many rows and columns. In this grid, there is a rectangular region with consecutive <var>N</var> rows and <var>M</var> columns, and a card is placed in each square in thi... |
s082460445 | p00623 | Python | Accepted | 2,085 | 30 | 6,752 | class Node:
def __init__(self):
self.left=[0]
self.right=[0]
def createleft(self,inp,A):
cnt=0
for cn in range(len(inp)):
c=inp[cn]
if c=='(':
cnt+=1
elif c==')':
cnt-=1
elif cnt==0:
s... | (1 2)
2
0 1 0 1
1 0 1 0
((1 2) 3)
3
1 1 0 0
1 0 1 0
0 0 0 1
END
| 2
2
|
<H1><font color="#000000">Problem C:</font> Midnight Teatime</H1>
<p>
ICPCの国内予選に備えて問題を解いていた僕は, その日3つ目のAcceptを貰ったところでキーボードを叩く手を止めた. 時計を見れば, もう日付が変わろうかという時刻だ. 紅茶とお菓子で一服して, 今日はもう寝ることにしよう. そう思って僕はキッチンへと向かった.
</p>
<p>
ダージリンのかぐわしい香りがキッチンを満たした頃, 妹がやってきた. 受験生である彼女は今日もこんな時間まで真面目に勉強していたようだ. 僕は彼女を誘って, 小さな深夜のお茶会を開くことにした.
</p>... |
s185002209 | p00252 | Python | Accepted | 107 | 20 | 4,184 | input_str = raw_input()
if input_str == '1 1 0' or input_str == '0 0 1':
print 'Open'
else:
print 'Close' | 0 0 1
| Open
|
<H1>乗車券</H1>
<p>
新幹線に乗るためには、「乗車券」「特急券」の2枚の切符が必要です。経路の一部で新幹線を利用しない場合があるため、これらは別々の切符となっていますが、新幹線のみを利用する経路では、1枚で乗車券と特急券を兼ねる「乗車・特急券」が発行されることもあります。
</p>
<p>
自動改札機では、これらの切符を読み込んで、正しい切符が投入されたときだけゲートを開けなければなりません。「乗車券」と「特急券」それぞれ1枚、または、その両方、または、「乗車・特急券」が1枚投入されたかどうかを判定し、自動改札機の扉の開閉を判断するプログラムを作成して下さい。
</p>
<h2>入力</h2>
<p>
... |
s199556549 | p02258 | Python | Accepted | 116 | 100 | 5,636 | import sys
def m():
s=1e10;b=-s
input()
for r in map(int,sys.stdin):
if b<r-s:b=r-s
if s>r:s=r
print(b)
m()
| 6
5
3
1
3
4
3
| 3
|
<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>Maximum Profit</H1>
<p>
You... |
s434160213 | p02831 | Python | Accepted | 75 | 40 | 10,576 | from fractions import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b)) | 2 3
| 6
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3>
<p>Takahashi is organizing a party.</p>
<p>At the party, each guest will receive one or more snack pieces.</p>
<p>Takahashi predicts that the number of guests at this party will be <var>A</var> or <var>B<... |
s265488287 | p02731 | Python | Accepted | 33 | 28 | 9,312 | L=float(input())
print((L/3)**3) | 3
| 1.000000000000
| <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Given is a positive integer <var>L</var>.
Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is <var>L</var>.</p>
</section>
</div>
<div clas... |
s312694229 | p02400 | Python | Accepted | 168 | 30 | 5,640 | import sys
import math
def main():
r = float(sys.stdin.readline())
print(math.pi * r**2, 2 * math.pi * r)
return
if __name__ == '__main__':
main()
| 2
| 12.566371 12.566371
| <H1>Circle</H1>
<p>
Write a program which calculates the area and circumference of a circle for given radius <var>r</var>.
</p>
<H2>Input</H2>
<p>
A real number <var>r</var> is given.
</p>
<H2>Output</H2>
<p>
Print the area and circumference of the circle in a line. Put a single space between them. The output shou... |
s268392540 | p01388 | Python | Accepted | 53 | 40 | 6,728 | s=input()
print(min(map(lambda c:s.count(c),"KUPC"))) | KUPCkupcKUPC
| 2
|
<script src="./IMAGE/varmath.js" charset="UTF-8"></script>
<h1><font color="#000">問題 A </font> KUPC</h1>
<h2>問題文</h2>
<p>とある学生が,Kyoto University Programming Contest (KUPC) を開こうと考えた.そこで彼は,看板を作って皆に宣伝することにした.今,手元にはアルファベット <var>1</var> 文字の書かれた板がいくつもある.これらの板から <tt>'K'</tt>,<tt>'U'</tt>,<tt>'P'</tt>,<tt>'C'</tt> という文字の書... |
s206042014 | p00506 | Python | Accepted | 708 | 20 | 5,676 | import math
n = int(input())
gcd_set = set()
def do_gcd(a, b) :
if a % b == 0 :
return b
else :
return do_gcd(b, a % b)
if n == 2 :
a, b = map(int, input().split())
gcd = do_gcd(max(a, b), min(a, b))
for i in range(1, int(math.sqrt(gcd) + 1)) :
if gcd % i == 0 :
... | 2
75 125
| 1
5
25
|
<H1> 問題 2</H1>
<br/>
<p>
入力ファイルの1行目に正整数 n が書いてあり,
2行目には半角空白文字1つを区切りとして,
n 個の正整数が書いてある.
n は 2 または 3 であり,
2行目に書かれているどの整数も値は 10<sup>8</sup> 以下である.
これら2個または3個の数の公約数をすべて求め,
小さい方から順に1行に1個ずつ出力せよ.
自明な公約数(「1」)も出力すること.
</p>
<p>
<!--入力ファイルの改行コードは CR+LF である.
また,-->
出力ファイルにおいては,
出力の最後行にも改行コードを入れること.
</p>
<h2>入出力例</h2>
<h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.