submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s702882945
p00239
Runtime Error
#include<iostream> using namespace std; int main() { while(1) { int n; int table[1001][4]; cin >> n; if(!n) break; for(int i = 0; i < n; i++) { cin >> table[i][0] >> table[i][1] >> table[i][2] >> table[i][3]; table[i][4] = table[i][1] * 4 + table[i][2] * 9 + table[i][3] *...
4 1 7 14 47 2 5 35 55 3 6 3 59 4 6 5 15 10 15 50 400 2 1 8 10 78 2 4 18 33 10 10 50 300 0
1 4 NA
<H1>カロリー計算</H1> <!-- <p> 天高く馬肥ゆる秋。そろそろ食べ物が美味しくなる季節です。高校生のよしお君 も、テレビや読書のお供についついお菓子に手が伸びてしまいます。そのせいか最近体重は増える一方で、健康的にもよろしくありません。しかしどうしても直ぐに間食がやめられないよしお君は、お菓子の栄養素やカロリーが制限された場合に、食べたいお菓子を、食べてもよいお菓子と食べてはいけないお菓子に分類することにしました。 </p> --> <p> 食べ物には3大栄養素と呼ばれる「たんぱく質」「脂質」「炭水化物」の3つの栄養素が含まれています。1g(グラム)あたりたんぱく質と炭水化物は 4 kcal(キロカロリー)、脂...
s103341487
p00239
Runtime Error
#include<iostream> using namespace std; int main() { while(1) { int n; int table[1001][5]; cin >> n; if(!n) break; for(int i = 0; i < n; i++) { cin >> table[i][0] >> table[i][1] >> table[i][2] >> table[i][3]; table[i][4] = table[i][1] * 4 + table[i][2] * 9 + table[i][3] *...
4 1 7 14 47 2 5 35 55 3 6 3 59 4 6 5 15 10 15 50 400 2 1 8 10 78 2 4 18 33 10 10 50 300 0
1 4 NA
<H1>カロリー計算</H1> <!-- <p> 天高く馬肥ゆる秋。そろそろ食べ物が美味しくなる季節です。高校生のよしお君 も、テレビや読書のお供についついお菓子に手が伸びてしまいます。そのせいか最近体重は増える一方で、健康的にもよろしくありません。しかしどうしても直ぐに間食がやめられないよしお君は、お菓子の栄養素やカロリーが制限された場合に、食べたいお菓子を、食べてもよいお菓子と食べてはいけないお菓子に分類することにしました。 </p> --> <p> 食べ物には3大栄養素と呼ばれる「たんぱく質」「脂質」「炭水化物」の3つの栄養素が含まれています。1g(グラム)あたりたんぱく質と炭水化物は 4 kcal(キロカロリー)、脂...
s843862331
p00240
Wrong Answer
def ganri(y, b, r, t): if r == 1: return 1 * (1 + y * (r/100)) else: return 1 * ((1 + (r/100)) ** y) ans = [] while True: try: n = int(input()) if (n == 0): raise except: print('\n'.join(ans)) break y = int(input()) results = [] for i in ra...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s370840817
p00240
Wrong Answer
def ganri(y, b, r, t): if r == 1: return (1 + y * (r/100)) else: return ((1 + (r/100)) ** y) ans = [] while True: try: n = int(input()) if (n == 0): raise except: print('\n'.join(ans)) break y = int(input()) results = [] for i in range(1, n...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s147266576
p00240
Wrong Answer
def ganri(y, b, r, t): if t == 1: return 1 + y * (r/100) else: return (1 + (r/100)) ** y ans = [] while True: try: n = int(input()) if (n == 0): raise except: print('\n'.join(ans)) break y = int(input()) results = [] for i in range(1, n+1):...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s348351297
p00240
Wrong Answer
def ganri(y, b, r, t): if t == 1: return 1 + y * (r/100) else: return (1 + (r/100)) ** y ans = [] while True: try: n = int(input()) if (n == 0): raise except: print('\n'.join(ans)) print() break y = int(input()) results = [] for i i...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s737134021
p00240
Accepted
from fractions import Fraction n = input() while n != 0: y = input() maxi = Fraction() maxi_num = 0 while n > 0: n -= 1 input_num = raw_input().split() b = int(input_num[0]) r = int(input_num[1]) t = int(input_num[2]) money = None if...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s607794819
p00240
Accepted
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 ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s917951784
p00240
Accepted
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...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s099438435
p00240
Accepted
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...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s876818978
p00240
Accepted
#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: ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s558437249
p00240
Accepted
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)
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s727032397
p00240
Accepted
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])
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s559476900
p00240
Accepted
# 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 = ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s416000162
p00240
Accepted
# 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)
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s695920172
p00240
Accepted
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])
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s754511249
p00240
Accepted
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)
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s237269666
p00240
Accepted
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 ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s039019421
p00240
Accepted
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: ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s163067405
p00240
Accepted
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
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s826207211
p00240
Accepted
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 ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s530315212
p00240
Accepted
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...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s749216870
p00240
Accepted
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:...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s594856709
p00240
Accepted
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...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s833429456
p00240
Accepted
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)
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s185410840
p00240
Accepted
# 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:...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s166693849
p00240
Accepted
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 ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s025976450
p00240
Accepted
# -*- 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()) ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s857942478
p00240
Accepted
# 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 ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s527029362
p00240
Accepted
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))*...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s490173584
p00240
Accepted
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 ...
2 8 1 5 2 2 6 1 2 9 1 5 2 2 6 1 0
2 1
<H1>金利計算</H1> <p> 金利は銀行に預けているお金に付き、その計算方法や利率は銀行によって様々です。利息と元金を合わせたものを元利と呼びますが、元利の計算方法として、利息を元金に組み入れずに計算する「単利」と利息を元金に組み入れて計算する「複利」というものがあり、より多くの元利を得るためにはこの差異を理解していなければなりません。元利の計算方法は以下のようになります。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br> <br> <img src="https://judgeapi....
s929575646
p00241
Wrong Answer
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]] n = int(f.readline()) for _ in range(n): ab = list(map(int, f.readline().split())) ret = [0] * 4 for i, a in...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s416170816
p00241
Wrong Answer
# 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") n = int(input()) for k in range(n): a1, a2, a3, a4, b1, b2, b3, b4 = [int(__) for __ in input().split()] p1 = a1 * b1 - a...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s871526267
p00241
Wrong Answer
for _ in range(int(input())): x = tuple(map(int, input().split())) x1, x2 = x[:4], x[4:] a = [0,0,0,0] b = [[1,2,3,4],[2,-1,4,-3],[3,-4,-1,2],[4,3,-2,-1]] for i in range(4): for j in range(4): if b[i][j] > 0:a[b[i][j] - 1] += x1[i] * x2[j] else:a[-b[i][j] - 1] -= x1[i...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s607437924
p00241
Wrong Answer
b = [[1,2,3,4],[2,-1,4,-3],[3,-4,-1,2],[4,3,-2,-1]] for _ in range(int(input())): 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] - 1] += x1[i] * x2[j] else:a[-b[i][j] - 1] -= x1[i] * ...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s017651529
p00241
Wrong Answer
for _ in range(int(input())): 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 * y2 + w1 * x2)
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s412024804
p00241
Accepted
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()....
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s622195750
p00241
Accepted
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...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s912273035
p00241
Accepted
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...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s178031790
p00241
Accepted
# 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...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s880970344
p00241
Accepted
# 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 + ...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s820405041
p00241
Accepted
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]...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s317371313
p00241
Accepted
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
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s447054060
p00241
Accepted
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
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s113697331
p00241
Accepted
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))
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s077004088
p00241
Accepted
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): ...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s273208421
p00241
Accepted
# 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 ...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s909000032
p00241
Accepted
# 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...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s050329501
p00241
Accepted
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)
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s180131188
p00241
Accepted
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...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s740246321
p00241
Accepted
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...
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
<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> 複素数を拡張したものに四元数と呼ばれるものがあります。物体の回転などを表現するのに便...
s477155032
p00242
Wrong Answer
import collections as C while True: n = int(input()) if n == 0: break d = {} for _ in range(n): tmp = input().split() for t in tmp: k = t[0] d[k] = [t] if k not in d else d[k]+[t] k = input() words = d.get(k, 0) if words: res = sorted(C...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s154605278
p00242
Wrong Answer
import collections as C while True: n = int(input()) if n == 0: break d = {} for _ in range(n): tmp = input().split() for t in tmp: k = t[0] d[k] = [t] if k not in d else d[k]+[t] k = input() words = d.get(k, 0) if words: res = sorted(C...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s043178489
p00242
Wrong Answer
from collections import Counter while True: n = int(input()) if n == 0: break dataset = [input().split() for _ in range(n)] counter = Counter() k = input() for line in dataset: for word in line: if word[0] == k: counter[word] += 1 candidates = sor...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s870733852
p00242
Wrong Answer
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[1], reverse = True) c.sort(key = lambda x:x[0]) s = inpu...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s960952510
p00242
Wrong Answer
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[1], reverse = True) c.sort(key = lambda x:x[0]) s = inpu...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s673515918
p00242
Wrong Answer
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() flag=0 for k,v in sorted(dic.items(),key=lambda x:x[1]): if k[0]==alpha: print k, flag=1 print "" if flag else "NA"
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s980151998
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s694831758
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s230047085
p00242
Accepted
import sys import string import operator from collections import Counter f = sys.stdin while True: n = int(f.readline()) if n == 0: break counters = {c:Counter() for c in string.ascii_lowercase} for i in range(n): for word in f.readline().strip().split(): counters[word[...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s682960009
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s973616292
p00242
Accepted
while True: n = input() if n == 0: break candidate = {} for i in range(n): words = raw_input().split(" ") for word in words: for key in candidate.iterkeys(): if key == word: candidate[key] += 1 break ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s871156701
p00242
Accepted
# 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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s390527317
p00242
Accepted
# 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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s315749761
p00242
Accepted
# 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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s655284803
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s746575737
p00242
Accepted
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:...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s755161602
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s364785354
p00242
Accepted
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: ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s976311462
p00242
Accepted
# 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: ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s300284479
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s448986781
p00242
Accepted
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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s764448069
p00242
Accepted
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 ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s388247374
p00242
Accepted
# -*- 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...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s370734710
p00242
Accepted
# 参考: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 ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s703971541
p00242
Accepted
from collections import defaultdict, Counter while 1: N = int(input()) if N == 0: break mp = defaultdict(list) for i in range(N): for word in input().split(): mp[word[0]].append(word) k = input() c = Counter(mp[k]) if len(c) == 0: print("NA") else: ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s559326057
p00242
Accepted
from collections import defaultdict while True: n = int(input()) if n==0: break initial = defaultdict(set) cnt = defaultdict(int) for _ in range(n): l = list(input().split()) for li in l: initial[li[0]].add(li) cnt[li] += 1 ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s790400448
p00242
Accepted
import heapq from collections import deque from enum import Enum import sys import math from _heapq import heappush, heappop import copy BIG_NUM = 2000000000 HUGE_NUM = 99999999999999999 MOD = 1000000007 EPS = 0.000000001 sys.setrecursionlimit(100000) class Info: def __init__(self,arg_word,arg_count): se...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s315580735
p00242
Accepted
# coding: utf-8 # Your code here! class Word: def __init__(self, word, cnt): self.word = word self.cnt = cnt def __lt__(self, other): if self.cnt == other.cnt: return self.word < other.word else: return self.cnt > other.cnt while True: ...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s218426570
p00242
Accepted
import collections while 1: n=int(input()) if n==0:break words=[] words_match=[] count=0 ans=[] for i in range(n): words+=list(map(str,input().split())) keyword=input() words.sort() for i in words: if keyword==i[0]:words_match.append(i) count_dict = collection...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s663136330
p00242
Accepted
while 1: n = int(input()) if n == 0: break word = [] for _ in range(n): data = list(input().split()) for d in data: word.append(d) k = input() word_u = list(set(word)) dic = [] for w in word_u: if w[0] == k: dic.append([w, word.co...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s561355016
p00242
Runtime Error
import sys import string from collections import Counter f = sys.stdin while True: n = int(f.readline()) if n == 0: break counters = {c:Counter() for c in string.ascii_lowercase} for i in range(n): for word in f.readline().strip().split(): counters[word[0]].update([word...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s935418528
p00242
WA: Presentation Error
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() flag=0 for k,v in sorted(sorted(dic.items()),key=lambda x:x[1],reverse=True): if k[0]==alpha: print k, flag=1 print "" if...
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
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
s052579612
p00243
Time Limit Exceeded
from collections import deque def paintout(s, color): cnt, pre_color, h, w = 0, s[0][0], len(s), len(s[0]) que = deque([(0, 0)]) while len(que): x, y = que.pop() if 0 <= x < w and 0 <= y < h and s[y][x] == pre_color: s[y][x] = color cnt +=1 que.extend(((x...
3 3 R G B G G G G B B 2 4 R G G G R B B R 4 3 G G B R G R R G B G G R 0 0
2 4 4
<H1>塗りつぶしゲーム</H1> <p> 指で画面にタッチして操作することのできるタブレットインターフェースの技術は、ゲームの分野でも応用され、新しい操作感を持つ様々な種類のゲームが作られています。現在、AZ社が開発しているゲームもその一つです。 </p> <p> このソフトウェア(ゲーム)の要件は以下の通りです。 </p> <ul> <li> 画面には <var>X</var> 列&times; <var>Y</var>行の2次元グリッドがあります。</li> <li> グリッドのセルは赤(R)、緑(G)、茶(B)の3色のいずれかで塗られています。</li> <li> セルの色を変更するボタンR、G、Bがあり、このボタ...
s946651267
p00243
Time Limit Exceeded
from collections import deque def paintout(s, color,w,h): cnt, pre_color = 0, s[0] que = deque([(0, 0)]) while len(que): x, y = que.pop() pos = y * w + x if 0 <= x < w and 0 <= y < h and s[pos] == pre_color: s[pos] = color cnt +=1 que.extend(((x-1...
3 3 R G B G G G G B B 2 4 R G G G R B B R 4 3 G G B R G R R G B G G R 0 0
2 4 4
<H1>塗りつぶしゲーム</H1> <p> 指で画面にタッチして操作することのできるタブレットインターフェースの技術は、ゲームの分野でも応用され、新しい操作感を持つ様々な種類のゲームが作られています。現在、AZ社が開発しているゲームもその一つです。 </p> <p> このソフトウェア(ゲーム)の要件は以下の通りです。 </p> <ul> <li> 画面には <var>X</var> 列&times; <var>Y</var>行の2次元グリッドがあります。</li> <li> グリッドのセルは赤(R)、緑(G)、茶(B)の3色のいずれかで塗られています。</li> <li> セルの色を変更するボタンR、G、Bがあり、このボタ...
s230513000
p00243
Time Limit Exceeded
from collections import deque def paintout(s, color,w,h): cnt, pre_color = 0, s[0] que = deque([(0, 0)]) while len(que): x, y = que.pop() pos = y * w + x if 0 <= x < w and 0 <= y < h and s[pos] == pre_color: s[pos] = color cnt +=1 que.extend(((x-1...
3 3 R G B G G G G B B 2 4 R G G G R B B R 4 3 G G B R G R R G B G G R 0 0
2 4 4
<H1>塗りつぶしゲーム</H1> <p> 指で画面にタッチして操作することのできるタブレットインターフェースの技術は、ゲームの分野でも応用され、新しい操作感を持つ様々な種類のゲームが作られています。現在、AZ社が開発しているゲームもその一つです。 </p> <p> このソフトウェア(ゲーム)の要件は以下の通りです。 </p> <ul> <li> 画面には <var>X</var> 列&times; <var>Y</var>行の2次元グリッドがあります。</li> <li> グリッドのセルは赤(R)、緑(G)、茶(B)の3色のいずれかで塗られています。</li> <li> セルの色を変更するボタンR、G、Bがあり、このボタ...
s585483264
p00243
Time Limit Exceeded
from collections import deque def paintout(s, color,w,h): cnt, pre_color = 0, s[0] que = deque([(0, 0)]) while len(que): x, y = que.pop() pos = y * w + x if s[pos] == pre_color: s[pos] = color cnt +=1 if 0 < x: que.append((x-1,y))...
3 3 R G B G G G G B B 2 4 R G G G R B B R 4 3 G G B R G R R G B G G R 0 0
2 4 4
<H1>塗りつぶしゲーム</H1> <p> 指で画面にタッチして操作することのできるタブレットインターフェースの技術は、ゲームの分野でも応用され、新しい操作感を持つ様々な種類のゲームが作られています。現在、AZ社が開発しているゲームもその一つです。 </p> <p> このソフトウェア(ゲーム)の要件は以下の通りです。 </p> <ul> <li> 画面には <var>X</var> 列&times; <var>Y</var>行の2次元グリッドがあります。</li> <li> グリッドのセルは赤(R)、緑(G)、茶(B)の3色のいずれかで塗られています。</li> <li> セルの色を変更するボタンR、G、Bがあり、このボタ...
s094086103
p00243
Time Limit Exceeded
from collections import deque def paintout(s, color,w,h): cnt, pre_color = 0, s[0] que = deque([(0, 0)]) while len(que): x, y = que.popleft() pos = y * w + x if s[pos] == pre_color: s[pos] = color cnt +=1 if x + 1 < w: que.append(...
3 3 R G B G G G G B B 2 4 R G G G R B B R 4 3 G G B R G R R G B G G R 0 0
2 4 4
<H1>塗りつぶしゲーム</H1> <p> 指で画面にタッチして操作することのできるタブレットインターフェースの技術は、ゲームの分野でも応用され、新しい操作感を持つ様々な種類のゲームが作られています。現在、AZ社が開発しているゲームもその一つです。 </p> <p> このソフトウェア(ゲーム)の要件は以下の通りです。 </p> <ul> <li> 画面には <var>X</var> 列&times; <var>Y</var>行の2次元グリッドがあります。</li> <li> グリッドのセルは赤(R)、緑(G)、茶(B)の3色のいずれかで塗られています。</li> <li> セルの色を変更するボタンR、G、Bがあり、このボタ...
s628362831
p00243
Accepted
def paintout_graph(s, g, color): cnt, pre_color = 0, s[0] que = [0] for pos in que: if s[pos] == pre_color: s[pos] = color cnt +=1 que.extend(g[pos]) return cnt def bfs(s, graph): que = deque([(s,0,0)]) while True: s,pre_cnt,depth = que.popleft...
3 3 R G B G G G G B B 2 4 R G G G R B B R 4 3 G G B R G R R G B G G R 0 0
2 4 4
<H1>塗りつぶしゲーム</H1> <p> 指で画面にタッチして操作することのできるタブレットインターフェースの技術は、ゲームの分野でも応用され、新しい操作感を持つ様々な種類のゲームが作られています。現在、AZ社が開発しているゲームもその一つです。 </p> <p> このソフトウェア(ゲーム)の要件は以下の通りです。 </p> <ul> <li> 画面には <var>X</var> 列&times; <var>Y</var>行の2次元グリッドがあります。</li> <li> グリッドのセルは赤(R)、緑(G)、茶(B)の3色のいずれかで塗られています。</li> <li> セルの色を変更するボタンR、G、Bがあり、このボタ...
s922215408
p00244
Wrong Answer
while 1: n,m = list(map(int,input().split())) if n == 0:break costs = {x:[] for x in range(1,n+1)} min_cost = [[-1 for x in range(3)] for y in range(n+1)] for i in range(m): a,b,c = list(map(int,input().split())) costs[a].append((b,c)) costs[b].append((a,c)) spam = [(0,1...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s034160444
p00244
Wrong Answer
MAX_VAL = 99999999999 while 1: n,m = list(map(int,input().split())) if n == 0:break costs = {x:[] for x in range(1,n+1)} min_cost = [[MAX_VAL for x in range(2)] for y in range(n+1)] for i in range(m): a,b,c = list(map(int,input().split())) costs[a].append((b,c)) costs[b].appe...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s746212043
p00244
Wrong Answer
import copy def f1(p, cost, route): for k, c in data.items(): a, b = k if p == a: if not b in route: v1, v2, v3 = f2(p, c, cost) if not b in cost or v1 < cost[b][0]: cost[b] = [v1, v2, v3] elif p == b: if not a in r...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s564774484
p00244
Wrong Answer
import copy def f1(p, cost, route): for k, c in data.items(): a, b = k if p == a: if not b in route: v1, v2, v3 = f2(p, c, cost) if not b in cost or v1 < cost[b][0]: cost[b] = [v1, v2, v3] elif p == b: if not a in r...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s674650732
p00244
Wrong Answer
import copy def f1(p, cost, route): for k, c in data.items(): a, b = k if p == a: if not b in route: v1, v2, v3 = f2(p, c, cost) if not b in cost or v1 < cost[b][0]: cost[b] = [v1, v2, v3] elif p == b: if not a in r...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s253716786
p00244
Accepted
MAX_VAL = 99999999999 while 1: n,m = list(map(int,input().split())) if n == 0:break costs = {x:[] for x in range(1,n+1)} min_cost = [[MAX_VAL for x in range(2)] for y in range(n+1)] for i in range(m): a,b,c = list(map(int,input().split())) costs[a].append((b,c)) costs[b].appe...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s204333140
p00244
Accepted
MAX_V = 999999999999999999999 while 1: n,m = list(map(int,input().split())) if n == 0:break costs = {x:[] for x in range(1,n+1)} passed = [[0 for x in range(2)] for y in range(n+1)] result = [MAX_V,MAX_V] for i in range(m): a,b,c = list(map(int,input().split())) costs[a].append((...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s233975855
p00244
Accepted
MAX_V = 999999999999999999999 while 1: n,m = list(map(int,input().split())) if n == 0:break costs = {x:[] for x in range(1,n+1)} passed = [[False for x in range(2)] for y in range(n+1)] result = [MAX_V,MAX_V] for i in range(m): a,b,c = list(map(int,input().split())) costs[a].appe...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s190435672
p00244
Accepted
from heapq import heappush, heappop INF = 10 ** 20 while True: n, m = map(int, input().split()) if n == 0: break edges = [[] for _ in range(n * 2)] for _ in range(m): a, b, c = map(int, input().split()) a -= 1 b -= 1 edges[a].append((b, c)) edges[a + n].append((b + n, c)) edges[b].a...
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s801159609
p00244
Accepted
def solve(): from sys import stdin f_i = stdin from heapq import heappush, heappop while True: n, m = map(int, f_i.readline().split()) if n == 0: break adj = [[] for i in range(n)] for i in range(m): a, b, c = map(int, f_i.readline()....
2 1 1 2 5 3 2 1 2 5 2 3 5 6 9 1 2 7 1 3 9 1 5 14 2 3 10 2 4 15 3 4 11 3 5 2 4 5 9 4 6 8 0 0
5 0 7
<H1>温泉旅行</H1> <p> 温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。 </p> <p> その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。 </p> <p> 出発地と目的地、及び中継...
s105420314
p00245
Accepted
from heapq import heappush, heappop from string import digits import sys readline = sys.stdin.readline write = sys.stdout.write dd = ((-1, 0), (0, -1), (1, 0), (0, 1)) INF = 10**9 while 1: X, Y = map(int, readline().split()) if X == Y == 0: break MP = [readline().split() for i in range(Y)] N = ...
6 5 1 1 . 0 0 4 1 . . . . . . . 2 2 . . . . 2 2 3 3 P . . . . . 5 0 50 5 10 1 20 0 10 2 10 5 15 3 150 3 5 4 100 8 9 0 0
180
<H1>タイムセール</H1> <p> より良い物を、より安く。今日もどこかのスーパーマーケットで行われるタイムセールでは、激しい闘いが繰り広げられています。ここ会津にある「LL堂」もそんなスーパーマーケットのひとつで、他のチェーン店と対抗すべく、少し変わったタイムセールを実施しています。一般的なタイムセールでは複数の商品が同じ時間に安くなるものですが、LL堂では対象となる商品によって、タイムセールを開始する時間が別々に設定されています。 </p> <p> 坂井家はLL堂をよく利用する家庭の一つです。そんな坂井家では、奥様主導のもと、次の日曜に行われるタイムセールに向けて作戦会議を開き、どのような順番で買い物をすれば値引きが...