A. Puzzles CodeForces Round #196 (Div.2)】的更多相关文章

题目的大意是,给你 m 个数字,让你从中选 n 个,使得选出的数字的极差最小. 好吧,超级大水题.因为要极差最小,所以当然想到要排个序咯,然后去连续的 n 个数字,因为数据不大,所以排完序之后直接暴力就OK了. 附AC代码: 1: #include <stdio.h> 2: #include <math.h> 3: #include <iostream> 4: #include <cstdarg> 5: #include <algorithm>…
A. Puzzles Time Limit: 2 Sec  Memory Limit: 60 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 Description The end of the school year is near and Ms. Manana, the teacher, will soon have to say goodbye to a yet another class. S…
题目链接: http://codeforces.com/problemset/problem/337/D D. Book of Evil time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements num…
(CF唯一不好的地方就是时差……不过还好没去考,考的话就等着滚回Div. 2了……) A - Quiz 裸的贪心,不过要用矩阵乘法优化或者直接推通式然后快速幂.不过本傻叉做的时候脑子一片混乱,导致WA+TLE若干次,而且还做了很久(半小时)…… #include <cstdio> const int MOD = 1000000000+9; int ans,n,m,k; int power(long long x,int k) { int res = 1; for (;k;k >>=…
A. Puzzles 对\(f[]\)排序,取连续的\(m\)个. B. Routine Problem 考虑\(\frac{a}{b}\)和\(\frac{c}{d}\)的大小关系,适配后就是分数的运算. C. Quiz 按\(k\)将\(n\)个问题分段,那么在没有分数翻倍的情况下最大题数为\[(k-1)\lfloor\frac{n}{k}\rfloor+n\%k\] 若\(m\le (k-1)\lfloor\frac{n}{k}\rfloor+n\%k\),则最大分数就为\(m\),否则翻…
D. Puzzles Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city…
screen 尺寸为a:b video 尺寸为 c:d 如果a == c 则 面积比为 cd/ab=ad/cb (ad < cb) 如果b == d 则 面积比为 cd/ab=cb/ad  (cb < ad) 如果不相等时 如果a/b > c/d,则ad/bd > cb/db 则(ad > cb) screen尺寸可为 ad:bd, video的尺寸可为 cb:db 面积比为:cb*db/ad*bd = cb/ad (ad > cb) 如果a/b < c/d,则a…
A 题意:O(-1) 思路:排个序搞定. B 题意:O(-1) 思路:坑了我好久,这个框框水平垂直比例固定,分两种情况即可,不能旋转,我想多了,分了四种情况. C 题意:一列n个位置,让你填m个数,当连续数达到k时,分数乘以2,计数清零,当不连续时,计数也清零,没到达k之前分数+1. 思路:很显然的问题是让我们处理填m个位置,并且使连续的k个数次数最少.我们先让m个数k-1每次填,填一次空一位,直到不够填了就往前面的空位填.设连续k个次数为mm,那么就是(((2*k)+k)*2……+k)*2,等…
A:sort以后求差值最小 ]; int main() { int n,m; cin>>n>>m; ; i < m ; i++) cin>>a[i]; sort(a,a+m); int mm = INF; ; i+n- < m ; i++) mm = min(mm,a[i+n-]-a[i]); cout<<mm<<endl; ; } B:求屏幕黑框占屏幕的几分之几 . 求LCM后的差值 LL gcd(LL a,LL b){ retur…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…