Codeforces 1163A - Eating Soup】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/1163/A 题意:n 只猫围成一圈,离开 m 只,最多剩下几组猫. 思路:当 n == m 即猫都离开时 ans = 0. 当 m == 1 或 m == 0 时 ans = 1. 当 离开猫的数量 不足 n 的一半时, ans = m(离开的猫数,不明白可以手动模拟). 当 m >= n/2 时 剩下的猫都能单独出来 所以 ans = n - m. AC代码: #include<iostream&g…
A. Eating Souptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output    The three friends, Kuro, Shiro, and Katie, met up again! It’s time for a party…    What the cats do when they unite? Right, they ha…
目录 Codeforces Round #558 (Div. 2) 题解 A Eating Soup B Cat Party C Power Transmission D Mysterious Code E Magical Permutation Codeforces Round #558 (Div. 2) 题解 A Eating Soup 分类讨论一下 \(m\) 个断点最多可以将环分成 \(m\) 段,而剩下 \(n-m\) 个点最多可以成为 \(n-m\) 段,取个 \(\min\) 即可…
题目链接:http://codeforces.com/contest/1163 A .Eating Soup sol:在n / 2.n - m.m三个数中取最小值,结果受这三个值限制.但是m == 0的情况需要特判 思维 #include "bits/stdc++.h" using namespace std; int main() { int n, m; scanf("%d%d", &n, &m); ) {puts(;} printf(, min(…
一.从任务中产生返回值,Callable接口的使用 Callable是一种具有泛型类型参数的泛型,它的类型参数表示的是从方法call返回的值,而且必须使Executor.submit来去调用它.submit方法将会返回Future对象,它用Callable返回结果的特定类型进行了参数化,可以通过isDone方法来检测Future是否已经完成.当任务完成的时候,它具有一个结果,可以调用get方法来获取结果,get方法将阻塞,直到结果准备就绪.下面是示例: import java.util.conc…
#include<iostream> #include<algorithm> #include<cstring> using namespace std ; typedef long long ll; ; ll arr[MAXN],dp[MAXN]; int main() { ll n,m,sum=; cin >> n >> m; ; i<=n; i++) cin >> arr[i]; sort(arr+,arr+n+); ;…
[codeforces 549]G. Happy Line 试题描述 Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of n Berland residents lined up in front of the ice cream stall. We know that ea…
Happy Line Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 549G Description Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this…
 Guilty — to the kitchen! Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 42A Description It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forc…
题目链接: http://codeforces.com/problemset/problem/77/C C. Beavermuncher-0xFF time limit per test:3 secondsmemory limit per test:256 megabytes 问题描述 "Eat a beaver, save a tree!" - That will be the motto of ecologists' urgent meeting in Beaverley Hill…
C. Case of Chocolate Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/555/problem/C Description Andrewid the Android is a galaxy-known detective. Now he does not investigate any case and is eating chocolate out of boredom. A…
题目链接:https://codeforces.com/problemset/problem/1099/F Mitya and Vasya are playing an interesting game. They have a rooted tree with $n$ vertices, and the vertices are indexed from $1$ to $n$. The root has index $1$. Every other vertex $i≥2$ has its p…
D - Alyona and Numbers Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 682A Description After finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two co…
A. Alyona and Numbers 题目连接: http://www.codeforces.com/contest/682/problem/A Description After finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two columns of integers - the first column containing integers…
B. Tavas and SaDDas Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/535/problem/B Description Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. Th…
题意与分析(CodeForces 580D) 一个人有\(n\)道菜,然后要点\(m\)道菜,每道菜有一个美味程度:然后给你了很多个关系,表示如果\(x\)刚好在\(y\)前面做的话,他的美味程度就会增加\(c\).求最大的美味程度. 这种题目一看就是状压dp,\(n \le 15\)啊.定义\(dp[i][stat]\)等于最后一道菜为第i个菜,吃完第i道菜后的状态是stat(第i位为是否吃过,二进制位数的和是吃过菜的总数)的最大美味程度.那么\[dp[i][stat]=max\{dp[j][…
传送门:http://codeforces.com/contest/895/problem/B B. XK Segments time limit per test1 second memory limit per test256 megabytes Problem Description While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the l…
链接: https://codeforces.com/contest/1278/problem/C 题意: Karlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were 2n jars of strawberry and blueberry jam. All the 2n jars are arranged in…
链接: https://codeforces.com/contest/1209/problem/D 题意: The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks!…
由于一次比赛被虐得太惨,,生发开始写blog的想法,于是便有了这篇随笔(找了个近期的cf比赛练练手(bushi))第一次写blog,多多包涵. 第二场cf比赛,第一场打的Div2,被虐太惨,所以第二场挑了个Div4... 比赛链接: https://codeforces.com/contest/1669 A. Division 翻译(参考): t组样例,每组样例给出一个正整数,判断该整数所在的范围 题解: 签到题,分类讨论下即可 B.Trip 翻译(参考): t组样例,每组给出一个长度为n的数组…
这几篇博文只是为了记录学习Beautiful Soup的过程,不仅方便自己以后查看,也许能帮到同样在学习这个技术的朋友.通过学习Beautiful Soup基础知识 完成了一个简单的爬虫服务:从allitebooks.com抓取书籍的书名和每本书对应的ISBN码,然后通过ISBN码去amazon.com抓取对应的价格. 第一部分 Beautiful Soup的基础知识 Beautiful Soup的安装和查找.浏览的方法. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon…
开始学习网络数据挖掘方面的知识,首先从Beautiful Soup入手(Beautiful Soup是一个Python库,功能是从HTML和XML中解析数据),打算以三篇博文纪录学习Beautiful Soup的过程,第一篇是Beautiful Soup基础知识,后两篇利用前边的Beautiful Soup知识完成一个简单的爬虫,抓取allitebook.com的书籍信息和ISBN码,再根据ISBN码去amazon.com抓取书籍对应的价格. 一.Beautiful Soup简介 网络数据挖掘指…
上一次我们拿学校的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…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连通图)且这颗树中必须包含节点1 然后将这颗子树中的所有点的点权+1或-1 求把所有点权全部变为0的最小次数(n<=10^5) 题解: 因为每一次的子树中都必须有1,所以我们得知每一次变换的话1的权值都会变化 所以我们以1为根 现在,我们发现,如果一个节点的权值发生变化,那么他的父节点的权值一定发生变…
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a3-+ai,问满足Si<=p的i的最大值的期望.(p<=50) (大意来自于http://www.cnblogs.com/liu-runda/p/6253569.html) 我们知道,全排列其实等价于我们一个一个地等概率地向一个序列里面插入数值 所以我们可以这么看这道题: 现在有n个数,有n个盒子…
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不同的点的数量+1) 每一次只有当子树中所有的点都已经游走过了再会向父亲走,走到每个儿子上的概率是相同的 对于每个点,求他的权的期望 (1 ≤ n ≤ 10^5) 题解: 首先我们发现,所有子树中所有的点的编号都一定比父亲要大 而且子树中的大小关系和我们访问它的顺序有关 如果对于一个节点u它的儿子为v…