摘要: #include <bits/stdc++.h> using namespace std; /* 测试用例: 8 -7 10 9 2 3 8 8 1 */ const int N = 1e5 + 10; int n, a[N]; int f[N], idx; // dp数组,idx:下标指针,因为从 阅读全文
posted @ 2023-04-21 19:42 bothgone 阅读(42) 评论(0) 推荐(0)
摘要: 数字1的个数 如果计算区间[l,r]中出现次数,cnt(r) - cnt(l - 1)即可 class Solution { public: int res[10][1024]; int countDigitOne(int n) { return dp(0, 0, true, false, to_s 阅读全文
posted @ 2023-04-21 15:58 bothgone 阅读(25) 评论(0) 推荐(0)