Codeforces Round #315 (Div. 2) A 水且坑】的更多相关文章

A. Music time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favo…
B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inv…
A. Mishka and Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in…
A. Anton and Polyhedrons time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:…
A. Buying A House time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us. The gi…
A. Dasha and Stairs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On her way to programming school tiger Dasha faced her first test — a huge staircase! The steps were numbered from one t…
A. Lunch Rush time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time u…
A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of th…
A. Elections time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many peopl…
A. Pineapple Incident time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time.…
比赛链接:http://codeforces.com/contest/569 A. Music time limit per test:2 seconds memory limit per test:256 megabytes Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite…
---恢复内容开始--- output standard output The final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a_1 players in the first team and a_2 players…
B. Equidistant String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her string…
A. Toy Cars time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The pr…
A. Primes or Palindromes?Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://poj.org/problem?id=3261 Description Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindro…
这次可以说是最糟糕的一次比赛了吧, 心没有静下来好好的去思考, 导致没有做好能做的题. Problem_A: 题意: 你要听一首时长为T秒的歌曲, 你点击播放时会立刻下载好S秒, 当你听到没有加载到的地方时, 就会重头听, 直到可以听完整首歌, 由于网络堵塞, 你在q秒内只有q-1秒用于下载, 问需要重新多少次, 第一次点击播放也算. 思路: 由题意可知, 下载速度为(q - 1) / q , 假设t秒后听歌的进度和下载的进度一样, 即听到没有下载的地方or已经下载完. 可以得到方程: (q -…
题目:Click here 题意:π(n)表示不大于n的素数个数,rub(n)表示不大于n的回文数个数,求最大n,满足π(n) ≤ A·rub(n).A=p/q; 分析:由于这个题A是给定范围的,所以可以先暴力求下最大的n满足上式,可以想象下随着n的增大A也在增大(总体正相关,并不是严格递增的),所以二分查找时不行的,所以对给定的A,n是一定存在的.这个题的关键就是快速得到素数表最好在O(n)的时间以内.(杭电15多校的一个题也用到了这个算法点这里查看) #include <bits/stdc+…
题目:Click here 题意:给你n,然后n个数,n个数中可能重复,可能不是1到n中的数.然后你用最少的改变数,让这个序列包含1到n所有数,并输出最后的序列. 分析:贪心. #include <bits/stdc++.h> using namespace std; ; int n; int a[M]; // 给定序列 int mark[M]; // mark[i] 表示i在给定序列中的出现次数 int notap[M]; // 给的序列中没有出现的元素 bool firstout; voi…
题目:Click here 题意:(据说这个题的题意坑了不少人啊~~~)题目一共给了3个数---- T 表示歌曲的长度(s).S 表示下载了歌曲的S后开始第一次播放(也就是说S秒的歌曲是事先下载好的).q 表示下载速度(每秒下载歌曲(q-1)/q秒).问题就是播放的速度比下载的速度快,每当播放到没下载的位置,就会重新从头播放,输出的就是从头播放的次数(包括第一次). 分析:高中物理追击问题,模拟下好了. #include <bits/stdc++.h> using namespace std;…
A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to opera…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
题意:求使pi(n)*q<=rub(n)*p成立的最大的n. 先收集所有的质数和回文数.质数好搜集.回文数奇回文就0-9的数字,然后在头尾添加一个数.在x前后加a,就是x*10+a+a*pow(10,2).偶回文同理.然后不能二分,因为比值不是单调的. 乱码: #pragma comment(linker,"/STACK:1024000000,1024000000") #include<iostream> #include<cstdio> #include…
C. Primes or Palindromes? time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and un…
A. Cards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cards (n is even) in the deck. Each card has a positive integer written on it. n / 2 people will play new card game. At…
Description There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles l…
A. Asphalting Roads time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output City X consists of n vertical and n horizontal infinite roads, forming n × n intersections. Roads (both vertical and hori…
B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inv…
A. Music time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favo…
这道题居然是一个大暴力... 题意: π(n):小于等于n的数中素数的个数 rub(n) :小于等于n的数中属于回文数的个数 然后给你两个数p,q,当中A=p/q. 然后要你找到对于给定的A.找到使得π(n) ≤ A·rub(n) 最大的n. (A<=42) 思路: 首先我们能够暴力算出当n为大概150万左右的时候,π(n)大概是 rub(n) 的42倍. 所以我们仅仅须要for到150万左右就好,由于对于后面的式子.肯定能在150万的范围内找到一个n使得这个式子成立的. 并且.我们可以得出由于…
https://codeforces.com/contest/1139/problem/F 题意 有m个人,n道菜,每道菜有\(p_i\),\(s_i\),\(b_i\),每个人有\(inc_j\),\(pref_j\),一个人可以买一道菜的条件是 1. \(p_i \leq inc_j \leq s_i\) 2. \(|b_i - pref_j| \leq inc_j-p_i\) ,问每个人分别能买多少道菜 题解 转化一下公式 \(p_i \leq inc_j \leq s_i\) 下面两个满…