s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s203635810
p00233
u260980560
1582244203
Python
Python3
py
Accepted
50
5604
358
while 1: N = int(input()) if N == 0: break R = [] c = 0 while N: if c: if N % 10 > 0: R.append(10 - (N % 10)) N += 10 else: R.append(0) else: R.append(N % 10) c ^= 1 N //= 10 ...
p00233
<H1>図書整理</H1> <p> 数の表わし方には色々な種類があり、私たちが普段使っている 10 進数は一つの代表的なものでしかありません。コンピュータ関連の知識がある人には、2 進数、16 進数あたりはとても身近なものです。 </p> <p> N さんは司書資格を活かして司書の仕事に就きました。最初の仕事は図書整理です。この図書館では、一冊ごとに一貫して番号が与えられており、それに従って本を整理しています。 </p> <p> この図書館では本の番号をマイナス十進数で表すことになっています。 </p> <p> マイナス十進数は、<var>a<sub>n</sub>a<sub>n&minus;1</sub>a<su...
9 10 -10 -1944 -305432133 0
9 190 10 2156 1715573947
16,328
s294757465
p00233
u781622789
1582185685
Python
Python3
py
Accepted
60
5596
239
while True: n = int(input()) if n == 0: break d = 1 ans = 0 b = 1 while n != 0: x = n%(10*b)*b ans = ans+x*d n -= x*b n //= 10 b *= -1 d *= 10 print(ans)
p00233
<H1>図書整理</H1> <p> 数の表わし方には色々な種類があり、私たちが普段使っている 10 進数は一つの代表的なものでしかありません。コンピュータ関連の知識がある人には、2 進数、16 進数あたりはとても身近なものです。 </p> <p> N さんは司書資格を活かして司書の仕事に就きました。最初の仕事は図書整理です。この図書館では、一冊ごとに一貫して番号が与えられており、それに従って本を整理しています。 </p> <p> この図書館では本の番号をマイナス十進数で表すことになっています。 </p> <p> マイナス十進数は、<var>a<sub>n</sub>a<sub>n&minus;1</sub>a<su...
9 10 -10 -1944 -305432133 0
9 190 10 2156 1715573947
16,329
s383975191
p00235
u766477342
1420211926
Python
Python3
py
Accepted
40
6740
672
while 1: N = int(input()) if N == 0:break R = [[0 for i in range(N+1)] for i in range(N+1)] def dfs_max(cur, pre): _max = -R[cur][pre] for i in range(N+1): if R[cur][i] > 0 and i != pre: _max = max(_max, dfs_max(i, cur) + R[cur][i]) # print('max : %d' ...
p00235
<H1>サージェント・ライアン</H1> <p> 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 </p> <p> 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 </p> <p> 水上...
7 1 2 5 2 3 2 3 4 3 2 5 3 5 6 3 5 7 8 0
12
16,330
s448881401
p00235
u260980560
1582216253
Python
Python3
py
Accepted
40
6016
701
from collections import deque while 1: N = int(input()) if N == 0: break G = [[] for i in range(N)] for i in range(N-1): a, b, t = map(int, input().split()) a -= 1; b -= 1 G[a].append((b, t)) G[b].append((a, t)) D = [-1]*N; P = [0]*N que = deque([0]) ...
p00235
<H1>サージェント・ライアン</H1> <p> 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 </p> <p> 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 </p> <p> 水上...
7 1 2 5 2 3 2 3 4 3 2 5 3 5 6 3 5 7 8 0
12
16,331
s260039808
p00235
u736550956
1578228321
Python
Python3
py
Accepted
40
5616
1,062
def dfs1(v, pv): for nv, _ in adj_list[v]: if nv==pv: continue is_leaf[v] = False dfs1(nv, v) return is_leaf def dfs2(v, pv, d): dist[v] = d for nv, w in adj_list[v]: if nv==pv: continue dfs2(nv, v, d+w) ...
p00235
<H1>サージェント・ライアン</H1> <p> 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 </p> <p> 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 </p> <p> 水上...
7 1 2 5 2 3 2 3 4 3 2 5 3 5 6 3 5 7 8 0
12
16,332
s321264428
p00235
u072053884
1567597508
Python
Python3
py
Accepted
30
5616
1,410
def tree_walk_1(start, parent=None): for i, t in adj[start]: if i != parent: P[i] = (start, t) C[start].append((i, t)) tree_walk_1(i, start) def tree_walk_2(start): global time notVisited[start] = False for c, t1 in C[start]: if notVisited[c]: ...
p00235
<H1>サージェント・ライアン</H1> <p> 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 </p> <p> 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 </p> <p> 水上...
7 1 2 5 2 3 2 3 4 3 2 5 3 5 6 3 5 7 8 0
12
16,333
s100251541
p00235
u352394527
1547181277
Python
Python3
py
Accepted
30
5608
780
while True: n = int(input()) if n == 0:break edges = [[] for _ in range(n)] for _ in range(n - 1): a, b, t = map(int, input().split()) a -= 1 b -= 1 edges[a].append([b, t]) edges[b].append([a, t]) used = [False] * n is_leaf = [False] * n for i in range...
p00235
<H1>サージェント・ライアン</H1> <p> 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 </p> <p> 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 </p> <p> 水上...
7 1 2 5 2 3 2 3 4 3 2 5 3 5 6 3 5 7 8 0
12
16,334
s499132967
p00238
u766477342
1414922046
Python
Python3
py
Accepted
40
6724
213
while 1: t = int(input()) if t == 0:break n = int(input()) x = 0 for i in range(n): x += (lambda lst:lst[-1] - lst[0])(list(map(int,input().split()))) print('OK' if t<=x else (t-x))
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,335
s681237765
p00238
u766477342
1414922498
Python
Python3
py
Accepted
40
6724
191
while 1: t = int(input()) if t == 0:break t -= sum(map(lambda lst:lst[-1] - lst[0],[ list(map(int,input().split())) for i in range(int(input())) ])) print('OK' if t<=0 else t)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,336
s769528378
p00238
u567380442
1427092220
Python
Python3
py
Accepted
40
6724
264
import sys f = sys.stdin while True: t = int(f.readline()) if t == 0: break n = int(f.readline()) sf = (map(int, f.readline().split()) for _ in range(n)) rest = t - sum(f - s for s, f in sf) print('OK' if rest <= 0 else rest)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,337
s076525095
p00238
u873482706
1437460333
Python
Python
py
Accepted
20
4296
262
while True: n = int(raw_input()) if n == 0: break t = 0 for i in range(int(raw_input())): t += reduce(lambda x, y: y-x, map(int, raw_input().split())) else: if n <= t: print 'OK' else: print n-t
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,338
s931248199
p00238
u873482706
1437460471
Python
Python
py
Accepted
20
4300
222
while True: n = int(raw_input()) if n == 0: break t = 0 for i in range(int(raw_input())): t += reduce(lambda x, y: y-x, map(int, raw_input().split())) else: print 'OK' if n <= t else n-t
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,339
s737334555
p00238
u975539923
1456739339
Python
Python
py
Accepted
40
6360
290
while True: t = input() if t == 0: break studied = 0 n = input() for i in range(n): s = raw_input().split(" ") f_s = int(s[1]) - int(s[0]) studied += f_s if studied >= t: print "OK" else: print "%d" % (t - studied)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,340
s437908650
p00238
u078042885
1483583840
Python
Python3
py
Accepted
20
7680
192
while 1: a=int(input()) if a == 0: break b=int(input()) d=0 for _ in range(b): c=list(map(int,input().split())) d+=c[1]-c[0] print(a-d if a>d else 'OK')
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,341
s702702265
p00238
u078042885
1483584369
Python
Python3
py
Accepted
20
7652
182
while 1: a=int(input()) if a == 0: break b=int(input()) for _ in range(b): c=list(map(int,input().split())) a-=c[1]-c[0] print(a if a>0 else 'OK')
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,342
s737311536
p00238
u546285759
1485054605
Python
Python3
py
Accepted
20
7704
213
while True: t= int(input()) if t== 0: break n= int(input()) c= [list(map(int, input().split())) for _ in range(n)] sf= sum(c[i][1]-c[i][0] for i in range(n)) print("OK" if t<= sf else t-sf)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,343
s109318882
p00238
u957021183
1506062627
Python
Python3
py
Accepted
30
7776
399
# Aizu Problem 0238: Time to Study import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") while True: T = int(input()) if T == 0: break n = int(input()) for _ in range(n): start, end = [int(_) for _ ...
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,344
s954166342
p00238
u737311644
1520160060
Python
Python3
py
Accepted
20
5596
236
while True: t=int(input()) if t == 0: break n=int(input()) b=0 for i in range(n): s,f=map(int,input().split()) a=f-s b+=a if t<=b: print("OK") else: print(t-b)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,345
s799087160
p00238
u847467233
1529876703
Python
Python3
py
Accepted
20
5592
226
# AOJ 0238 Time to Study # Python3 2018.6.25 bal4u while 1: t = int(input()) if t == 0: break n = int(input()) sm = 0 for i in range(n): s, f = map(int, input().split()) sm += f-s print("OK" if sm >= t else t - sm)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,346
s241520982
p00238
u724548524
1529932207
Python
Python3
py
Accepted
20
5596
201
while 1: t = int(input()) if t == 0:break n = int(input()) s = 0 for _ in range(n): a, b = map(int, input().split()) s += b - a print("OK" if s >= t else t - s)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,347
s389004443
p00238
u352394527
1530092253
Python
Python3
py
Accepted
20
5596
216
while True: t = int(input()) if t == 0: break n = int(input()) acc = 0 for _ in range(n): s, f = map(int, input().split()) acc += f - s if acc >= t: print("OK") else: print(t - acc)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,348
s392647211
p00238
u894941280
1345090115
Python
Python
py
Accepted
10
14000
247
while True: s= 0 a = int(input()) if a == 0: break else: n = int(input()) for y in range(n): b = map(int,raw_input().split()) c,v = b[0],b[1] s += v-c if s >= a : print "OK" else: print a-s
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,349
s526631799
p00238
u759949288
1353225136
Python
Python
py
Accepted
20
4220
193
import sys while True: t = input() if t == 0: sys.exit(0) t -= sum(map(lambda x: x[1] - x[0], [map(int, raw_input().split()) for i in xrange(input())])) if t <= 0: print "OK" else: print t
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,350
s154060426
p00238
u104911888
1367413507
Python
Python
py
Accepted
20
4220
188
while True: t=input() if t==0:break n=input() sumt=0 for i in range(n): s,f=map(int,raw_input().split()) sumt+=f-s print "OK" if sumt>=t else t-sumt
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,351
s595341022
p00238
u350508326
1382628224
Python
Python
py
Accepted
20
4212
443
if __name__ == '__main__': while True: sign = int(raw_input()) if sign == 0: break num = int(raw_input()) time = 0 for i in xrange(num): a,b = map(int, raw_input().split(' ')) time += b - a jug = sign - time # print 'j...
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,352
s854312972
p00238
u260980560
1384625206
Python
Python
py
Accepted
20
4200
183
while 1: t = input() if t==0: break n = input(); S = 0; for i in xrange(n): s,f = map(int,raw_input().split()) S += f-s print "OK" if S>=t else t-S
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,353
s063365690
p00238
u633068244
1396284548
Python
Python
py
Accepted
20
4200
158
while 1: t=int(raw_input()) if t==0:break n=int(raw_input()) for i in range(n): s,f=map(int, raw_input().split()) t -= f-s print t if t > 0 else "OK"
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,354
s368702872
p00238
u056829778
1593414455
Python
Python3
py
Accepted
30
5612
381
import sys,os while 1: t = int(input()) if t == 0: break n = int(input()) sf = [list(map(int, input().split())) for _ in range(n)] time = 0 for i in sf: start,end = i if start > end: time += end - (start-24) else: time += end - start if ti...
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,355
s416955961
p00238
u286298310
1592311524
Python
Python3
py
Accepted
30
5596
237
while 1: t = int(input()) if t == 0: break n = int(input()) T = 0 for i in range(n): s,f = map(int,input().split()) T += f - s if T >= t: print("OK") else: print(t-T)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,356
s213857206
p00238
u842461513
1588934628
Python
Python3
py
Accepted
30
5596
502
#標準入力をし0だった場合はループを抜ける while True: num = int(input()) if num == 0:break else: num1 = int(input()) kei = 0 #勉強時間の合計を計算する for _ in range(num1): a,b = map(int,input().split()) kei += b - a #勉強時間が足りてたら"OK"足りてなかったら足りない時間を出力する ...
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,357
s852636440
p00238
u153447291
1574495963
Python
Python3
py
Accepted
30
5596
224
while True: a = int(input()) if a == 0: break b = int(input()) for i in range(b): c,d = map(int,input().split()) a -= d-c if a <= 0: print("OK") else: print(a)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,358
s868968066
p00238
u250040203
1564923401
Python
Python3
py
Accepted
20
5600
286
while True: try: t=int(input()) n=int(input()) M=0 for i in range(n): s,f=map(int,input().split()) A=f-s M=M+A if t>M: print(t-M) else: print("OK") except: break
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,359
s816516481
p00238
u433250944
1564894843
Python
Python3
py
Accepted
20
5596
258
while True: t = int(input()) if t==0: break n = int(input()) hour = 0 for i in range(n): s,f = map(int,input().split()) hour += (f-s) if hour >= t: print("OK") else: print(t-hour)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,360
s313362102
p00238
u939401108
1564886620
Python
Python3
py
Accepted
20
5596
229
while True: t = int(input()) if t == 0: break n = int(input()) ans = 0 for _ in range(n): s, f = map(int, input().split()) ans += f - s if ans >= t: print('OK') else: print(t - ans)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,361
s949924868
p00238
u800408401
1564841779
Python
Python3
py
Accepted
20
5600
179
while True: t=int(input()) if t == 0: break n = int(input()) for i in range(n): s,f=map(int,input().split()) t-=f-s if t<1: print("OK") else: print(t)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,362
s795734559
p00238
u120055135
1564761192
Python
Python3
py
Accepted
20
5596
276
while 1: t = int(input()) if t == 0: break n = int(input()) i = 0 sum = 0 while i < n: s, f = map(int, input().split()) a = f - s sum = sum + a i += 1 if sum < t: print(t - sum) else: print("OK")
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,363
s863208230
p00238
u525395303
1564719190
Python
Python3
py
Accepted
20
5600
257
# AOJ 0238 Time to Study # Python3 2018.6.25 bal4u while 1: t = int(input()) if t == 0: break n = int(input()) sm = 0 for i in range(n): s, f = map(int, input().split()) sm += f-s print("OK" if sm >= t else t - sm)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,364
s529904600
p00238
u607723579
1564640697
Python
Python3
py
Accepted
20
5596
256
while 1: t = int(input()) if t == 0: break n = int(input()) ans = 0 for _ in range(n): s, f = map(int, input().split()) ans += f - s if ans >= t: print("OK") else: print(t - ans)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,365
s304083738
p00238
u312033355
1564637010
Python
Python3
py
Accepted
30
5592
253
while 1: t = int(input()) if t == 0: break n = int(input()) ans = 0 for _ in range(n): s, f = map(int, input().split()) ans += f - s if ans >= t: print("OK") else: print(t - ans)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,366
s407823345
p00238
u811733736
1562729535
Python
Python3
py
Accepted
20
5620
463
# -*- coding: utf-8 -*- """ Time to Study http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0238 """ import sys def solve(t): n = int(input()) for _ in range(n): s, f = map(int, input().split()) t -= (f-s) return 'OK' if t <= 0 else t def main(args): while True: t = i...
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,367
s966943175
p00238
u495152850
1562065375
Python
Python3
py
Accepted
30
5600
183
while 1: a=int(input()) if a == 0: break b=int(input()) for _ in range(b): c=list(map(int,input().split())) a-=c[1]-c[0] print(a if a>0 else 'OK')
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,368
s178792746
p00238
u814278309
1559745269
Python
Python3
py
Accepted
20
5596
190
while True: t=int(input()) if t==0: break n=int(input()) c=0 for i in range(n): a,b=map(int,input().split()) c+=(b-a) if t<=c: print("OK") else: print(t-c)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,369
s289222814
p00238
u990228206
1551696209
Python
Python3
py
Accepted
20
5596
181
while 1: t=int(input()) if t==0:break n=int(input()) for i in range(n): s,f=map(int,input().split()) t-=f-s if t<1:print("OK") else:print(t)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,370
s991929026
p00238
u717526540
1544491479
Python
Python3
py
Accepted
20
5592
251
while 1: t = int(input()) if t == 0: break n = int(input()) ans = 0 for _ in range(n): s, f = map(int, input().split()) ans += f - s if ans >= t: print("OK") else: print(t - ans)
p00238
<!-- <p> 三度の飯よりゲーム好きのだいご君は暇さえあればゲームばかりしていました。ですが、だいご君も高校3年生。クラスはもう受験モードに入っています。受験勉強をするからには、当然ゲームで遊べる時間が短くなってしまいます。まずは1日に勉強をする時間を決めて、残った時間をゲームなどに使うことにしましたが、だいご君は今まで計画を守れたためしがありませんでした。見かねたあなたは、だいご君の勉強時間を管理するプログラムを書くことにしました。 </p> 1日にやらなければならない勉強の目標時間をt、勉強を開始した時刻をs、終了した時刻をfとおきます。 --> <p> 勉強を開始した時刻と終了した時刻の情報を基に、1日で勉強した...
10 3 6 11 12 15 18 22 14 2 6 11 13 20 0
OK 2
16,371
s607794819
p00240
u766477342
1415623582
Python
Python3
py
Accepted
70
6820
337
while 1: n = int(input()) if n == 0:break y = int(input()) mv = 0 for i in range(n): b,r,t = list(map(int,input().split())) if t == 1: spam = 1 + y*(r/100) else: spam = (1+(r/100))**y if spam > mv: result = b mv = spam ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,372
s917951784
p00240
u567380442
1427095412
Python
Python3
py
Accepted
50
6816
493
def simple_interest(r, y): return (100 + r * y) / 100 def compound_interest(r, y): return ((100 + r) / 100) ** y import sys import operator f = sys.stdin get_ganri = {1:simple_interest,2:compound_interest} while True: n = int(f.readline()) if n == 0: break y = int(f.readline()) brt = [l...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,373
s099438435
p00240
u873482706
1437737797
Python
Python
py
Accepted
30
4316
355
while True: n = int(raw_input()) if n == 0: break y = int(raw_input()) res = [] for i in range(n): b, r, t = map(int, raw_input().split()) if t == 1: p = 1+y*(float(r)/100) else: p = (1+(float(r)/100))**y res.append((p, b)) else: pr...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,374
s876818978
p00240
u975539923
1456741449
Python
Python
py
Accepted
40
6844
867
#coding:UTF-8 import math class Bank(object): #type: True complex, False simple def __init__(self, num, rate, type): self.num = num self.rate = rate self.type = type def calc(self, year): if(self.type): return (1 + self.rate / 100.0) ** year else: ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,375
s558437249
p00240
u078042885
1485287179
Python
Python3
py
Accepted
50
7880
265
def S(r,y):return 1+y*r/100 def C(r,y):return pow(1+r/100,y) while 1: n=int(input()) if n==0:break y=int(input()) a=0. for _ in range(n): b,r,t=map(int,input().split()) c=[S(r,y),C(r,y)][t-1] if(a<c): d=b;a=c print(d)
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,376
s727032397
p00240
u546285759
1489918052
Python
Python3
py
Accepted
50
7872
296
while True: n = int(input()) if n == 0: break y = int(input()) dataset = {} for _ in range(n): b, r, t = map(int, input().split()) dataset[b] = (1 + y * (r/100)) if t == 1 else pow((1 + r / 100), y) print(sorted(dataset.items(), key=lambda x: x[1])[-1][0])
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,377
s559476900
p00240
u957021183
1506316850
Python
Python3
py
Accepted
50
7984
703
# Aizu Problem 0240: Interest Rate import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def get_interest1(y, rate): return 100 + y * rate def get_interest2(y, rate): return 100 * (1 + rate / 100)**y while True: n = ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,378
s416000162
p00240
u847467233
1529887260
Python
Python3
py
Accepted
60
5696
306
# AOJ 0240: Interest Rates # Python3 2018.6.25 bal4u while True: n = int(input()) if n == 0: break y = float(input()) id, vmax = -1, 0 for i in range(n): b, r, t = map(int, input().split()) if t == 1: m = y*(r/100)+1 else: m = (r/100+1)**y if id < 0 or m >= vmax: id, vmax = b, m print(id)
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,379
s695920172
p00240
u724548524
1529933511
Python
Python3
py
Accepted
50
5720
267
while 1: n = int(input()) if n == 0:break y = int(input()) b = [tuple(map(int, input().split())) for _ in range(n)] p = [((1 + b[i][1] / 100 * y) if b[i][2] == 1 else ((1 + b[i][1] / 100) ** y)) for i in range(n)] print(b[p.index(max(p))][0])
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,380
s754511249
p00240
u352394527
1530093545
Python
Python3
py
Accepted
60
5684
306
while True: n = int(input()) if n == 0: break y = int(input()) max_x = 0 max_n = -1 for _ in range(n): b, r, t = map(int, input().split()) if t == 1: x = (1 + y * r / 100) else: x = (1 + r / 100) ** y if x > max_x: max_x = x max_n = b print(max_n)
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,381
s237269666
p00240
u104911888
1367373556
Python
Python
py
Accepted
30
4364
333
def smpl(m,y,r): return m*(1+y*r/100.0) def cmpnd(m,y,r): return m*pow((1+r/100.0),y) while True: n=input() if n==0:break y=input() dic={} for i in range(n): b,r,t=map(int,raw_input().split()) rate=smpl(10000,y,r) if t==1 else cmpnd(10000,y,r) dic[rate]=b print ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,382
s039019421
p00240
u759934006
1373229335
Python
Python
py
Accepted
30
4348
472
def simple(y, r): return (100 + y * r) / 100.0 def compound(y, r): return ((100 + r) / 100.0) ** y while True: n = int(raw_input()) if n == 0: break y = int(raw_input()) m = (0, 0) for i in range(n): b, r, t = map(int, raw_input().split()) if t == 1: ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,383
s163067405
p00240
u633068244
1396285333
Python
Python
py
Accepted
40
4316
192
while 1: n=input() if n==0:break y=input() mx=0 for i in range(n): b,r,t=map(int,raw_input().split()) m=(1+y*float(r)/100) if t==1 else (1+float(r)/100)**y if m>mx:mx,a=m,b print a
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,384
s826207211
p00240
u286298310
1595931862
Python
Python3
py
Accepted
50
5688
391
while True: max_p = 0 x = 0 n = int(input()) if n == 0: break y = int(input()) l = [list(map(int,input().split())) for i in range(n)] for i in range(n): if l[i][2] == 1: p = 1 + ( y * l[i][1]/100) else: p = (1 + l[i][1]/100) ** y if ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,385
s530315212
p00240
u153447291
1576667940
Python
Python3
py
Accepted
60
5692
332
while True: n = int(input()) if n == 0: break y = int(input()) money = [] for _ in range(n): a,b,c = map(int,input().split()) if c == 1: money.append([1+b/100*y,a]) else: money.append([(1+b/100)**y,a]) money.sort(reverse = True) print(m...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,386
s749216870
p00240
u803862921
1572346926
Python
Python3
py
Accepted
60
5696
396
while True: num = int(input()) if num == 0: break y = int(input()) rmax = 0 bmax = None for _ in range(num): b, r, t = [int(x) for x in input().split()] if t == 1: val = 1 + r*y/100 else: val = (1 + r/100)**y if val > rmax:...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,387
s594856709
p00240
u433250944
1564896572
Python
Python3
py
Accepted
50
5696
326
while True: n = int(input()) if n==0: break y = float(input()) ans= 0 for i in range(n): b,r,t = map(int,input().split()) if t==1: m = 1+y*(r/100) else: m = (1+(r/100))**y if ans < m: ans = m a = b pri...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,388
s833429456
p00240
u120055135
1564847318
Python
Python3
py
Accepted
50
5704
295
while True: n = int(input()) if n == 0: break y = float(input()) id, vmax = -1, 0 for i in range(n): b, r, t = map(int, input().split()) if t == 1: m = y*(r/100)+1 else: m = (r/100+1)**y if id < 0 or m >= vmax: id, vmax = b, m print(id)
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,389
s185410840
p00240
u525395303
1564719330
Python
Python3
py
Accepted
50
5700
351
# AOJ 0240: Interest Rates # Python3 2018.6.25 bal4u while True: n = int(input()) if n == 0: break y = float(input()) id, vmax = -1, 0 for i in range(n): b, r, t = map(int, input().split()) if t == 1: m = y*(r/100)+1 else: m = (r/100+1)**y if id < 0 or m >= vmax:...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,390
s166693849
p00240
u312033355
1564642105
Python
Python3
py
Accepted
70
5688
333
while 1: N = int(input()) if N == 0: break y = int(input()) v = 0; k = None for i in range(N): b, r, t = map(int, input().split()) if t == 1: w = 1 + y * r /100 else: w = (1 + r / 100) ** y if v < w: v = w k = b ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,391
s025976450
p00240
u811733736
1562772035
Python
Python3
py
Accepted
60
5748
547
# -*- coding: utf-8 -*- """ Interest Rates http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0240 """ import sys def solve(y, banks): return sorted([(1 + r * y / 100, b) if t == 1 else ((1 + r / 100) ** y, b) for b, r, t in banks])[-1][-1] def main(args): while True: n = int(input()) ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,392
s802226484
p00240
u260980560
1562281812
Python
Python3
py
Accepted
50
5680
333
while 1: N = int(input()) if N == 0: break y = int(input()) v = 0; k = None for i in range(N): b, r, t = map(int, input().split()) if t == 1: w = 1 + y * r /100 else: w = (1 + r / 100) ** y if v < w: v = w k = b ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,393
s857942478
p00240
u043254318
1554744277
Python
Python3
py
Accepted
50
5708
529
# coding: utf-8 # Your code here! while True: n = int(input()) if n == 0: break y = int(input()) b = -1 maxMoney = -1 ans = -1 for l in range(n): b,r,t = [float(i) for i in input().split()] money = -1 if t == 1: money = 1.0 + y * r / 100.0 ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,394
s527029362
p00240
u990228206
1551754409
Python
Python3
py
Accepted
50
5692
411
while 1: n=int(input()) if n==0:break y=int(input()) bank_list=[] max_m=0 num_keep=0 mo=0 for i in range(n): bank_list.append(list(map(int,input().split()))) for i in bank_list: if i[2]==1: mo=1+y*i[1]/100 if i[2]==2: mo=(1+(i[1]/100))*...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,395
s490173584
p00240
u717526540
1544492362
Python
Python3
py
Accepted
60
5680
363
while 1: n = int(input()) if n == 0: break y = int(input()) ans = 0 num = 0 for _ in range(n): b, r, t = map(int, input().split()) if t == 1: tmp = 1 + y * (r / 100) else: tmp = pow((1 + r / 100), y) if tmp > ans: ans ...
p00240
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
16,396
s412024804
p00241
u766477342
1415538658
Python
Python3
py
Accepted
40
6732
604
while 1: n = int(input()) if n == 0:break mark = (1,1,1,1, 1,-1,1,-1, 1,-1,-1,1, 1,1,-1,-1) k = (0,1,2,3, 1,0,3,2, 2,3,0,1, 3,2,1,0) for i in range(n): result = [0 for i in range(4)] inp = list(map(int,input()....
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,397
s622195750
p00241
u567380442
1427098239
Python
Python3
py
Accepted
40
6732
517
import sys f = sys.stdin index = [[0,1,2,3], [1,0,3,2], [2,3,0,1], [3,2,1,0]] sign = [[1, 1, 1, 1], [1,-1, 1,-1], [1,-1,-1, 1], [1, 1,-1,-1]] while True: n = int(f.readline()) if n == 0: break for _ in range(n): ab = list(map(int, f.re...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,398
s912273035
p00241
u078042885
1484586032
Python
Python3
py
Accepted
30
7556
335
while 1: n=int(input()) if n==0:break for _ in range(n): x1,y1,z1,w1,x2,y2,z2,w2=map(int,input().split()) print((x1*x2) - (y1*y2) -(z1*z2) -(w1*w2), (x1*y2) + (y1*x2) + (z1*w2) - (w1*z2), (x1*z2) - (y1*w2) + (z1*x2) + (w1*y2), (x1*w2) + (y1*z2) - (z1...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,399
s178031790
p00241
u957021183
1506317328
Python
Python3
py
Accepted
30
7732
586
# Aizu Problem 0241: Quaternion Multiplication import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") while True: n = int(input()) if n == 0: break for k in range(n): a1, a2, a3, a4, b1, b2, b3, b4 = [in...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,400
s880970344
p00241
u847467233
1529887625
Python
Python3
py
Accepted
30
5596
367
# AOJ 0241: Quaternion Multiplication # Python3 2018.6.25 bal4u while True: n = int(input()) if n == 0: break for i in range(n): x1, y1, z1, w1, x2, y2, z2, w2 = map(int, input().split()) x3 = x1*x2 - y1*y2 - z1*z2 - w1*w2 y3 = x1*y2 + y1*x2 + z1*w2 - w1*z2 z3 = x1*z2 - y1*w2 + z1*x2 + w1*y2 w3 = x1*w2 + ...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,401
s820405041
p00241
u724548524
1529935306
Python
Python3
py
Accepted
30
5600
415
b = [[1,2,3,4],[2,-1,4,-3],[3,-4,-1,2],[4,3,-2,-1]] while 1: n = int(input()) if n == 0:break for _ in range(n): x = tuple(map(int, input().split())) x1, x2 = x[:4], x[4:] a = [0,0,0,0] for i in range(4): for j in range(4): if b[i][j] > 0:a[b[i][j]...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,402
s317371313
p00241
u104911888
1367372272
Python
Python
py
Accepted
10
4236
293
while True: n=input() if n==0:break for i in range(n): x1,y1,z1,w1,x2,y2,z2,w2=map(int,raw_input().split()) x3=x1*x2-y1*y2-z1*z2-w1*w2 y3=x1*y2+x2*y1+z1*w2-w1*z2 z3=x1*z2-y1*w2+x2*z1+y2*w1 w3=x1*w2+y1*z2-y2*z1+x2*w1 print x3,y3,z3,w3
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,403
s447054060
p00241
u633068244
1396286018
Python
Python
py
Accepted
20
4216
173
while 1: n=input() if n==0:break for i in range(n): a,b,c,d,x,y,z,w=map(int,raw_input().split()) print a*x-b*y-c*z-d*w,a*y+b*x+c*w-d*z,a*z-b*w+c*x+d*y,a*w+b*z-c*y+d*x
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,404
s113697331
p00241
u240091169
1589591338
Python
Python3
py
Accepted
20
5592
307
while True : n = int(input()) if n == 0 : break for i in range(n) : x1, y1, z1, w1, x2, y2, z2, w2 = map(int, input().split()) print((x1*x2 - y1*y2 - z1*z2 - w1*w2), (x1*y2 + x2*y1 + z1*w2 - z2*w1), (x1*z2 - y1*w2 + x2*z1 + y2*w1), (x1*w2 + y1*z2 - y2*z1 + x2*w1))
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,405
s077004088
p00241
u260980560
1582124328
Python
Python3
py
Accepted
30
5596
525
while 1: N = int(input()) if N == 0: break P = [ [1, 2, 3, 4], [2, -1, 4, -3], [3, -4, -1, 2], [4, 3, -2, -1], ] for i in range(N): *X, = map(int, input().split()) X0 = X[:4]; X1 = X[4:] Y = [0]*4 for i, x0 in enumerate(X0): ...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,406
s273208421
p00241
u394465997
1560767286
Python
Python3
py
Accepted
30
5604
430
# from sys import exit while(True): N = int(input()) if N == 0: break for _ in range(N): a, b, c, d, A, B, C, D = [int(n) for n in input().split()] z = a*A - b*B - c*C - d*D i = a*B + b*A + c*D - d*C j = a*C - b*D + c*A + d*B k = a*D + b*C - c*B + d*A ...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,407
s909000032
p00241
u043254318
1554653420
Python
Python3
py
Accepted
30
5604
406
# coding: utf-8 # Your code here! while True: N = int(input()) if N == 0: break for i in range(N): x1,y1,z1,w1,x2,y2,z2,w2 = [int(j) for j in input().split()] a1 = x1*x2 - y1*y2 - z1*z2 - w1*w2 a2 = x1*y2 + y1*x2 + z1*w2 - w1*z2 a3 = x1*z2 - y1*w2 + z1*x2 + w1*y...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,408
s050329501
p00241
u990228206
1551747160
Python
Python3
py
Accepted
30
5600
220
while 1: n=int(input()) if n==0:break ans=[0]*(n+1)**2 for i in range(0,n): a,b,c,d,e,f,g,h=map(int,input().split()) print(a*e-b*f-c*g-d*h,a*f+b*e+c*h-d*g,a*g-b*h+c*e+d*f,a*h+b*g-c*f+d*e)
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,409
s180131188
p00241
u717526540
1544578736
Python
Python3
py
Accepted
30
5600
541
while 1: n = int(input()) if n == 0: break for _ in range(n): data = list(map(int, input().split())) c = data[0]*data[4] - data[1]*data[5] - \ data[2]*data[6] - data[3]*data[7] i = data[0]*data[5] + data[1]*data[4] + \ data[2]*data[7] - data[3]*data[6...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,410
s740246321
p00241
u352394527
1543870757
Python
Python3
py
Accepted
30
5600
352
while True: n = int(input()) if n == 0: break for _ in range(n): x1, y1, z1, w1, x2, y2, z2, w2 = map(int, input().split()) x3 = x1 * x2 - y1 * y2 - z1 * z2 - w1 * w2 y3 = x1 * y2 + y1 * x2 + z1 * w2 - w1 * z2 z3 = x1 * z2 - y1 * w2 + z1 * x2 + w1 * y2 w3 = x1 * w2 + y1 * z2 - z1 * y2 + w1...
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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
2 1 2 3 4 7 6 7 8 5 6 7 8 3 2 3 4 0
-58 16 36 32 -50 32 28 48
16,411
s980151998
p00242
u621997536
1407686000
Python
Python3
py
Accepted
60
6732
657
class T: def __init__(self): self.min_count = 0 self.words = {} while True: data = {chr(c): T() for c in range(ord('a'), ord('z') + 1)} n = int(input()) if not n: break for i in range(n): for s in input().split(): d = data[s[0]] if s in d.word...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,412
s694831758
p00242
u766477342
1419506957
Python
Python3
py
Accepted
60
6724
450
from collections import Counter dic = {} def add(x): if x[0] not in dic: dic[x[0]] = Counter() dic[x[0]][x] += 1 while 1: dic = {} n = int(input()) if n == 0:break for l in [input() for i in range(n)]: for w in l.split(): add(w) k = input() if k not in dic...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,413
s682960009
p00242
u873482706
1437318062
Python
Python
py
Accepted
30
4296
987
def f(): c = None s = None ans = [] for i, t in enumerate(sorted(data.items(), key=lambda x: x[1], reverse=True)): ans.append(t[0]) if c is None: c = t[1] s = i else: if c != t[1] and 4 <= i: ans = ans[:s]+sorted(ans[s:i])+ans[i...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,414
s871156701
p00242
u957021183
1506317954
Python
Python3
py
Accepted
40
7904
675
# Aizu Problem 0242: Input Candidates import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") while True: n = int(input()) if n == 0: break text = [] count = {} for _ in range(n): for word in inpu...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,415
s390527317
p00242
u847467233
1529897907
Python
Python3
py
Accepted
40
5616
541
# AOJ 0242: Input Candidates # Python3 2018.6.25 bal4u while 1: n = int(input()) if n == 0: break idx = {} dict = {} for i in range(n): for j in list(input().split()): if j in dict: dict[j] += 1 else: dict[j] = 1 if j[0] not in idx: idx[j[0]] = [] idx[j[0]].append(j) k = input() if k no...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,416
s315749761
p00242
u847467233
1529898221
Python
Python3
py
Accepted
40
5616
516
# AOJ 0242: Input Candidates # Python3 2018.6.25 bal4u while 1: n = int(input()) if n == 0: break idx, dict = {}, {} for i in range(n): for j in list(input().split()): if j in dict: dict[j] += 1 else: dict[j] = 1 if j[0] not in idx: idx[j[0]] = [] idx[j[0]].append(j) k = input() if k not in i...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,417
s655284803
p00242
u724548524
1529936413
Python
Python3
py
Accepted
40
5616
458
while 1: n = int(input()) if n == 0:break c = {} for _ in range(n): s = input().split() for e in s: if e in c:c[e] += 1 else:c[e] = 1 c = [(e, c[e]) for e in c.keys()] c.sort(key = lambda x:x[0]) c.sort(key = lambda x:x[1], reverse = True) s = inpu...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,418
s746575737
p00242
u352394527
1530100352
Python
Python3
py
Accepted
40
5624
497
while True: n = int(input()) if n == 0: break dic = {} for _ in range(n): ss = input().split() for s in ss: if s[0] in dic: dic[s[0]].append(s) else: dic[s[0]] = [s] k = input() if k not in dic: print("NA") continue lst = dic[k] k_dic = {} for s in lst:...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,419
s755161602
p00242
u759949288
1363892869
Python
Python
py
Accepted
40
4244
339
while True: n = input() if n == 0: break words = [] for i in xrange(n): words += raw_input().split() candidates = {} for w in set(words): c = words.count(w) candidates.setdefault(w[0], []) candidates[w[0]] += [(-c, w)] try: print " ".join([w for c, w in sorted(candidates[raw_input()])][:5]) except Key...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,420
s364785354
p00242
u104911888
1367378003
Python
Python
py
Accepted
20
4708
432
from collections import defaultdict as dd while True: n=input() if n==0:break dic,L=dd(dict),[] for i in range(n): L+=raw_input().split() k=raw_input() for i in L: if i not in dic[i[0]]: dic[i[0]][i]=-1 else: dic[i[0]][i]-=1 if k not in dic: ...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,421
s976311462
p00242
u759934006
1373201180
Python
Python
py
Accepted
20
4272
647
# Input Candidates def compare(x, y): if x[1] == y[1]: return cmp(x[0], y[0]) else: return cmp(x[1], y[1]) * -1 while True: n = int(raw_input()) if n == 0: break dic = {} for i in range(n): words = raw_input().strip().split() for word in words: ...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,422
s300284479
p00242
u633068244
1396720372
Python
Python
py
Accepted
30
4240
352
while 1: n=input() if n==0:break dic={} for i in range(n): msg=raw_input().split() for word in msg: if word in dic: dic[word]+=1 else: dic[word]=1 alpha=raw_input() ans=[] for k,v in sorted(sorted(dic.items()),key=lambda x:x[1],reverse=True): if k[0]==alpha:ans.append(k) print " ".join(map(s...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,423
s448986781
p00242
u633068244
1396720422
Python
Python
py
Accepted
30
4244
333
while 1: n=input() if n==0:break dic={} for i in range(n): msg=raw_input().split() for word in msg: try:dic[word]+=1 except:dic[word]=1 alpha=raw_input() ans=[] for k,v in sorted(sorted(dic.items()),key=lambda x:x[1],reverse=True): if k[0]==alpha:ans.append(k) print " ".join(map(str,ans)) if len(ans...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,424
s764448069
p00242
u056829778
1593415915
Python
Python3
py
Accepted
50
5624
799
while 1: n = int(input()) if n == 0: break line = [list(input().split()) for _ in range(n)] k = input() words = {} for i in line: for word in i: if word in words: words[word] += 1 else: words[word] = 1 cand = {key: v for key, v ...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,425
s388247374
p00242
u811733736
1586929938
Python
Python3
py
Accepted
60
6740
673
# -*- coding: utf-8 -*- """ Input Candidates http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0242 """ import sys from string import ascii_lowercase from collections import defaultdict def solve(n): d = {ch: defaultdict(int) for ch in ascii_lowercase} for _ in range(n): for word in input().s...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,426
s370734710
p00242
u630911389
1584894944
Python
Python3
py
Accepted
40
5620
552
# 参考:http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3286382#1 while 1: n = int(input()) if n == 0: break words,dic = [],[] for i in range(n): data = list(input().split()) for d in data: words.append(d) k = input() setWords = list(set(words)) for ...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
1 ben likes bananas the best among many fruits because bananas are sweet and cheap b 1 winners get to visit aizu and the university of aizu and make many friends as well a 3 ask alex about the answer for the assignment on android apps a 2 programming is both a sport and an intellectual puzzle c 0
bananas because ben best aizu and as about alex android answer apps NA
16,427