15:银行利息
【题目名称】银行利息 【题目来源】http://noi.openjudge.cn/ch0105/15/ Author: 潘磊 just_panleijust.edu.cn Version: 1.0 # 自定义函数defmoney(rate:int,base:int,year:int)-int: 返回指定复合年利率、投资钱的基数、投资的年数条件下最终的钱的总数。 Args: rate (int): 指定复合年利率 base (int): 指定投资钱的基数 year (int): 指定投资的年数 Returns: int: 最终的钱的总数结果取整 ansbase# 最终的钱的总数初始为basefor_inrange(year):# 循环year次ansans*rate/100# 当年钱的总值上年钱的总值上年钱的总值×复合年利率returnint(ans)defmain():R,M,Ymap(int,input().split())ansmoney(R,M,Y)print(ans,end)if__name____main__:main() 【题目名称】银行利息 【题目来源】http://noi.openjudge.cn/ch0105/15/ Author: 潘磊 just_panleijust.edu.cn Version: 1.1 # 自定义函数defmoney(rate:int,base:int,year:int)-int: 返回指定复合年利率、投资钱的基数、投资的年数条件下最终的钱的总数。 Args: rate (int): 指定复合年利率 base (int): 指定投资钱的基数 year (int): 指定投资的年数 Returns: int: 最终的钱的总数结果取整 returnint(base*(1rate/100)**year)# 利用公式计算最终的钱的总数defmain():R,M,Ymap(int,input().split())ansmoney(R,M,Y)print(ans,end)if__name____main__:main()