LoginSignup
3
0

More than 3 years have passed since last update.

PythonでABC163のA~Cを解く

Last updated at Posted at 2020-04-19

はじめに

今回はunratedでした

A問題

問題

考えたこと
計算するだけ。円周率はmath.piで実装できます

import math
r = int(input())
print(2*r*math.pi)

B問題

問題

考えたこと
課題の量をtaskとして、nとtaskを比較するだけです

n, m = map(int,input().split())
a = list(map(int,input().split()))

task = sum(a)
if task <= n:
    print(n-task)
else:
    print(-1)

C問題

問題

考えたこと
全ての$i$に対しての部下の数を計算します。

n = int(input())
a = list(map(int,input().split()))

mem = [0] * (n)
for i in range(n-1):
    mem[a[i]-1] += 1

for i in mem:
    print(i)

まとめ

unratedになったのつらい。はやく茶色になりたい。ではまた、おやすみなさい。

3
0
2

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
3
0