题目链接: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的更多相关文章

  1. 水题Eating Soup

    A. Eating Souptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutput ...

  2. Codeforces Round #558 (Div. 2)

    目录 Codeforces Round #558 (Div. 2) 题解 A Eating Soup B Cat Party C Power Transmission D Mysterious Cod ...

  3. CF-558:部分题目总结

    题目链接:http://codeforces.com/contest/1163 A .Eating Soup sol:在n / 2.n - m.m三个数中取最小值,结果受这三个值限制.但是m == 0 ...

  4. Java编程思想学习笔记_6(并发)

    一.从任务中产生返回值,Callable接口的使用 Callable是一种具有泛型类型参数的泛型,它的类型参数表示的是从方法call返回的值,而且必须使Executor.submit来去调用它.sub ...

  5. Codeforces Round #600 (Div. 2) C - Sweets Eating

    #include<iostream> #include<algorithm> #include<cstring> using namespace std ; typ ...

  6. [codeforces 549]G. Happy Line

    [codeforces 549]G. Happy Line 试题描述 Do you like summer? Residents of Berland do. They especially love ...

  7. CodeForces 549G Happy Line

    Happy Line Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit  ...

  8. CodeForces 42A Guilty — to the kitchen!

     Guilty — to the kitchen! Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  9. 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 ...

随机推荐

  1. 三:robotframework框架配合selenium之jquery定位

    RF框架我用的比较多,限于自己的代码水平,目前工作中一直是用RF框架.unittest框架,我也练习了很久,还差一点封装的技巧与设计模式的学习.所以不敢在项目中实践. 等明年我的代码水平再上升一个台阶 ...

  2. selenium之 文件上传所有方法整理总结

    本文转载“灰蓝”的原创博客.http://blog.csdn.net/huilan_same/article/details/52439546 文件上传是所有UI自动化测试都要面对的一个头疼问题,今天 ...

  3. Windows驱动_WFP之一WFP是什么

    现在的网络安全问题,越来越受到重视,微软在VISTA以后,使用了WFP平台来代替之前XP和03中的基于包过滤的技术,比如Transport Driver Interface(TDI)过滤,Networ ...

  4. hibernate使用手写sql以及对结果list的处理

    Session sees=simpleDAO.getSessionFactory().openSession(); String sql = "select * from fhcb_08_t ...

  5. django 重写用户模型 AbstractBaseUser

    https://blog.csdn.net/weixin_40744265/article/details/80745652

  6. try-with-resources 让java资源关闭代码更简洁

    一.JDK7的资源关闭方式优化 1 try-with-resource语法 在JDK7以前,Java没有自动关闭外部资源的语法特性,直到JDK7中新增了try-with-resource语法,才实现了 ...

  7. Mysql DBA

    1 mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `tb_co ...

  8. CodeForces-1249C2-Good Numbers (hard version) -巧妙进制/暴力

    The only difference between easy and hard versions is the maximum value of n. You are given a positi ...

  9. js导出复杂表头(多级表头)的excel

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. 7-MySQL-Ubuntu-操作数据表的基本操作(二)

    修改数据表的结构 (1)向数据表中添加新的字段 alter table 表名 add 字段名 类型及约束;  (2)修改字段的属性(字段的数据类型和约束) 注:modify不能修改字段名,只能修改字段 ...