ctrl + ,
输入format, 点开C++风格设置
在这块内容输入{ BasedOnStyle: Chromium, IndentWidth: 4, ColumnLimit: 200, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true}
C_Cpp: Clang_format_fallback Style
用作回退的预定义样式的名称,以防使用样式 file 调用 clang-format 但找不到 .clang-format 文件。可能的值为 Visual Studio、LLVM、 Google、Chromium、Mozilla、WebKit、 Microsoft、GNU、none,或使用 {键: 值, ...} 以设置特定参数。例如,Visual Studio 样式类似于: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All, FixNamespaceComments: false }。
这样可以获得比较舒服的代码格式
代码风格展示
#include <bits/stdc++.h>
#define all(c) c.begin(), c.end()
#define int long long
using namespace std;
using LL = long long;
const double PI = acos(-1);
static constexpr long long mod = 998244353;
int calc(string s) {int m = s.size();int memo[m + 1][2010][10];memset(memo, -1, sizeof(memo));function<int(bool, bool, int, int, int)> f = [&](bool is_limit, bool is_num, int pos, int sum, int last) -> int {if (pos == m) {if (!is_num) return 0;if (last <= 0) return 0;return (sum - last) % last == 0;}if (!is_limit && is_num && memo[pos][sum][last] != -1) {return memo[pos][sum][last];}int res = 0;if (!is_num) {res += f(false, false, pos + 1, sum, -1);res %= mod;}int up = is_limit ? s[pos] - '0' : 9;int low = is_num ? 0 : 1;for (int d = low; d <= up; ++d) {res += f(is_limit && up == d, is_num || d != 0, pos + 1, sum + d, d);res %= mod;}if (!is_limit && is_num) {memo[pos][sum][last] = res;}return res;};return f(true, false, 0, 0, -1);
}
bool check(string L) {if (L.size() < 2) return false;int sum = 0;for (int i = 0; i < L.size() - 1; ++i) {sum += L[i] - '0';}if (L.back() == '0') return false;return sum % (L.back() - '0') == 0;
}
void solve() {string l, r;cin >> l >> r;int ans = calc(r) - calc(l) + check(l);ans = (ans + mod) % mod;cout << ans << endl;
}
signed main() {std::ios::sync_with_stdio(false);std::cout.tie(nullptr);std::cin.tie(nullptr);int T = 1;while (T--) {solve();}return 0;
}