ICode9

精准搜索请尝试: 精确搜索
  • AcWing 6. 多重背包问题 III2022-06-27 17:05:26

    二进制优化转化成01背包的复杂度为 O(n logm * m) (m为背包容量),大概是2 * 1e8的数量级,一般会超时 发现如果以j(0 <= j <= m)模上v的余数分类,相当于求固定区间的最大值(滑动窗口),可以用单调队列优化,复杂度为 O(n * m) #include<bits/stdc++.h> using namespace std; #define fr f

  • CF Global Round 21 题解(CDEG)2022-06-26 12:01:24

    C 把 \(a,b\) 全拆开然后比较即可(因为分裂和合并是互逆的) 注意开 long long . using namespace std; typedef long long ll; typedef pair<ll, ll> pii; int n, m, k; vector<pii> a, b, c, d; inline void solve() { a.clear(); b.clear(); c.clear(); d.clear(); scanf("%d%d

  • VK Cup 2017 Round 3 - D. Perishable Roads(最短路:将问题性质挖掘到极致)2022-06-25 22:32:21

    VK Cup 2017 - Round 3 - D. Perishable Roads 题目链接: 传送门: https://codeforces.com/contest/773/problem/D 题目大意: 对于每一个点\(i\in[1,n]\),求解以点\(i\)为根的生成树使得\(ans_i=\sum_{j=1}^nd(j)\)最小,其中\(d(j)\)为结点\(j\)到根\(i\)路径上的最小边权。输出\(ans_

  • stm32 GPIO的使用2022-06-25 19:31:46

      STM32F4 的 IO 可以由软件配置成如下 8 种模式中的任何一种:         1、输入浮空         2、输入上拉         3、输入下拉         4、模拟输入         5、开漏输出         6、推挽输出         7、推挽式复用功

  • Atcoder-ABC158-EF 题解2022-06-25 02:31:16

    Atcoder题解汇总 ABC 158 E. Divisible Substring (取模前缀和思维, 一点点基本数论) 题意 给了一个长度为 \(n\) 的数字串,和一个质数 \(p\) ,询问有多少子串对应的数字满足是 \(p\) 的倍数,输出答案, 若有前导零也算作合法数字。 数据范围 \(1\leq N \leq 2 * 10^5\) \(2\leq P \le

  • AtCoder 题解集合2022-06-24 02:31:21

    目录AGCARCABCABC 150D. Semi Common Multiple (LCM, 数学推导)E. Change a Little Bit (组合计数推导)F. Xor Shift (XOR差分性 + KMP)ABC 151E. Max-Min Sums (组合计数, 贡献, 排序)F. Enclose All (待补, 最小圆覆盖)ABC 152D. Handstand 2 (思维暴力模拟)E. Flatten (质因子

  • AcWing 1027. 方格取数2022-06-24 02:01:51

    明天补思路 #include<bits/stdc++.h> using namespace std; #define int long long #define fr first #define se second typedef pair<int, int> PII; typedef unsigned long long ULL; const int INF = 0X3f3f3f3f, N = 20, MOD = 1e9 + 10; int w[N][N]; int f

  • CF #800 div 22022-06-21 19:02:17

    别问我为什么写简体了,问的话就换成繁体 A. Creep 贪心,\(01\) 交替放。 点击查看代码 #include <cstdio> #include <cstring> #include <cctype> #include <iostream> #include <sstream> #include <stack> #include <cmath> #include <algorithm> #inc

  • typedef void(*Func)(void) 用法2022-06-20 14:05:47

    本文希望解决以下问题:   1、typedef 的基本概念   2、函数指针的基本概念   3、typedef void(*Func)(void)的由来   4、typedef void(*Func)(void)的用途   题外话:跟typedef有个很类似的关键字时#define,两者其实是有区别的,这里就不详细说,只做简单阐述   typedef语句是

  • 后缀数组SA2022-06-19 14:02:54

    $nlog^2n$ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; typedef unsigned long long ull; const int inf=0x3f3f3f; const int maxn=1000005; char s[maxn]; int n,w,sa[maxn],rk[maxn<<1|1

  • 第十三届蓝桥杯国赛C/C++ B组2022-06-18 14:04:32

    @目录A 2022B 钟表C 卡牌D 最大数字E 出差F费用报销G 故障H机房I齿轮J搬砖 不是正解!!!! 个人题解,可能会有错误 A 2022 算的答案是379187662194355221 #include <bits/stdc++.h> using namespace std; typedef pair<int,int> PII; #define int long long int f[2050][11]; signed mai

  • 线性表的一些基本操作2022-06-12 23:36:23

    线性表的基本操作 顺序表的实现 1.静态分配 #define Maxsize 10//最大容量 typedef struct{ ElemType data[Maxsize]; int length;//当前长度 }SeqList; 2.动态分配 #define InitSize 10//顺序表的初始长度 typedef struct{ ElemType *data;//定义一个指针指向顺序表的第一个元素

  • c++调用动态dll库2022-06-10 22:33:38

    首先把需要调用的动态库dll和它依赖的对象都要放入到运行目录,debug环境就是debug目录下了。 然后就写代码: #include <iostream> #include <windows.h> #include<string.h> //extern int OutPutQrCode(int version, int width, const char* outfile, unsigned char* data) type

  • C语言快速排序2022-06-09 23:33:34

    #include<stdio.h> #define MAXSIZE 100 typedef int KeyType; typedef struct { KeyType key; }RecordType; typedef struct { RecordType r[MAXSIZE+1]; int length; }RecordList; RecordList L; int QKpass(RecordList *L,int low,int high) { int p

  • 202206007 模拟赛 总结2022-06-09 21:03:20

    盖房子 \(n\times n\) 的矩形中选出一个边长为 \(k\times k\) 的子矩阵,使得中位数最小 中位数定义为子矩阵中第 \(\lfloor\dfrac{k^2}{2}\rfloor+1\) 大的数,\(n\le 800\) 比较显然的二分,二分答案 \(mid\) 。另 \(b_{i,j}=[a_{i,j}>mid]\) ,作二维前缀和 如果 \(b\) 存在子矩阵使得

  • 2022.6.92022-06-09 13:02:05

    Codeforces Round #797 (Div. 3) A - Print a Pedestal #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; const int N=1e5+10,INF=1e9; int main() { ios::sync_with_stdio(false); cin.tie(0); int

  • C语言-直接排序2022-06-08 19:03:05

    #include<stdio.h> #define MAXSIZE 100 typedef int KeyType; typedef struct { KeyType key; }RecordType; typedef struct { RecordType r[MAXSIZE+1]; int length; }RecordList; RecordList L; /* void InsertSort(RecordList L) { int j; for(

  • Codeforces Round #797 (Div. 3) D, E, F, G题题解2022-06-08 10:02:14

    Codeforces题解汇总 Round #797 div3 D. Black and White Stripe 固定长度最大子段和, 简单只贴代码了 Solution #include<bits/stdc++.h> typedef long long ll; typedef std::pair<int, int> PII; typedef std::pair<ll, ll> PLL; typedef unsigned long long ull; typedef

  • Codeforces Round #702 (Div. 3)2022-06-01 01:03:51

    比赛链接 Codeforces Round #702 (Div. 3) 给定序列 \(a\) ,把 \(a\) 反复制成一个无限序列,然后给 \(m\) 个询问,每次给定 \(x\) ,问 \(a\) 的第一个前缀和达到 \(x\) 的下标。 \( a_{i}, x \leq 10^{9} \\ n, m \leq 2 * 10^{5} \) 解题思路 二分 注意,本题要求的是达到而不是相等,

  • 数据结构实验题-小球下落-陈昊宇2022-05-31 09:32:46

    #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define mk make_pair #define sz(x) ((int) (x).size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef vector<int> vi;

  • 《C和指针》学习笔记[第三章 数据]2022-05-31 01:01:56

    1. int main(void) { printf("SCHAR_MIN %d\n", SCHAR_MIN); printf("SCHAR_MAX %d\n", SCHAR_MAX); printf("UCHAR_MAX %d\n\n", UCHAR_MAX); printf("SHRT_MIN %d\n", SHRT_MIN); printf("SHR

  • MINIEYE杯第十六届华中科技大学程序设计邀请赛2022-05-30 12:31:21

    MINIEYE杯第十六届华中科技大学程序设计邀请赛 B Contest Preparation(签到) // Author: yukito8069 #include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <vector> using namespace std; #define IOS ios::sync_with_stdio

  • “山大地纬杯”第十二届山东省ICPC大学生程序设计竞赛部分个人题解2022-05-25 19:34:46

    A - Seventeen 显然\(n=1,2,3\)时无解,先手算出\(n=4,5,6,7\)时的解,然后根据\(s[i]=s[i-4]+(i-3)+i-(i-2)-(i-1)\)递推即可 code #include<bits/stdc++.h> using namespace std; typedef double db; const int N=50+10; string s[N]; int n; string i2s(int x) { string s;

  • 动态规划笔记2022-05-25 09:04:16

    基础 换根DP 先考虑以 1 为根做一次 dfs,自底向下,儿子节点信息更新父亲 v -> u 再以 1 为根做一次dfs,在递归前通过父节点信息更新儿子节点信息 u -> v 考虑换根过程,根从 1 换到其他点特殊考虑,其他点互相换根时,设儿子为 x ,根为 y 当要换根到 x 时,先减去 x 在 y 中的贡献,然后重新计

  • 第5章 数组与结构体2022-05-24 20:34:37

    5.1 Arrays(数组) 数组的维数:数组中的元素个数 数组下标 (或索引) :元素在数组中的位置,数组下标从0开始 注意: 数组最后一个元素的下标=数组大小减一,因为数组下标是从0开始的,否则将输出地址 定义并初始化一个数组。 数组的初始化数值写在 { } 内并用 , 分隔开。 例如:int array[]={1

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有