08 2021 档案
摘要:int read() { int res = 0; char c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)) res = (res << 1) + (res << 3) + c - 48, c = getchar(
阅读全文
摘要:int main() { ll l,r; ll n,sum=0; scanf("%lld",&n); //左端点l,右端点r; for(l=1,r=0;l<n;l=r+1) { r=n/(n/l); sum+=(r-l+1)*(n/l); } printf("%lld\n",sum); }
阅读全文
摘要:#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <string> #include <stack> #include <queue> #in
阅读全文
摘要:题目:https://acm.hdu.edu.cn/showproblem.php?pid=6438 假如ai<a(i+1),而且a(i+1)<a(i+2) 如果我们在i买入,在i+1卖出,在i+1买入,在i+2卖出,得到的收益是-pi+p(i+1)-p(i+1)+p(i+1) 如果我们在i买入,在
阅读全文
摘要:#include<stdio.h> const int maxn=1e3+100; int a[maxn][maxn]; void dfs(int x) { if(x==1024) return; for(int i=1;i<=x;i++) { for(int j=x+1;j<=x*2;j++) a
阅读全文
摘要:离线思想(把指令存起来后从后往前遍历) #include<stdio.h> const int maxn=1e5+7; int a[maxn]; int p[maxn]; int v[maxn]; int main() { int n,m; scanf("%d%d",&n,&m); for(int
阅读全文
摘要:要用long long 输入 题目中这个If the value of the expression is 0 when C=0, please print 1.的意思是如果a&b==0了的时候输出1 其他的都是输出(a&b) 0 1 0 1 0 1 1 0 只用管两者都是1的时候让c的那一位为1
阅读全文
摘要:题目:https://acm.hdu.edu.cn/showproblem.php?pid=6892根据sg定理,只需要求出每个数的sg[x];对于一个数x,如果是1是必败,sg[1]=0;如果是质数,那么必胜,sg[质数]=1;其他的则将x分解成若干对非1因数(p1,q1,p2,q2,p3,q3.
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/problem/21467 题目描述 在网友的国度中共有n种不同面额的货币,第i种货币的面额为a[i],你可以假设每一种货币都有无穷多张。为了方便,我们把货币种数为n、面额数组为a[1..n]的货币系统记作(n,a)。 在一个完善的货币系
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/problem/19990 里面写着在每首歌开始之前他想要改变的音量是多少。每一次改变音量,他可以选择调高也可以调低。 音量用一个整数描述。输入文件中给定整数beginLevel,代表吉他刚开始的音量,以及整数maxLevel,代表吉他的
阅读全文
摘要:有n种物品和容量为v的背包,每种物品可无限次使用,放入的费用是ci,价值是wi,求价值最大 #include<stdio.h> #include<algorithm> using namespace std; const int maxn=1e3+6; int n; int c[maxn],w[ma
阅读全文
摘要:01背包变形(背包容量大) 转化成能够达到的最大价值 https://vjudge.net/problem/FZU-2214/origin #include<stdio.h> #include<algorithm> using namespace std; const int maxn=1e3+6;
阅读全文
摘要:f[i]表示一定选a[i]的字串的最大值 #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1005; const int inf=1e9; int n
阅读全文
摘要:#include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 1005; int n, k; int a[maxn],f[maxn]; //最长不下降子序列 int
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/19506/F 没注意到输入里有个k,循环里也用了个k; dp[i][j]表示i个盒子放j本书的最小面积 #include <cstdio> #include <algorithm> using namespace std; t
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/19506/D 用总数减去不相交的区间个数和的最大值(区间是一个数出现 的left和right) 再对right从小到大排序 对a[i]离散化 #include<stdio.h> #include<bits/stdc++.h>
阅读全文
摘要:如果后来的和以前的发生矛盾,则以前的优先退让。 如果以前的退让之后没有cp可处,则以前的拒绝退让,新来的去寻找下一个匹配。 如果新来的谁也匹配不上了,那就这么单着吧 #include<stdio.h> #include<string.h> #include<algorithm> #include<b
阅读全文
摘要:题目: https://www.luogu.com.cn/problem/P4084 如果被染色了,只有一种染色方式,其他的为0 没被染色的,三种都可以 链式前向星存图 #include<stdio.h> typedef long long ll; const int maxn=1e5+7; con
阅读全文
摘要:题目: https://www.luogu.com.cn/problem/P4462 利用的异或的前缀和性质, 有多少个区间[l,r]满足异或起来为k异或满足前缀和 有多少个sumr^sum(l-1) =k sum(l-1) =k^sumr 要将l换成l-1 #include<bits/stdc++
阅读全文
摘要:题目: https://www.luogu.com.cn/problem/P3901 #include<bits/stdc++.h> #include<stdio.h> using namespace std; const int maxn=1e5+7; int n,m,block,belong[m
阅读全文
摘要:题目: https://www.luogu.com.cn/problem/P1494 维护总方案数,和每多一双袜子和没少一双袜子带来的贡献 #include<bits/stdc++.h> #include<stdio.h> using namespace std; const int maxn=5e
阅读全文
摘要:题目: https://www.luogu.com.cn/problem/P2709 大意:求出从[1,k]再给出的区间[l,r]中出现的次数的平方和 因为数列是计数是从1开始的,所以要把L置为1,不然会把a[0]自动算上 #include<bits/stdc++.h> #include<stdio
阅读全文
摘要:https://acm.hdu.edu.cn/showproblem.php?pid=6944 题意: 给出一些数字,每次选一个数字减去9,99,999,要求结果大于0,且要求最终每个数字只能出现一次,不能操作的人就输了 考虑每次减去的9,99,999可以转化成9*1,9*11,9*111,一次操作
阅读全文
摘要:codeforces737题目是k是否大于等于将数列排序需要的最少的分块 按照题目的意思的话就是当成pair或者结构体排序,只要排序后的个体的原来的位置是连续的就可以划分为一个分块 #include<stdio.h>#include<algorithm> #include<vector>//#inc
阅读全文
摘要:字典树首先把n个名字都insert进去,用f来标记,此时统一标记为1 再检测化学老师报的m个名字 如果当前节点没有建造,说明是错误的名字,输出wrong 如果f是-1就是repeat 如果正常输出一次后就把标记f改成-1 #include<stdio.h> #include<string.h> #i
阅读全文
浙公网安备 33010602011771号