0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AtCoder Regular Contest 105 参戦記

Posted at

AtCoder Regular Contest 105 参戦記

ARC105A - Fourtune Cookies

3分で突破. 全部試せば良い.

A, B, C, D = map(int, input().split())

s = sum([A, B, C, D])
for x in [A, B, C, D, A + B, A + C, A + D, B + C, B + D, C + D]:
    if x == s - x:
        print('Yes')
        break
else:
    print('No')

ARC105B - MAX-=min

10分で突破. 言うまでもなくナイーブにシミュレートしたりすると、最大値を優先度付きキューとかで高速に取り出せたとしても、最小値 x = 1 とかの時に TLE 必死. かといって、余りを使ってシミュレートしても TLE する、鬼か.

この計算って実は最大公約数を求める問題だと気づければ、以下で解ける.

from math import gcd
from functools import reduce

N, *a = map(int, open(0).read().split())

print(reduce(gcd, a))

ARC105C - Camels and Bridge

敗退. 終了10分前くらいに入出力例が通って「やった!」と思ったけど、半分くらいWA、TLE 2つという感じで…….

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?