当前位置: 首页 > news >正文

vscode格式化代码, 谷歌风格, 允许短if同行短块同行, tab = 4舒适风格

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;// cin >> T;while (T--) {solve();}return 0;
}
http://www.lryc.cn/news/212426.html

相关文章:

  • 百度富文本上传图片后样式崩塌
  • autoware.ai中检测模块lidar_detector caffe
  • CentOS安装Ruby环境
  • 力扣第509题 斐波那契数 新手动态规划(推荐参考) c++
  • canvas绘制签名并保存
  • Android渲染流程
  • 牛客-【237题】算法基础精选题单-第二章 递归、分治
  • leetcode-字符串
  • 多线程---synchronized特性+原理
  • Qt实现卡牌对对碰游戏
  • 【3D 图像分割】基于 Pytorch 的 VNet 3D 图像分割7(数据预处理)
  • 极米科技H6 Pro 4K、H6 4K高亮定焦版——开启家用投影4K普及时代
  • 软考系统架构师知识点集锦九:数据库系统
  • IOC课程整理-6 Spring IoC 依赖注入
  • FANUC机器人PRIO-621和PRIO-622设备和控制器没有运行故障处理
  • 《动手深度学习》线性回归简洁实现实例
  • 国家数据局正式揭牌,数据专业融合型人才迎来发展良机
  • 基于springboot实现休闲娱乐代理售票平台系统项目【项目源码+论文说明】
  • 3.AUTOSAR OS分析(一)
  • AB试验(七)利用Python模拟A/B试验
  • Go语言入门-流程控制语句
  • 深入探究ASEMI肖特基二极管MBR60100PT的材质
  • python类模拟“对战游戏”
  • Maven第二章:Maven基本概念与生命周期
  • <蓝桥杯软件赛>零基础备赛20周--第3周--填空题
  • 【Linux】VM及WindowsServer安装
  • 【实用教程】MySQL内置函数
  • 第十二节——ref
  • 少儿编程 2023年9月中国电子学会图形化编程等级考试Scratch编程四级真题解析(判断题)
  • 【设计模式三原则】