LoginSignup
0
0

AtCoder初心者 DailyTrainingメモ 2023/11/23

Last updated at Posted at 2023-11-23

ABC239 A-問題

239A.png

ポイント
Pythonで平方根を取り扱うときは、math をインポートして math.sqrt() を使う

239A.py
import math,sys,datetime,random,glob,os,re,bisect,itertools
import numpy as np

# 入力
H = int(input()) 

ans = (12800000+H) * H

print(math.sqrt(ans))

ABC288 B-問題

288B.png

ポイント
・はじめからTOPのK番目だけをリストに格納してソートする
・改行しながら出力は、「 print("\n".join(S)) 」と書く(テンプレ)

288B.py
N,K = map(int,input().split())
S = [input() for _ in range(K)]

S.sort()

# リストを改行しながら出力する
print("\n".join(S))
# print(*S, sep="\n")

参考リンク

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