1
0

Q2698.h 588 B

1234567891011121314151617181920212223242526
  1. //
  2. // Created by 李洋 on 2023/10/25.
  3. //
  4. #ifndef LEECODE_C_Q2698_H
  5. #define LEECODE_C_Q2698_H
  6. #include <vector>
  7. using namespace std;
  8. class Q2698 {
  9. public:
  10. int punishmentNumber(int n) {
  11. auto all = vector<int>(
  12. {1, 9, 10, 36, 45, 55, 82, 91, 99, 100, 235, 297, 369, 370, 379, 414, 657, 675, 703, 756, 792, 909, 918,
  13. 945, 964, 990, 991, 999, 1000});
  14. int count = 0;
  15. for (int i = 0; i < all.size() && all[i] <= n; ++i) {
  16. count += all[i] * all[i];
  17. }
  18. return count;
  19. }
  20. };
  21. #endif //LEECODE_C_Q2698_H
备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。