A. Eating Soup
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard 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 have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are at the party, sitting in a circle and eating soup. The rules are simple: anyone having finished their soup leaves the circle.
    Katie suddenly notices that whenever a cat leaves, the place where she was sitting becomes an empty space, which means the circle is divided into smaller continuous groups of cats sitting next to each other. At the moment Katie observes, there are m cats who left the circle. This raises a question for Katie: what is the maximum possible number of groups the circle is divided into at the moment?Could you help her with this curiosity?You can see the examples and their descriptions with pictures in the “Note” section.
    Input
    The only line contains two integers n and m (2≤n≤1000, 0≤m≤n) — the initial number of cats at the party and the number of cats who left the circle at the moment Katie observes, respectively.
    Output
Print a single integer — the maximum number of groups of cats at the moment Katie observes.
    Examples
    inputCopy
    7 4
    outputCopy
    3
    inputCopy
    6 2
    outputCopy
    2
    inputCopy
    3 0
    outputCopy
    1
    inputCopy
    2 2
    outputCopy
    0
    题意:题目的意思就是说,有n只猫,围在一起喝汤,喝完了就可以走m只,最后可以围成的多少组
    思路:当一只猫都没走的时候,还是一圈只有一个组;
            当剩下的猫大于走的猫的时候,这时候能围成m组;
            当剩下的猫小于走的猫的时候,这时候能围成n-m组;
            水题一道,哎,特此记录一下

 #include"iostream"
#include"algorithm"
#include"cstdio"
#include"cstring"
#include"string.h"
using namespace std;
int main(){
int n,m;
while(cin>>n>>m){
if(m==)
cout<<""<<endl;
else if(n-m>=m)
cout<<m<<endl;
else
cout<<n-m<<endl;
}
return ;
}
//不要脸的贴个网上代码
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main()
{
cin>>n>>m;
cout<<min(n-m,max(,m));
}

水题Eating Soup的更多相关文章

  1. BZOJ USACO 银组 水题集锦

    最近刷银组刷得好欢快,好像都是水题,在这里吧他们都记录一下吧(都是水题大家一定是道道都虐的把= =)几道比较神奇的题到时再列出来单独讲一下吧= =(其实我会说是BZOJ蹦了无聊再来写的么 = =) [ ...

  2. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  3. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  4. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  5. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  6. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  7. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  8. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  9. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

随机推荐

  1. 1级搭建类105-Oracle 19c 单实例 FS(19.3+RHEL 8)公开

    项目文档引子系列是根据项目原型,制作的测试实验文档,目的是为了提升项目过程中的实际动手能力,打造精品文档AskScuti. 项目文档引子系列目前不对外发布,仅作为博客记录.如学员在实际工作过程中需提前 ...

  2. Pikachu-php反序列化

    在理解这个漏洞前,你需要先搞清楚php中serialize(),unserialize()这两个函数. 序列化serialize()序列化说通俗点就是把一个对象变成可以传输的字符串,比如下面是一个对象 ...

  3. Fiddler抓取https方法

    基本配置 菜单 -> menu -> tool -> https 勾选"捕获https连接" 勾选"捕获https流量" 勾选"检查 ...

  4. Flutter简易顶部导航

    因为在AppBar的bottom参数中返回TabBar在平板模式的对齐模式是居中的且不可调整,所有将TabBar在title中返回 import 'package:flutter/material.d ...

  5. day:3.9基础复习

    1.不要在模块之间相互调用,否则会出现麻绳现象,避免循环导入. ==:用来判断值是否相等(分别指向两个空间,但是空间里面的内容相同) is:判断指向是否相等. 例: a=[,,] b=[,,] a== ...

  6. python开发第四篇:函数(1)

    函数 阅读目录 一 函数知识体系 二 函数基础 三 函数对象.函数嵌套.名称空间与作用域.装饰器 四 迭代器.生成器.面向过程编程 五 三元表达式.列表推导式.生成器表达式.递归.匿名函数.内置函数 ...

  7. centos8 ftp

    安装 yum install -y vsftpd 启动 systemctl start vsftpd.service 开机启动 systemctl enable vsftpd.service 查看状态 ...

  8. PP: Neural tensor factorization

    relational data. Neural collaborative filtering and recurrent recommender systems have been successf ...

  9. 55.ORM外键:引用同app下的不同模型,引用不同app下的模型,引用模型自身使用详解

    外键和表关系 外键是属于数据库级别的,在MySQL中,表有两种引擎,一种是InnoDB,另外一种是myisam.如果使用的是InnoDB引擎,是支持外键约束的.外键的存在使得ORM框架在处理表关系的时 ...

  10. 打开UML类图的正确姿势

    UML(Unified Modeling Language) 统一建模语言,又称标准建模语言.是用来对软件密集系统进行可视化建模的一种语言.UML的定义包括UML语义和UML表示法两个元素.UML是在 ...