05 2020 档案

摘要:A 题:https://vjudge.net/problem/CodeForces-1339B/origin 题意:将给的数组排序 |a1−a2|≤|a2−a3|≤…≤|an−1−an| 解法:每次找一个最大值,一个最小值。 #include<iostream> #include<cstdio> # 阅读全文
posted @ 2020-05-30 12:57 Leviathan_Sei 阅读(199) 评论(0) 推荐(0)
摘要:题目:A - Candies CodeForces - 1343A 题意:给一个数n,在k>1的情况下找一个x符合:x+2x+4x+⋯+2k−1x=nx+2x+4x+⋯+2k−1x=n. 做法:先求2n的前缀和,然后然后每一项进行判断。 #include<iostream> #include<cst 阅读全文
posted @ 2020-05-26 21:13 Leviathan_Sei 阅读(124) 评论(0) 推荐(0)
摘要:A Phoenix and Balance 题意: 把2^1,2^2,……2^n;分成两份,两份的差最小,保证n是偶数。 因为2^n=S(n-1)+2; 则最小的差即为Sn-2*(S(n-1)-S(n/2-1)); #include<iostream> #include<cstdio> #inclu 阅读全文
posted @ 2020-05-20 17:25 Leviathan_Sei 阅读(133) 评论(0) 推荐(0)
摘要:A题 没看懂,数学水平达不到…… 最后是x可以被gcd(a,b)除后为偶数 #include<algothrim> #include<iostream> using namespace std; int gcd(int x,int y) { if(x%y==0) return y; return g 阅读全文
posted @ 2020-05-11 08:48 Leviathan_Sei 阅读(98) 评论(0) 推荐(0)
摘要:5.2 2020年西北工业大学“编程之星”程序设计挑战赛(大学生程序设计创新实践基地队员春季选拔赛) A https://ac.nowcoder.com/acm/contest/5403/A #include<bits/stdc++.h> using namespace std; int n,m,a 阅读全文
posted @ 2020-05-11 08:40 Leviathan_Sei 阅读(98) 评论(0) 推荐(0)