A・B判サイズ計算

Run Settings
LanguagePython
Language Version
Run Command
import sys A0=[841,1189] B0=[1030,1456] inp=input() ab=inp[0] inp=inp[1:] inp=int(inp) if(inp<0): print("0以上にしてください") sys.exit() if(inp>0 and ab=="A"): for i in range(0,inp): if(A0[0]>A0[1]): A0[0]=int(A0[0]/2) sw=A0[0] A0[0]=A0[1] A0[1]=sw else: A0[1]=int(A0[1]/2) sw=A0[0] A0[0]=A0[1] A0[1]=sw if(inp>0 and ab=="B"): for i in range(0,inp): if(B0[0]>B0[1]): B0[0]=int(B0[0]/2) sw=B0[0] B0[0]=B0[1] B0[1]=sw else: B0[1]=int(B0[1]/2) sw=B0[0] B0[0]=B0[1] B0[1]=sw if(ab=="A"):print(f"A{inp}={A0[0]}mm*{A0[1]}mm") if(ab=="B"):print(f"B{inp}={B0[0]}mm*{B0[1]}mm")
Editor Settings
Theme
Key bindings
Full width
Lines