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>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
int n,m;
while(cin >> n >> m)
{
if(n == m) cout << "" << endl;
else if(m < ) cout << "" << endl;
else if(n >= m*)cout << m << endl;
else cout << n-m << endl;
} return ;
}
Codeforces 1163A - Eating Soup的更多相关文章
- 水题Eating Soup
A. Eating Souptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutput ...
- Codeforces Round #558 (Div. 2)
目录 Codeforces Round #558 (Div. 2) 题解 A Eating Soup B Cat Party C Power Transmission D Mysterious Cod ...
- CF-558:部分题目总结
题目链接:http://codeforces.com/contest/1163 A .Eating Soup sol:在n / 2.n - m.m三个数中取最小值,结果受这三个值限制.但是m == 0 ...
- Java编程思想学习笔记_6(并发)
一.从任务中产生返回值,Callable接口的使用 Callable是一种具有泛型类型参数的泛型,它的类型参数表示的是从方法call返回的值,而且必须使Executor.submit来去调用它.sub ...
- Codeforces Round #600 (Div. 2) C - Sweets Eating
#include<iostream> #include<algorithm> #include<cstring> using namespace std ; typ ...
- [codeforces 549]G. Happy Line
[codeforces 549]G. Happy Line 试题描述 Do you like summer? Residents of Berland do. They especially love ...
- CodeForces 549G Happy Line
Happy Line Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit ...
- CodeForces 42A Guilty — to the kitchen!
Guilty — to the kitchen! Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & ...
- Codeforces Beta Round #69 (Div. 1 Only) C. Beavermuncher-0xFF 树上贪心
题目链接: http://codeforces.com/problemset/problem/77/C C. Beavermuncher-0xFF time limit per test:3 seco ...
随机推荐
- go指定分隔符格式化时间
一.代码 package main import ( "fmt" "strings" "strconv" "time" ...
- 使用Nodejs 的http-proxy 模块做代理服务器的尝试
参考 : https://blog.csdn.net/zhihuoqian9683/article/details/78944482 (亲测可行) http://www.mizuiren.com/4 ...
- vue2 开发环境部署 及 打包配置
一.脚手架工具(vue2 的脚手架工具是 vue-cli) 1.脚手架工具的安装 参考 : https://blog.csdn.net/wulala_hei/article/details/804 ...
- GitHub 万星推荐:黑客成长技术清单
GitHub 万星推荐:黑客成长技术清单 导语:如果你需要一些安全入门引导,“Awesome Hacking”无疑是最佳选择之一. 最近两天,在reddit安全板块和Twitter上有个GitHub项 ...
- npm install 超时 国内 切换源; npm ERR! code ELIFECYCLE;
install 超时 查看npm源地址 npm config get registry #http://registry.npmjs.org 为国外镜像地址 设置阿里云镜像 npm config se ...
- libvert开启TCP监听
1.设置libvirtd 编辑/etc/libvirt/libvirtd.conf listen_tls = 0 listen_tcp = 1 auth_tcp="none" tc ...
- Jeecg中通过Spring_AOP+注解方式实现日志的管理
转载;https://blog.csdn.net/ma451152002/article/details/77234236 Jeecg中通过Spring_AOP+注解方式实现日志的管理 一.设计思路 ...
- 一分钟开启Tomcat https支持
1.修改配置文件 打开tomcat/conf/server.xml配置文件,把下面这段配置注释取消掉,keystorePass为证书密钥需要手动添加,创建证书时指定的. <Connector p ...
- 关于kettle
1.点spoon.bat无报错也不运行 可以运行一下spoonDebug.bat 查看一下spoondebug.txt日志 我遇到这个问题时 是给他分配的内存太多了 我的电脑只有2g 给果他给分了20 ...
- jmeter 查看结果树之查看响应的13种方法
查看结果树查看响应有哪几种方法,可通过左侧面板底部的下拉框选择 1 Text 查看结果树中请求的默认格式为Text,显示取样器结果.请求.响应数据3个部分内容. 取样器结果: 默认Raw展示,可以切换 ...