随笔分类 - Codeforces
摘要:Codeforces Round #686 (Div. 3) 给出一个错排。 题解:整体左移一位即可。 #include<bits/stdc++.h> using namespace std; int main(){ int _;cin>>_; while(_--){ int n;cin>>n; f
阅读全文
摘要:Codeforces Round #683 (Div. 2, by Meet IT) A,B过水。 C:给20w个数,给你一个数K,问你能不能在这20w个数里,找到若干个数使得它们的和超过ceil[K/2],且不超过K。 题解:如果20w个数中,有一个满足的,那直接白给。否则,在小于ceil[k/2
阅读全文
摘要:Codeforces Round #677 (Div. 3) 全题解 好久不更博客之想水一篇博文之每个题只有几句话之 10000以内,如果一个数的全部数位相同,那称为一个特殊的数。给你一个数,你需要输出在它之前(包括它),所有特殊数的数位之和。 题解:前面的数,每四个数位和为10个。算一下就好了。
阅读全文
摘要:Codeforces Round 642 (Div. 3) "传送门" ) A. 给你n个数,和一个数字m。构建一个非负数组,使得其长度为n,数组的和为m。并且使得最大。 可以想到,的时候,答案是0。的时候,
阅读全文
摘要:A. 给你一个n,解方程,(1+2+4+...+2^(k-1))*x=n,保证k>1。 枚举k,可以整除时输出一个数。 #include<bits/stdc++.h> #define all(x) x.begin(),x.end() #define fi first #define sd secon
阅读全文
摘要:A. 将一个数拆成两个,两个数不等,求拆分的方法数。 奇数输出n/2,偶数输出n/2-1即可通过。 #include<bits/stdc++.h> #define all(x) x.begin(),x.end() #define fi first #define sd second #define
阅读全文
摘要:A. 给你两个数a,b,每次操作可以a:=a+1,操作多少次之后能使得a%b==0? 输出a对b的上取整乘以b与a的差就可以通过。 #include<bits/stdc++.h> #define fi first #define sd second #define lson (nd<<1) #def
阅读全文