
ACM
PinkAir
这个作者很懒,什么都没留下…
展开
-
how does tf.keras.layers.conv2d with padding=‘same‘ and strides=1 behave
import tensorflow as tfinputs = tf.random_normal([1, 64, 64, 3])print(inputs.shape)conv = tf.keras.layers.Conv2D(6, 4, strides=2, padding='same')outputs = conv(inputs)print(outputs.shape)produces(1, 64, 64, 3)(1, 32, 32, 6)Explanation:K..转载 2020-10-21 08:53:42 · 258 阅读 · 0 评论 -
C语言scanf()和gets()及printf()和puts()的区别
http://blog.youkuaiyun.com/xingjiarong/article/details/47282817 一、scanf()和gets() 1.scanf()所在头文件:stdio.h语法:scanf(“格式控制字符串”,变量地址列表);接受字符串时:scanf(“%s”,字符数组名或指针);2.gets()所在头文件:stdio.h语法:gets(字...转载 2018-08-14 09:32:39 · 297 阅读 · 0 评论 -
取整函数
1、round:在英文中是有大约,环绕,在某某四周,附近的意思,所以,可以取其大约的意思,在函数中是四舍五入。四舍五入的时候,正数,小数位大于5,则整数位加一,小数位小于5,则整数位不变,抹除小数位;负数,小数位小于5,则整数位不变,抹除小数位,小数位大于5,则整数位加一;整数,则不变。2、ceil:在英文中,是天花板的意思,有向上的意思,所以,此函数是向上取整,它返回的是大于或等于函数参数,并且...原创 2018-06-04 21:57:45 · 1006 阅读 · 0 评论 -
排序
1.比较器(最快) 在使用优先队列时可以使用,不过优先队列时的大小与平时使用的比较相反如小的优先的话,则返回 x>y,与平常用的x<y不同,这跟优先队列实现的时候用堆写有关struct cmp{bool operator()(node x,node y){return x.a==y.a?x.b<y.b:x.a<y.a;}}sort(v.begin(),v.end(),cm...原创 2018-06-03 19:11:33 · 128 阅读 · 0 评论 -
幷查集
1.找爸爸+路径压缩int find(int x){return p[x]==x?x:p[x]=find(p[x]);}void init(){ for(int i=0;i<n;i++) p[i]=i;}void join(int x,int y){ int a=find(x);//x的根节点为a int b=find(y);//y的根节点为b...原创 2018-04-01 09:04:13 · 270 阅读 · 0 评论 -
最小公倍数
#include<bits/stdc++.h> using namespace std;typedef long long ll;#define INF 0x3f3f3f3f#define Max (int)2e5+10int main(){ int a,b , num1,num2; while (~scanf("%d%d", &a,&b)) { num1=a,num...原创 2018-03-13 21:10:59 · 165 阅读 · 0 评论 -
Codeforces C. Elections 三分
C. Electionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, majority of students and teachers of Summer Informatics...原创 2018-08-12 13:45:52 · 327 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第六场)A Singsing Contest
#include<bits/stdc++.h>using namespace std;#define Max (int)(1e7+10)typedef long long ll;int t,n;int a[20000][20];bool vis[20000][20],key[20000];//入围则为 1int cnt;void bisai(int x,int y) ...原创 2018-08-04 21:20:36 · 438 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第五场) J Plane
以单个床位价值为分类依据#include<iostream>#include<algorithm>using namespace std;typedef long long ll;int main() { //特判1 2 3 ll n, p2, p3; double n2, n3; while (~scanf("%lld%lld...原创 2018-08-03 13:24:58 · 142 阅读 · 0 评论 -
洛谷 P1215 [USACO1.4]母亲的牛奶 Mother's Milk
暴力枚举#include<bits/stdc++.h>using namespace std;#define Max (int)(1e5+10)typedef long long ll;int p[100],a,b,c,num;bool vis[25],key[25][25][25];void bfs(int x,int y,int z,int step) { i...原创 2018-08-04 11:10:10 · 1137 阅读 · 0 评论 -
洛谷 P1203 [USACO1.1]坏掉的项链Broken Necklace
有环的题可以两边接起来,这样会省事很多#include<bits/stdc++.h>using namespace std;#define Max (int)(1e5+10)char c[1200];int main() { int n,num=0,t=0,tt; bool flag=0; scanf("%d",&n); for(int i=1; i<...原创 2018-08-03 15:09:28 · 453 阅读 · 0 评论 -
P3650 [USACO1.3]滑雪课程设计Ski Course Design
https://www.luogu.org/problemnew/show/P3650通过样例也会发现,最后最小高度、最大高度都是一个固定的数。意识到了样例的重要性,会给你思路,而不会跑偏!#include<bits/stdc++.h>using namespace std;#define Max (int)(1e5+10)#define INF 0x3f3f3f3f3...原创 2018-08-02 09:52:36 · 380 阅读 · 0 评论 -
P1211 [USACO1.3]牛式 Prime Cryptarithm
要养成写子程序习惯,使得代码不会很长写的时候忘记用bool标记一下,然后每个都在数组里面找很麻烦,优化一下好看多啦#include<bits/stdc++.h>using namespace std;#define Max (int)(1e5+10)#define INF 0x3f3f3f3f3ftypedef long long ll;int n;bool a[...原创 2018-08-01 21:06:19 · 257 阅读 · 0 评论 -
HDU 6296 代码派对
矩形的交集如果非空,那么仍然是一个矩形。考虑求出经过每个格子 (i,j) 的矩形数量 fi,j,f 可以通过二维前缀和在 O(n + m2) 的时间内求出,则 ans =∑C(fi,j,3)。 上述方法会重复统计,这些多出来的部分一定是交集覆盖了 (i,j −1) 或者 (i−1,j)。减去 交集同时覆盖 (i,j −1) 和 (i,j) 的答案,再减去交集同时覆盖 (i−1,j) 和 (i,j)...原创 2018-06-05 12:03:10 · 1164 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第五场) A GPA
#include<bits/stdc++.h>using namespace std;typedef long long ll;#define Max int(1e5+10)int n,k;const double eps=1e-6;double mid;int dcmp(double x){ if(fabs(x)<eps) return 0; else r...原创 2018-08-03 14:00:34 · 196 阅读 · 0 评论 -
Goldbach
Description:Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states:Every even integer greater than 2 can be expressed as the sum...原创 2018-04-22 19:38:22 · 501 阅读 · 0 评论 -
HDU 整数对
Problem DescriptionGardon和小希玩了一个游戏,Gardon随便想了一个数A(首位不能为0),把它去掉一个数字以后得到另外一个数B,他把A和B的和N告诉了小希,让小希猜想他原来想的数字。不过为了公平起见,如果小希回答的数虽然不是A,但同样能达到那个条件(去掉其中的一个数字得到B,A和B之和是N),一样算小希胜利。而且小希如果能答出多个符合条件的数字,就可以得到额外的糖果。 所...原创 2018-04-21 13:31:14 · 341 阅读 · 0 评论 -
P3864 [USACO1.2]命名那个数字 Name That Number map容器
map 用起来真方便#include<bits/stdc++.h>using namespace std;#define Max (int)(1e5+10)typedef long long ll; map<ll,vector<string> > f;int main() { int key[27]={0,2,2,2,3,3,3,4,4...原创 2018-08-03 16:11:47 · 433 阅读 · 0 评论 -
STL容器中map用法
1.遍历一般使用迭代器遍历比较方便。 map<string,int> m;map<string,int>::iterator it;it = m.begin();while(it != m.end()){ //it->first; //it->second; it ++; }...原创 2018-04-16 20:04:44 · 237 阅读 · 0 评论 -
51 nod 1183
1183 编辑距离 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注编辑距离,又称Levenshtein距离(也叫做Edit Distance),是指两个字串之间,由一个转成另一个所需的最少编辑操作次数。许可的编辑操作包括将一个字符替换成另一个字符,插入一个字符,删除一个字符。例如将kitten一字转成sitting:sitten (...原创 2018-08-09 08:59:53 · 167 阅读 · 0 评论 -
P1466 集合 Subset Sums 背包恰好完全装满
#include<bits/stdc++.h>using namespace std;typedef long long ll;#define Max int(2e5+10)ll n,dp[400];int main() { scanf("%d",&n); int t=n*(1+n)/2; if(t%2) { printf("0\n"); retu...原创 2018-08-06 09:55:34 · 339 阅读 · 0 评论 -
51nod 1732
1732 51nod婚姻介绍所 题目来源: 原创基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注51nod除了在做OJ之外,还开展了很多副业。婚姻介绍所就是其中之一。对于一个客户,我们可以使用一个字符串来描述该客户的特质。假设现在我们有两个客户A和B。A的特质字符串为:abcdefgB的特质字符串为:abcxyz则A和B的匹配度f(A, B)为A和B的...原创 2018-04-18 09:51:52 · 192 阅读 · 0 评论 -
HDU 6024 女生专场 Building Shops 【简单dp】
Building Shops Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 701 Accepted Submission(s): 265Problem Description HDU’s n classrooms are on a li...原创 2018-04-16 17:55:50 · 360 阅读 · 0 评论 -
P1214 [USACO1.4]等差数列 Arithmetic Progressions
https://www.luogu.org/problemnew/show/P1214#include<bits/stdc++.h>using namespace std;#define Max (int)(1e5+10)typedef long long ll;struct item { int a,b; bool operator <(item x) { ...原创 2018-08-03 18:48:46 · 266 阅读 · 2 评论 -
ZOJ 4020 Traffic Light
Traffic LightTime Limit: 1 Second Memory Limit: 131072 KBDreamGrid City is a city with intersections arranged into a grid of rows and columns. The intersection on the -th row and the -th colum...原创 2018-04-15 14:03:14 · 254 阅读 · 0 评论 -
F. Halum and Candies
F. Halum and CandiesScore: 100CPU: 1sMemory: 1024MBHalum has been elected as the captain of his school’s football team. To celebrate this, he is going to throw a party. Halum bought candies of...原创 2018-08-20 13:32:57 · 356 阅读 · 0 评论 -
P1472 奶牛家谱 Cow Pedigrees
太精妙,留着以后慢慢消化https://www.luogu.org/problemnew/show/P1472法一:我们一层一层地来推,枚举层数,然后再枚举这一层选择的奶牛的个数(必须是偶数个的,因为我第一层已经处理好了),然后再枚举上一层选择的奶牛的个数(也必须是偶数的,因为我把第二层也特殊处理了,就可以从第三层开始了),但是发现一共要选择n个奶牛,所以不得不再加一维目前总共选择的奶...转载 2018-08-11 09:18:01 · 434 阅读 · 0 评论 -
hdu 6308
怪不得自己一直t,原来是有好多函数自己不会用,学到了注:时钟问题只需要化为分钟来做,就会简便很多C/C++中字符串与数值相互转换#include <cstdio>#include <string>#include <cstring>#include <iostream>#include <algorithm>in...原创 2018-07-24 14:00:19 · 271 阅读 · 0 评论 -
洛谷 P1519 穿越栅栏 Overfencing
将两个出口找出来,然后跑两遍BFS,每个点都维护一个距离的最小值。注意: 从出口往里跳的时候只能挑一格。 从别的格子跳往其他格子的时候只能跳两格 跳两格的时候还必须判断中间隔过去的一格是不是空格 #include<bits/stdc++.h>using namespace std;typedef long long ll;typedef pai...原创 2018-08-20 12:30:18 · 491 阅读 · 0 评论 -
Gym-101353H Simple Path(树型dp)
H. Simple PathScore: 100CPU: 1sMemory: 1024MBYou will be given a weighted rooted tree, where root is node 1. For each subtree of that tree, you will have to compute the summation of lengths of...原创 2018-08-22 08:40:02 · 313 阅读 · 0 评论 -
P1518 两只塔姆沃斯牛 The Tamworth Two
https://www.luogu.org/problemnew/show/P1518思路一:#include<bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<ll ,ll > P;#define INF 0xf3f3f3fconst int Max=10000+10...原创 2018-08-13 15:47:19 · 653 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第二场)D money
因为最后n+1位没有考虑到,导致wa了好多次。思路:将数组划分成多个连续上升子区间,最大利润就是每个子区间端点数值相减,交换次数就是自区间个数的两倍。注意数组输入的时候先局部去重,因为相邻的元素相等对结果没有影响,而且在写代码的时候会造成麻烦,所以先去重,让相邻两个元素不相等#include<bits/stdc++.h>using namespace std; typ...原创 2018-07-22 16:10:51 · 163 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第三场) A PACM Team
原来dp开了五维,用来存数据,同时可以通过数据的大小变化来回溯求路径,结果内存超了,只能变成四个维度然后再开一个五维的来记录记路径。#include<bits/stdc++.h>using namespace std;typedef long long ll;#define Max int(1e5+10)const ll N=1000+10;int n;short...原创 2018-07-27 10:09:15 · 256 阅读 · 0 评论 -
牛客网多校赛第一场 J Different Integers
今天早上6点多醒过来自学树状数组,然后弄懂了这道题树状数组 这个博客不错,讲的通俗易懂思路:本来是一个数组从中间截断,很难想,但是换一种思路,将前面一段数组拼到后面,就成了在一段区间一段连续的数组求有多少个不同个数,之后就可以用树状数组求啦。#include<bits/stdc++.h>using namespace std; typedef long long...原创 2018-07-20 23:17:29 · 190 阅读 · 0 评论 -
牛客网多校训练 第一场 D TWO Graphs
补题在全排列的地方卡了好久,原来是自己的STL里面的函数不知道,积累一下C++STL中全排列函数next_permutation的使用思路:因为n最多为8个,所以全排列就可以,然后一个个验证是不是与图一里面同构#include<bits/stdc++.h>using namespace std; typedef long long ll; #define Ma...原创 2018-07-20 14:19:30 · 301 阅读 · 0 评论 -
缺失的数据范围 2018中国大学生程序设计竞赛-女生专场
不难发现随着 n 的增大,na (⌈log2 n⌉)b 的值不会减小,反之亦然。二分查找最大的满足 na (⌈log2 n⌉)b 不超过 k 的 n 即可。 有两点需要注意:• 乘法可能溢出 64 位整数,需要特殊处理。 • 求 ⌈log2 n⌉ 时不应使用实数计算,这将带来误差,应当使用整数计算。 时间复杂度 O(log2 k)。#include<bits/stdc++.h>usi...原创 2018-06-05 07:34:48 · 404 阅读 · 0 评论 -
uva-1593 代码对齐
#include<iostream>#include<sstream>#include <cstdio>#include<stack>#include<vector>#include<list>#include<iomanip>#include<cstring>#incl原创 2018-06-03 19:15:41 · 255 阅读 · 0 评论 -
UVa 201 Squares(正方形)
A children’s board game consists of a square array of dots that contains lines connecting some of thepairs of adjacent dots. One part of the game requires that the players count the number of squares ...原创 2018-04-10 18:19:39 · 386 阅读 · 0 评论 -
hdu1863畅通工程
B - 畅通工程 本来以为是最短路问题,做了好久,转换思路到幷查集。比原来多了最优方案选择的问题,只需要进行排序,然后进行正常幷查集操作即可,不用担心重复问题,因为幷查集不会出现这个问题,自动去重。#include<bits/stdc++.h> using namespace std;typedef long long ll;#define INF 0x3f3f3f3f#de...原创 2018-04-10 17:30:10 · 176 阅读 · 0 评论 -
Codeforces 279B Books
A - Books #include<bits/stdc++.h> using namespace std;typedef long long ll;#define INF 0x3f3f3f3f#define Max (int)1e5+10int n, a[Max], t, sum[Max], i, j;int main(){ while (cin >> ...原创 2018-04-10 11:45:56 · 256 阅读 · 0 评论