摘要: 4116 Game on a Graph 给出n个点,m条边,m条边一定连通,两组人依照一定次序取走一些边,取走之后,图形不连通的就输了 即取走n-1条边的队伍输掉 英语看不懂啊啊啊QWQ #include <bits/stdc++.h> using namespace std; int main( 阅读全文
posted @ 2020-10-04 11:35 一只幽灵飘过 阅读(62) 评论(0) 推荐(0) 编辑
摘要: A - Sum of Odd Integers 给定两个数n,k,判断n能否是k个不同的奇数的和 如果n为偶数,则k必须也为偶数才能成立;n为奇数,k也为奇数 还得保证最小的k个奇数的和,小于等于n int main() { long long t,a,b; cin>>t; while(t--){ 阅读全文
posted @ 2020-06-13 11:31 一只幽灵飘过 阅读(134) 评论(0) 推荐(0) 编辑
摘要: A - Dreamoon and Ranking Collection 给定n个排名,和x次将要举行的比赛,x次比赛可能取得任意名称,使名称可以连成1,2,3...v连续的数,求v的最大值 从1开始遍历,如果这个名次没有就记录,到x次后,继续遍历,看看是否还连续 int main() { int k 阅读全文
posted @ 2020-06-04 13:25 一只幽灵飘过 阅读(122) 评论(0) 推荐(0) 编辑
摘要: A - Sorted Adjacent Differences 将这串数字按大小排序,找到中间那个做第一个,左一个右一个输出 int main() { int k,n,i,j,a[100010]; cin>>k; while(k--){ cin>>n; for(i=0;i<n;i++){ cin>> 阅读全文
posted @ 2020-05-29 22:25 一只幽灵飘过 阅读(108) 评论(0) 推荐(0) 编辑
摘要: A - Candies 给定一个n,输出满足 x+2x+4x+...+2^(k-1)x=n 的x,根据等比数列前n项和的公式,while循环找判断个式子是否成立 #include <iostream> #include <string> #include <vector> #include <cst 阅读全文
posted @ 2020-05-25 16:39 一只幽灵飘过 阅读(106) 评论(0) 推荐(0) 编辑
摘要: A - Phoenix and Balance 将一堆质量为2,4,8,,,2^n的硬币,分为数量相同,质量尽可能接近的两组, 2+4+8+...+2^n-1 小于 2^n(差了2),质量大的要跟质量小的在一起,所以质量差(2+2^2...2^(n/2-1))*2+2 #include<iostre 阅读全文
posted @ 2020-05-20 22:29 一只幽灵飘过 阅读(116) 评论(0) 推荐(0) 编辑
摘要: D. Dividing by Two 将A变成B需要的最小步数 ,只能将A+1或A/2 当A大于B,A为奇数时,(a+1)/2,A为偶数时,a/2; 当A小于B,a+1; #include<cmath> #include<cstdio> #include<algorithm> #include<st 阅读全文
posted @ 2020-05-06 14:53 一只幽灵飘过 阅读(215) 评论(0) 推荐(0) 编辑
摘要: A 张经理的员工 (a<b)a之前的员工去a那里,b之后的员工去b那里;a,b之间的,a+(a+b)/2前的去a那里 #include<cmath> #include<cstdio> #include<algorithm> #include<string> #include<vector> #inc 阅读全文
posted @ 2020-05-06 14:29 一只幽灵飘过 阅读(198) 评论(0) 推荐(0) 编辑
摘要: A - Buggy Sorting 举一个反例,让这个排序不能正常进行(好像基本上都不行) loop integer variable i from 1 to n - 1 loop integer variable j from i to n - 1 if (aj > aj + 1), then s 阅读全文
posted @ 2020-04-24 16:15 一只幽灵飘过 阅读(116) 评论(0) 推荐(0) 编辑
摘要: D - A Simple Math Problem 解题思路:给定两个正整数a和b,求出满足条件的合适的X和Y: X + Y =a最小公倍数(X, Y) =b 数学不好的我留下了泪水qwq,大概就是gcd(x,y)==gcd(a,b),得x*y=gcd(a,b)*b;与x+y=a联立,解得 AC代码 阅读全文
posted @ 2020-04-17 22:08 一只幽灵飘过 阅读(125) 评论(0) 推荐(0) 编辑