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 5 years have passed since last update.

三井住友信託銀行プログラミングコンテスト2019 バーチャル参加を記録

0
Posted at

PythonだけできるからC++より実行時間が長いことがわかる。
https://atcoder.jp/contests/sumitrust2019

A - November 30


M1, D1 = [int(i) for i in input().split()]
M2, D2 = [int(i) for i in input().split()]

if D1 > D2 and M2 > M1:
    print(1)
else:
    print(0)

B - Tax Rate

整数×1.08と小数部の桁数が2に超えられないから勝手に0.99を足した。


N = int(input())
if int(int((N + 0.99) / 1.08) * 1.08) != N:
    print(':(')
else:
    print(int((N + 0.99) / 1.08))

C - 100 to 105

Xが2000超えると下二桁を何とか満たせる。
100以下, 106~199, 211~299, …, 1996~1999の買い方が存在しない。


X =int(input())
if X >= 2000:
    print(1)
    quit()
lst = []
for i in range(20):
    lst.append([i * 105 + 1, i * 100 + 99])
for item in lst:
    if X >= item[0] and X <= item[1]:
        print(0)
        quit()
print(1)

D - Lucky PIN

最初は野蛮にnC3(4C3=4, 5C3=10のことです)回検索し可能なpinを全部lstに入れて、最後にlen(set(lst))で計算したがやはりTLEになったが、
よく考えると可能なpinが1000つしかない。


N = int(input())
S = input()
lst = []
count = 0
for i in range(1000):
    num = str(i).zfill(3)
    if num[0] in S:
        a1 = S.index(num[0])
        if num[1] in S[a1 + 1:]:
            a2 = S[a1 + 1:].index(num[1]) + a1 + 1
            if num[2] in S[a2 + 1:]:
                count += 1
print(count)

E - Colorful Hats 2

kmjp's blog を参考にした。ありがとうございます。

F - Interval Running

FがEより簡単である場合は自分にとっては二回目だった。
紙面で簡単な例を挙げたら規則性をすぐ分かった。


T1, T2 = [int(i) for i in input().split()]
A1, A2 = [int(i) for i in input().split()]
B1, B2 = [int(i) for i in input().split()]

d1 = T1 * (A1-B1)
d2 = T2 * (B2-A2)

if d1 == d2:
    print('infinity')

if d1 * (d2 - d1) < 0:
    print(0)

if d1 * (d2 - d1) > 0:
    if d1 % (d2 - d1) != 0:
        print(d1 // (d2 - d1) * 2 + 1)
    else:
        print(d1 // (d2 - d1) * 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?