1
0

Q2240.h 452 B

123456789101112131415161718192021
  1. //
  2. // Created by 李洋 on 2023/9/1.
  3. //
  4. #ifndef LEECODE_C_2240_H
  5. #define LEECODE_C_2240_H
  6. class Q2240 {
  7. public:
  8. long long waysToBuyPensPencils(int total, int cost1, int cost2) {
  9. long long count = total / cost2 + 1;
  10. int tos = total / cost1;
  11. for (int i = 1; i <= tos; ++i) {
  12. int temp = total - i * cost1;
  13. count += temp / cost2 + 1;
  14. }
  15. return count;
  16. }
  17. };
  18. #endif //LEECODE_C_2240_H
备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。