题意: 对输入的每个数都进行分配到两个多重集中,问分配完以后 每个多重集中的个数为1的元素是否相等  相等则输出一个分配方式, 不想等为NO 解析: 三种情况 1.原数列中个数为1 的数的个数为偶数  YES 集合A中只有一半个数为1的数, 其它的数在集合B中即可 2.原数列中个数为1的数的个数为奇数,且不存在个数大于等于3的数  NO 3.原数列中个数为1的数的个数为奇数,存在个数大于等于3的数 YES  先照1分配完 然后 把个数大于等于3的那个数 拿出一个放到A中 其它在B即可 #incl…
Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from doesn't exceed some value of…
传送门 [http://codeforces.com/contest/1051/problem/C] 题意 给你一堆数,问是否可以分为两堆使得两堆里只出现一下的数字的种类相等,可以输出任意一种分的方式 分析 具体看代码 代码 #include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //fr…
大意: 给定$4n$个$m$位的五进制数, $q$个询问, 每个询问给出一个$m$位的五进制数$b$, 求有多少种选数方案可以使五进制异或和为$b$. 高斯消元入门题 每次询问相当于就是给定了$m$个式子组成的模$5$的方程组, 求解的个数 如果消元后询问某一位非零, 但是对应系数矩阵全零, 那么无解 否则解的个数是$5^{n-r}$ $q$组询问的话, 就增广$q$列, 同时解$q$个方程组即可. #include <iostream> #include <sstream> #i…
题意:当前在看书的第 x 页,每次可以向前或者向后翻 d 页,这个书一共 n 页,问能否用最小操作翻到第 y 页. 题解:三种情况:1.直接翻能到的一定最短. 2.先翻到第一页,然后往后翻,翻到第 y 页.3.先翻到第 n 页,然后往前翻,翻到第 y 页. #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int ans,t,n,x,y,d; cin >> t; while…
大意: 给定$a,b$, $1\le a,b\le 1e12$, 定义 $f(a,0)=0$ $f(a,b)=1+f(a,b-gcd(a,b))$ 求$f(a,b)$. 观察可以发现, 每次$b$一定是减去若干个相同的$gcd$, 并且每次减的$gcd$一定是递增的, 并且一定是在$gcd$最接近$b$的时候开始减, 可以预处理出所有这样的位置, 然后模拟. #include <iostream> #include <cstdio> #include <math.h>…
蒟蒻就切了四道水题,然后EF看着可写然而并不会,中间还WA了一次,我太菜了.jpg =.= A.Vasya And Password 一开始看着有点虚没敢立刻写,后来写完第二题发现可以暴力讨论,因为保证有解,没了 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; char rd[N]; int main () { int T; scanf("%d"…
做了四个题.. A. Vasya And Password 直接特判即可,,为啥泥萌都说难写,,,, 这个子串实际上是忽悠人的,因为每次改一个字符就可以 我靠我居然被hack了???? %……&*()(*&……好吧我把$0$从数字里扔了. /* */ #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<map> #in…
A:Vasya And Password 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout); #define LL long long #define ULL unsigned LL #define fi first #…
A. Vasya And Password 模拟题,将所缺的种类依次填入"出现次数$ >1 $"的位置,替换掉Ta即可. #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N = 110; char str[N]; int sum[3][N], n; int inline get(char x){ if(x <=…