郑州轻工业大学OJ python1005

1005: 整数幂

题目描述

输入3个整数,输出它们的1次幂、2次幂和3次幂。

输入

输入3整数,用空格隔开。

输出

输出3行,每行3个整数,分别是它们的1次幂、2次幂和3次幂,每个整数占9列,不足9列左对齐。

样例输入

1 5 100

样例输出

1 1 1
5 25 125
100 10000 1000000

Python

a,b,c=map(int,input().split())
print("{:<9}".format(a),end='')
print("{:<9}".format(a**2),end='')
print("{:<9}".format(a**3))
print("{:<9}".format(b),end='')
print("{:<9}".format(b**2),end='')
print("{:<9}".format(b**3))
print("{:<9}".format(c),end='')
print("{:<9}".format(c**2),end='')
print("{:<9}".format(c**3))
发布了6 篇原创文章 · 获赞 0 · 访问量 68

猜你喜欢

转载自blog.csdn.net/weixin_42437183/article/details/104228523