1 条题解
-
0
C++ :
#include <iostream> using namespace std; int main() { int balance = 100; // 初始存款 int target=200; // 目标金额 int save_amount=50; // 每周存款金额 int withdraw_amount=20; // 每周取款金额 int weeks = 0; // 存钱的周数 while (balance < target) { balance += save_amount; // 每周存钱 weeks++; balance -= withdraw_amount; // 每周取钱 } cout << weeks; return 0; }
- 1
信息
- ID
- 1370
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者