1 条题解
-
0
【深基1.习7】定期存款
解题思路
小 A 每年本息一起再存,五年后为 10000×1.035^5;UIM 五年定存按本金计息,为 10000×(1+0.04×5)。
正确性说明
前者每年本金乘 1.035,连续五次;后者一个五年周期结束,利息等于本金乘年利率乘 5。
易错点
五年定存不是每年复利;按题意直接用 cout 默认格式。
复杂度
时间 O(1),空间 O(1)。
参考代码(C++11)
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << 10000 * pow(1.035, 5) << " " << 10000 * (1 + 0.04 * 5) << "\n"; return 0; }
- 1