题目链接: A:Ostap and Grasshopper B:Urbanization C:Tennis Championship D:Taxes 分析:这场第一二题模拟,三四题数学题 A. 直接模拟即可 B. 排序从大到小取n1个数到城市1,n2个数到城市二,n1<=n2 C. 递推.斐波拉契数列 dp[i] 表示赢i场比赛需要多少人, 则 dp[0] = 1,dp[1] = 2,dp[3] = dp[1] +dp[0],  dp[ans] = dp[ans-1] + dp[ans-2]一次…
C. Tennis Championship(递推,斐波那契) 题意:n个人比赛,淘汰制,要求进行比赛双方的胜场数之差小于等于1.问冠军最多能打多少场比赛.题解:因为n太大,感觉是个构造.写写小数据,看看有没有结论. 2 3 4 5 6 7 8 9 10 11 12 (人数) 1 2 2 3 3 3 4 4 4 4 4 (比赛数) 发现比赛数的增长成斐波那契.维护一个前缀和即可. #include <bits/stdc++.h> #define ll long long using names…
D. Taxes 题目链接 http://codeforces.com/contest/735/problem/D 题面 Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to n (n ≥ 2) burles and the amount of tax he has to pay is calculated a…
C. Tennis Championship 题目链接 http://codeforces.com/contest/735/problem/C 题面 Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will fo…
B. Urbanization 题目链接 http://codeforces.com/contest/735/problem/B 题面 Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move…
http://codeforces.com/contest/716/problem/C 题目大意:感觉这道题还是好懂得吧. 思路:不断的通过列式子的出来了.首先我们定义level=i, uplevel = i + 1,目前的uplevel,然后我们可以知道,之前求出来的restgrade%level = 0,于是我们可以列出一个式子sqrt(k1 * i + grade) = uplevel * k.因为grade也是i的倍数,假定grade = k2 * i,所以我们写成sqrt((k1 +…
题目: Little C loves number «3» very much. He loves all things about it. Now he has a positive integer nn. He wants to split nn into 3 positive integers a,b,ca,b,c, such that a+b+c=na+b+c=n and none of the 3 integers is a multiple of 3. Help him to fin…
https://codeforces.com/contest/1143/problem/D 题意 有nk个城市,第1,k+1,2k+1,...,(n-1)k+1城市有餐厅,你每次能走l距离,a为起始位置离最近餐厅的距离,b为走了一次后离最近餐厅的距离,给出n,k,a,b,求你回到起点最少和最多停留次数 题解 \(yl=xnk,有y=xnk/l,即y=lcm(xnk,l)/l\) 枚举a(两种情况),b(两种情况),维护最大,最小值 代码 #include<bits/stdc++.h> #def…
A.= = B. 题意:给出n个数和n1和n2,从n个数中分别选出n1,n2个数来,得到n1个数和n2个数的平均值,求这两个平均值的最大和 分析:排个序从后面抽,注意先从末尾抽个数小的,再抽个数大的 C. 题意:有n个队伍比赛,每两个队伍比赛结束后输的人退场,赢的人场次增加1,现在由你来设计比赛顺序(比赛的两个队伍的场次之差不能大于1),使得最后胜利的冠军队伍的参加场次最多,输出这个场次 分析:先开始的贪心错了,以为就是简单的每次对半打 设f(i)表示打i场最少需要f(i)个队伍 f(i)=f(…
CF一如既往在深夜举行,我也一如既往在周三上午的C++课上进行了virtual participation.这次div2的题目除了E题都水的一塌糊涂,参赛时的E题最后也没有几个参赛者AC,排名又成为了手速与精准的竞争--(遗憾,如果参加了一定可以上分的吧orz) A题: 先判断起点和终点的距离是否被每次跳的距离整除,如果不整除就到不了.再检验跳跃过程中的落点是否均合法即可. #include<stdio.h> #include<bits/stdc++.h> #include <…