AtCoder Beginner Contest 189,190,191 A〜B問題

前書き

AtCoder Beginner Contest 189,190,191 A〜B問題を解きました。

A問題(AtCoder Beginner Contest 191)

  • 難易度:灰
  • 時間:8分

atcoder.jp

V,T,S,D=map(int,input().split())
if T*V<=D and D<=S*V: print('No') 
else: print('Yes')

B問題(AtCoder Beginner Contest 191)

  • 難易度:灰
  • 時間:5分

atcoder.jp

import numpy as np
N,X = map(int, input().split())
A = list(map(int,input().split()))
ans = [str(a) for a in A if a != X] 
print(' '.join(ans))

A問題(AtCoder Beginner Contest 190)

  • 難易度:灰
  • 時間:3分

atcoder.jp

A,B,C = map(int,input().split())
if (A-B+C)>0: print('Takahashi')
else: print('Aoki')

B問題(AtCoder Beginner Contest 190)

  • 難易度:灰
  • 時間:5分

atcoder.jp

import sys
N,S,D=map(int,input().split())
XY=[list(map(int,input().split()))for n in range(N)]
for xy in XY:
  if (xy[0]<S)and(xy[1]>D):
    print('Yes')
    sys.exit()
print('No')

A問題(AtCoder Beginner Contest 191)

  • 難易度:灰
  • 時間:2分

atcoder.jp

A = list(input())
print('Won') if A[0]==A[1]==A[2] else print('Lost')

B問題

  • 難易度:灰
  • 時間:WA→AC

atcoder.jp


当初(アルコール濃度 / 100) * 溶液量からアルコール量を算定していました、除算で発生する誤差が、結果に大きく影響を与えてしまうと、WAになります。

極力、除算を避けるコードを書くべきですね。

import sys
N,X = map(int,input().split())
V = [list(map(int,input().split()))for i in range(N)]

sum_ = 0
for j,v in enumerate(V):
  sum_+=v[0]*v[1]
  if sum_>X*100: 
    print(j+1)
    sys.exit()
print(-1)