Codeforces Round #402 (Div. 2) A+B+C+D】的更多相关文章

Codeforces Round #402 (Div. 2) A. 日常沙比提 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; inline int read(){ ,f=; ; c=getchar();} +c-'; c=getchar();} return x*f; }…
Codeforces Round #402 (Div. 2) A. Pupils Redistribution 模拟大法好.两个数列分别含有n个数x(1<=x<=5) .现在要求交换一些数使得两个数列含有某个数字的个数相同,求最少交换次数. int v1[N],v2[N]; int main() { int n; while(~scanf("%d",&n)) { int x; memset(v1,0,sizeof(v1)); memset(v2,0,sizeof(v…
A. Pupils Redistribution time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Berland each high school student is characterized by academic performance — integer value between 1 and 5. In hig…
D. String Game time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty…
A. Pupils Redistribution time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Berland each high school student is characterized by academic performance — integer value between 1 and 5. In hig…
暴搜 #include<cstdio> #include<algorithm> using namespace std; int n,K,Div=1,a[21],m,ans=100; bool vis[21]; void calc(int now) { int t=0; bool flag=0; for(int i=m;i>=1;--i) if(!vis[i]) { if((!flag) && a[i]==0) return; t=t*10+a[i]; fla…
Problem A: 题目大意: 给定两个数列\(a,b\),一次操作可以交换分别\(a,b\)数列中的任意一对数.求最少的交换次数使得任意一个数都在两个序列中出现相同的次数. (\(1 \leq a_i,b_i \leq 5 , 1 \leq n \leq 100\)) 题解: 直觉告诉我这么搞就行了 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typed…
好长时间没有打Codeforces了,今天被ysf拉过去打了一场. lrd也来参(nian)加(ya)比(zhong)赛(sheng) Problem A: 我去,这不SB题吗.. 用桶统计一下每个数出现的数目. 对位相减然后除二加起来 最后除二输出就行了. 具体为什么我也没想,直觉告诉我这么做就可以了. 然后他就pretest passed了 Problem B: for循环到k扫一遍就行了吧. 立马写了个上去 Wrong answer on pretest 2 没开long long !!!…
2017.2.26 CF D2 402 这次状态还算能忍吧……一路不紧不慢切了前ABC(不紧不慢已经是在作死了),卡在D,然后跑去看E和F——卧槽怎么还有F,早知道前面做快点了…… F看了看,不会,弃 E看了看,不会,弃 D看了看,不会……没法再弃了.想了好久发现可以二分答案(浪费30min) 过了D以后去看F,发现果然还是不会(浪费20min) 之后看E,思路跑偏浪费20min+ 此时时间还剩大约20min,终于想到了E可能是正解的做法,开始拼手速,各种调试,终于调过了样例,而时间只剩10s了…
Description Polycarp is crazy about round numbers. He especially likes the numbers divisible by 10k. In the given number of n Polycarp wants to remove the least number of digits to get a number that is divisible by 10k. For example, if k = 3, in the…