ABC93 C - Same Integers から学んだ
5145 ワード
うーん。さっぱりや。
たまらず、解説ページを開く
説明を聞いて分かったつもりに
なっている気がした。
ちょっとボーっとしてから
思い出しつつ書いてみた。
SameIntegers.py
a,b,c = map(int,input().split())
m = max(a,b,c)
for i in range(100):
x = m + i
if (3*x-(a+b+c))%2 == 0:
ans = (3*x-(a+b+c))//2
break
print(ans)
あれから、真っ新な状態で再チャレンジ。
一応通った。
abc93c.py
A,B,C = map(int,input().split())
X = [A,B,C]
#方針#
#いずれのアクションも 2 ずつ増えている。
#ってことは、3で割り切れるまで 2 を足した回数が答えでは???
for i in range(10**5):
if (sum(X) + 2*i)%3 == 0:
if (sum(X) + 2*i)//3 >= max(X):#但し、3で割った時の値が A,B,C 最大値より小さいとダメ
print(i) #同じ、もしくは max(A,B,C) より大きい必要がある
exit()
Author And Source
この問題について(ABC93 C - Same Integers から学んだ), 我々は、より多くの情報をここで見つけました https://qiita.com/AKpirion/items/4345b9f938056d4ef561著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .