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?

【出力形式を指定して出力】ペアの数値の入った表を罫線入りで出力 2 (paizaランク C 相当)

Last updated at Posted at 2023-11-19

今回はこれ
https://paiza.jp/works/mondai/stdout_primer/stdout_primer__specific_format_boss

ただし、AとBが9桁になるようにする

今までと同じように書いて
つぎに
(A, B) = 1+9+2+9+1=22文字(間は,と半スペで2文字)
|  =3文字
あわせて25文字
それをW-1分繰り返し、最後は(A, B)だけなので22文字だから
count = 25 * (W -1) + 22
これを=でかければOK

Arr = input().split()
H = int(Arr[0])
W = int(Arr[1])
A = int(Arr[2])
B = int(Arr[3]) 

for j in range(1,H+1):
    for i in range(1,W+1):
        if i != W:
            print(f"({A:>9}, {B:>9})",end=" | ")
        else:
            print(f"({A:>9}, {B:>9})")
    if j < H:
        count = 25 * (W -1) + 22
        print(f"{'='*count}")

これで合格しました。
途中、)の1文字分を計算に入れ忘れるなどあったけど
無事合格。

これにて最後の問題も突破!
さあ次の問題にいってみよう

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?