摘要:
#include<bits/stdc++.h> using namespace std; #define int long long #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #define endl '\n' #defi 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; #define int long long #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #define endl '\n' #defi 阅读全文
摘要:
#include <iostream> #include <vector> using namespace std; // 预处理组合数(适用于较小的数) const int mx = 5; int c[mx][mx]; auto init = []() { for (int i = 0; i < 阅读全文
摘要:
#include <iostream> using namespace std; const int MOD = 1000000007; // 模数,通常是大素数 const int MAXN = 100000; // 设定最大值 long long fact[MAXN + 1]; // 阶乘数组 阅读全文
摘要:
const int MOD = 1000000007; // 模数,通常是大素数 const int MAXN = 100000; // 设定最大值 long long fact[MAXN + 1]; // 阶乘数组 long long inv_fact[MAXN + 1]; // 逆阶乘数组 // 阅读全文
摘要:
class bint { vector<int> arr; // 存储数字,低位在前 int sign; // 符号位:1 表示正数,-1 表示负数 // 大整数加法 vector<int> add(const vector<int>& a, const vector<int>& b) const 阅读全文
摘要:
格式说明符 在 std::format 中,你可以使用不同的格式说明符来控制如何格式化数据。常见的格式说明符包括: 整数格式: {:d}:以十进制格式输出整数。 {:x}:以十六进制格式输出整数(小写字母)。 {:X}:以十六进制格式输出整数(大写字母)。 {:b}:以二进制格式输出整数。 浮点数格 阅读全文
摘要:
// 将整数转换为二进制字符串 string intToBinary(int num) { if (num == 0) { return "0"; } string binary; while (num > 0) { binary = to_string(num & 1) + binary; // 阅读全文
摘要:
class Solution { public: vector<int> inorderTraversal(TreeNode* root) { vector<int> result; stack<TreeNode*> st; if (root != NULL) st.push(root); whil 阅读全文
摘要:
//颜色染色法 class Solution { public: bool canFinish(int numCourses, vector<vector<int>>& prerequisites) { vector<vector<int>>g(numCourses); for(auto&q:pre 阅读全文