Codeforces 805A/B/C】的更多相关文章

A. Fake NP 传送门:http://codeforces.com/contest/805/problem/A 本题是一个数学问题. 给定两个正整数l,r(l≤r),对于区间[l..r]上的任一整数,写出其除1以外的所有因数,求区间[l..r]上出现频率最高的一个因数. 结论:若l=r,则答案为l(或r),否则为2.参考程序如下: #include <stdio.h> int main(void) { int l, r; scanf("%d%d", &l, &…
[题目链接]:http://codeforces.com/contest/805/problem/A [题意] 问你在l..r这个区间内的所有数字: 对于每个数的因子; 出现次数最多的是哪一个; [题解] 正常情况下; 求l..r内的出现的因子数 可以转化成1..l-1和1..r两个部分来求; 后者减去前者就好; 都需要枚举2的倍数在1..x里面有多少个,3的倍数在1..x里面-. 即x/2个和x/3个- 以此类推; 显然每次都是2的倍数最多啦; 但是有例外吧 就是l==r的时候,且l为奇数的时…
Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Fi…
直觉. 一段区间中,肯定是$2$的倍数最多,因为区间长度除以$2$得到的数字最大.但只有$1$个数字的时候需要特判. #include <cstdio> #include <cmath> #include <set> #include <cstring> #include <algorithm> using namespace std; int L,R; int main() { while(~scanf("%d%d",&am…
codeforces 805A     http://codeforces.com/problemset/problem/805/A /* 题意:输入两个整数l,r,让你找一个因子 使得[l,r]里面所有的数,能整除这个因子的数最多,输出这个因子 如果答案有多个,输出任意一个 */ #include<iostream> #include<cstdio> #include<cstring> using namespace std; int l,r,cnt1,cnt2; i…
每日CF: 411div2 Solved A CodeForces 805A Fake NP Solved B CodeForces 805B 3-palindrome Solved C CodeForces 805C Find Amir Solved D CodeForces 805D Minimum number of steps Attempted E CodeForces 805E Ice cream coloring     F CodeForces 805F Expected dia…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…