- 博客(140)
- 资源 (3)
- 收藏
- 关注
原创 处女座的比赛
https://ac.nowcoder.com/acm/contest/329/J题解:std#include <bits/stdc++.h>using namespace std; int p,q,r,t;const int mod=9983;int mul[3];int in_dex[26];int get_hash(char* s)//�±��1�...
2019-01-31 10:41:39 779
原创 处女座的约会
https://ac.nowcoder.com/acm/contest/329/IPython版本一题解:显然处女座十分牛逼,因此输出“cnznb”即可咳咳……至于正确的做法。首先因为每次在右边砍掉一个头就相当于在左边会多出来一个头,所以可以把每
2019-01-31 10:40:00 222
原创 处女座的百日理财计划
https://ac.nowcoder.com/acm/contest/329/HJAVA版本一题解:stdimport java.io.*;import java.math.BigInteger;import java.util.*; public class Main { public static void main(String[] args) thr...
2019-01-31 10:37:40 227
原创 处女座和小姐姐(三)
https://ac.nowcoder.com/acm/contest/329/G题解:std#include <stdio.h>#include <string.h>#include <stdlib.h>#define SET0(x) memset(x,0,sizeof(x));#define MAXN 10010#define D...
2019-01-31 10:35:08 350
原创 处女座和小姐姐(二)
https://ac.nowcoder.com/acm/contest/329/F题解:std本题分为两个子问题。1. 求一个数组连续p个数mod P的乘积把序列按照长度m分成若干段,计算每段内的前缀和后缀乘积。这样任意划窗位置的答案可以看成前一段的后缀和后一段的乘积拼出。时间复杂度
2019-01-31 10:32:22 382
原创 处女座和小姐姐
https://ac.nowcoder.com/acm/contest/329/E题解:std本题相当于只要求按照开火车的顺序,从(1,1)到(
2019-01-31 10:30:19 282
原创 处女座的训练
https://ac.nowcoder.com/acm/contest/329/D题解:std贪心思想。按照ai/bi 作为关键字进行排序,按顺序完成作业即可。时间复杂度:
2019-01-31 10:28:42 317
原创 处女座点名
https://ac.nowcoder.com/acm/contest/329/C题解:std题目已经保证了输入顺序,只需要判断读入的数是否比上一个数大1即可。如果都满足,就是最后一个数没有出现。BONUS:这题如果不给学生人数,不顺序读入怎么做呢?时间复杂度:
2019-01-31 10:27:18 182
原创 处女座的比赛资格
https://ac.nowcoder.com/acm/contest/329/B题解:std作者:儒生雄才1链接:https://ac.nowcoder.com/discuss/152781来源:牛客网 有向无环图(DAG)上的最短路。注意:负权值边的存在使得 Dijkstra 算法不适用,特殊 DAG 的性质使得 SPFA 算法无法在规定的时间限内求解出答案。 考虑到 ...
2019-01-31 10:25:22 284
原创 处女座与线性代数
https://ac.nowcoder.com/acm/contest/329/A题解:std作者:儒生雄才1链接:https://ac.nowcoder.com/discuss/152781来源:牛客网 我们将列举出本题所使用到的结论:1.处女座点的数量最多为 1证明:2. 若K维空间一个点集{P1,P2,⋯,PnP1,P2,⋯,Pn}存在处女座点,则
2019-01-31 10:23:56 302
原创 区间DP
一、定义在一段区间内的动态规划。二、思路把一个大区间拆分成几个小区间,先求小区间的最优值,然后合并起来求大区间的最优值。三、例题 四、参考文章http://www.cnblogs.com/xFANx/p/7193067.htmlhttps://www.cnblogs.com/rmy020718/p/9515963.htmlhttps://www.cnblogs....
2019-01-30 15:53:06 234
原创 欧拉降幂(Euler_Power_Formula)
一、欧拉降幂公式 二、证明欧拉降幂公式与证明 三、例题https://ac.nowcoder.com/acm/contest/330/E四、参考文章https://blog.csdn.net/weixin_38686780/article/details/81272848https://blog.csdn.net/weixin_43272781/articl...
2019-01-30 10:53:28 372
原创 Thief in a Shop
https://codeforces.com/problemset/problem/632/E题解:将所有元素减去最小元素再进行完全背包如果体积超过k则不可以。/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algo...
2019-01-28 22:45:42 421
原创 Seven Segment Display
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962题解:数位DP/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#i...
2019-01-28 20:59:00 591
原创 count 数字计数
https://www.lydsy.com/JudgeOnline/problem.php?id=1833题解:数位DP/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cs...
2019-01-28 18:51:08 360
原创 数位DP
一、定义给定的范围[l,r]中,满足(不满足)某个条件的数字,有多少个。二、思路从高位开始想低位,按位遍历,递归向下,求第i位的时候,需要第i-1位的所有可能性的和。三、例题http://acm.hdu.edu.cn/showproblem.php?pid=3555http://acm.hdu.edu.cn/showproblem.php?pid=2089(题解:https...
2019-01-28 17:23:52 221
原创 windy数
https://www.lydsy.com/JudgeOnline/problem.php?id=1026C++版本一题解:假设我们需要求0至x(用数组表示)的区间的windy数的个数,x有t位,我们先求出t-1位的windy数的个数,因为这些windy数绝对比x小,不会超过这个区间,然后求出长度为t,最高位小于x[0]的windy数的个数,同样不会超过这个区间.最后统计长度为t,最高...
2019-01-28 16:22:17 335
原创 FatMouse and Cheese
http://acm.hdu.edu.cn/showproblem.php?pid=1078题解:记忆化搜索这个题可以用深搜去做,从(0,0)点出发,两层for循环记录位置,外层代表四个方向,内层是走了多少步,走到一个位置如果数值比前一步大的话,加上数值继续dfs,每次返回时更新一下最大值。在两层for循环结束后,得到的maxx的值就是该点能得到的最多奶酪数,然后将maxx赋给book[x...
2019-01-28 13:40:44 278
原创 最大连续子序列
http://acm.hdu.edu.cn/showproblem.php?pid=1231题解:首先我们先要确定一下状态方程, 我们必须先要找到哪个子序列的和最大,所以dp[i]里面保存的是前i-1个中子序列中和最大的。 所以状态方程就能写出:dp[i] = max(a[i],dp[i-1]+a[i])其中a[i]表示的是输入的第i个数,如果a[i]<0的话,肯定是dp[i] ...
2019-01-28 11:35:45 139
原创 悼念512汶川大地震遇难同胞——老人是真饿了
http://acm.hdu.edu.cn/showproblem.php?pid=2187C++版本一#include <iostream>#include <stdio.h>#include <cstring>#include <algorithm>#include <queue>using namespace s...
2019-01-28 10:25:29 679
原创 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
http://acm.hdu.edu.cn/showproblem.php?pid=2191题解:多重背包参考文章:https://blog.csdn.net/weixin_43272781/article/details/83214622/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#in...
2019-01-28 10:22:00 357
原创 不要62
http://acm.hdu.edu.cn/showproblem.php?pid=2089C++版本一暴力打表#include<iostream>#include<stdio.h>#include<string.h>using namespace std;int a[1000001];//一定要放在外面声明,否则就无法输入int mai...
2019-01-28 10:19:58 954 3
原创 处女座的期末复习
https://ac.nowcoder.com/acm/contest/327/JC++版本一std题解:贪心 ,每次复习还没有但是最先考试的科目即可 。#include <bits/stdc++.h>using namespace std;#define ll long longstruct st{ int a,b;}a[100005];i...
2019-01-27 17:21:02 203
原创 处女座的测验(二)
https://ac.nowcoder.com/acm/contest/327/IC++版本一std题解:数论参考文章:https://blog.csdn.net/weixin_43272781/article/details/85558253 #include <bits/stdc++.h>using namespace std; int n;int...
2019-01-27 17:19:15 266
原创 处女座的测验(一)
https://ac.nowcoder.com/acm/contest/327/HC++版本一std题解:素数 构造 欧拉函数参考文章:https://blog.csdn.net/weixin_43272781/article/details/85558253 #include <bits/stdc++.h>using namespace std;#d...
2019-01-27 17:17:05 226
原创 处女座与复读机
https://ac.nowcoder.com/acm/contest/327/GC++版本一std题解:DP 暴力枚举#include <bits/stdc++.h>using namespace std;string a,b; int main(){ cin>>a>>b; if (fabs((int)a.len...
2019-01-27 17:14:03 241
原创 处女座与宝藏
https://ac.nowcoder.com/acm/contest/327/FC++版本一std题解: 2-sat 图论#include <bits/stdc++.h>using namespace std;#define ll long long const int MAXN = 400010;const int MAXM = 800010;st...
2019-01-27 17:11:47 283
原创 处女座与汉明距离
https://ac.nowcoder.com/acm/contest/327/EC++版本一std题解:#include <bits/stdc++.h>using namespace std;int n,m;int a[2000000];int b[2000000]; int ones(int x){ int ans=0; while ...
2019-01-27 17:09:38 161
原创 处女座与重修费
https://ac.nowcoder.com/acm/contest/327/DC++版本一 题解:找出数组中小于 60 的元素个数, 乘以 400 即为最终的 答案/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<al...
2019-01-27 17:03:57 181
原创 处女座的砝码
https://ac.nowcoder.com/acm/contest/327/CC++版本一#include<bits/stdc++.h>using namespace std;int main(){ long double n; cin>>n; long double a=1,b=1; int ans=1; whil...
2019-01-27 17:03:50 219
原创 处女座与cf
https://ac.nowcoder.com/acm/contest/327/BC++版本一题解:模拟#include <bits/stdc++.h>using namespace std;map<string,int> mp;int vis[505];int a[505][10];int b[505][10];int r[10]={500,10...
2019-01-27 17:03:42 246
原创 处女座的签到题
https://ac.nowcoder.com/acm/contest/327/AC++版本一std题解:简单数学,排序由于题目条件,x,y坐标的绝对值均在1e9以下,面积可能会到达1e18,所以无法用double储存。三角形的面积等于相邻两边叉积的一半,所以三角形面积的两倍一定是整数,我们可以用long long来储存,最后特判输出”.00”或”.50”。对于找第k大,时间复杂读...
2019-01-27 17:03:36 206
原创 小a的集合
https://ac.nowcoder.com/acm/contest/317/JC++版本一std题解:线段树 set #include<bits/stdc++.h>#define Pair pair<int, int>#define MP make_pair#define fi first#define se second using...
2019-01-24 18:47:40 214
原创 小a与军团模拟器
https://ac.nowcoder.com/acm/contest/317/IC++版本一std题解:启发式合并#include<cstdio>#include<algorithm>#include<cstring>#include<queue>#include<iostream>#include<...
2019-01-24 18:45:03 454
原创 小a的学期
https://ac.nowcoder.com/acm/contest/317/HC++版本一std题解: #include<cstdio>#include<cstring>#define int long long #define LL intconst int MAXN = 2e6 + 10;inline int read() { ...
2019-01-24 18:43:23 414 1
原创 小a的排列
https://ac.nowcoder.com/acm/contest/317/GC++版本一std题解:模拟,思维#include<bits/stdc++.h>using namespace std;const int MAXN = 1e5 + 10, INF = 1e9 + 10;inline int read() { char c = getc...
2019-01-24 18:40:50 207
原创 小a的子序列
https://ac.nowcoder.com/acm/contest/317/FC++版本一std题解:DP#include<bits/stdc++.h>using namespace std;const int MAXN = 5001, mod = 1e9 + 7;int N, V, a[MAXN], f[MAXN][MAXN], Lim, x[MAX...
2019-01-24 18:38:11 520
原创 小a的轰炸游戏
https://ac.nowcoder.com/acm/contest/317/EC++版本一std 题解:差分由于n, m只有1000,且没有修改操作。那么考虑二维差分。直接上可以不太好实现,我们菱形分为上下两部分对于上半部分来说:把标记分为两种(向左下放/向右下放),首先在最顶端打上+1的标记,再分别在最下端的两边打上-1的标记每次分别下放即可注意不要越界,一个不错的...
2019-01-24 18:36:18 389
原创 Diverse Garland
https://codeforces.com/contest/1108/problem/D/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#includ...
2019-01-24 00:45:40 323
原创 Nice Garland
https://codeforces.com/contest/1108/problem/C/**@Author: STZG*@Language: C++*/#include <bits/stdc++.h>#include<iostream>#include<algorithm>#include<cstdlib>#includ...
2019-01-24 00:44:49 303
C++课程设计-便利店管理系统.rar
2019-05-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人