Have meal

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 756    Accepted Submission(s): 507

Problem Description
I
have been in school for several years, so I have visited all messes
here. Now I have lost intersts in all of the foods. So when during the
meal time, I don’t know which mess I should go to. So I came up with a
solution.
There are 4 messes in our school, I number them from 0 to
3. Then I says “Big Bing Small Jiang, Point Who Is Who!”, when I say the
first word I point to the mess which is numbered 0, when I say the i-th
(i>1) word I point to the mess whose number is one larger than the
previous one. In case of the number of previous mess is 3, I will point
to 0 again. I will go to the mess which I point to last time. Thus in
this case I will go to the mess which is numbered 3. The following table
explains the course of my solution to this case.
 Word I say Mess id I point to Big 0 Bing 1 Small 2 Jiang 3 Point 0 Who 1 Is 2 Who 3
I
will go to university after several days, I have heard that there are
so many messes in it. So I will apply my solution again. Surpose there
are n messes which are numberd through 0 to n-1, and I will say m words.
When I say the first word I point to the mess which is numbered 0, when
I say the i-th (i>1) word I point to the mess whose number is one
larger than the previous one. In case of the number of previous mess is
n-1, I will point to 0 again. I will go to the mess which I point to
last time. So which mess will I point to?.
It is so time-consuming to count it through manual work. So I want you to write a program to help me. Would you help me?
 
Input
Multi test cases (about 10000), every case contain two integers n and m in a single line.

[Technical Specification]
1<=n, m<=100

 
Output
For each case, output the number of the mess which I should go to.
 
Sample Input
4 3
1 100
 
Sample Output
2
0
 
Source
 
题意:有n个菜(编号0-n-1),现在有一个人点菜,他点菜的规则是念m个单词,然后按照循环顺序数这n个菜,问最后会点到哪个菜??
#include<stdio.h>
#include<iostream>
#include<string.h>
#include <stdlib.h>
#include<math.h>
#include<algorithm>
#include <queue>
using namespace std;
typedef long long LL; int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF){
int t = m%n;
if(t==) printf("%d\n",n-);
else printf("%d\n",t-);
}
return ;
}

hdu 5158(水题)的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. HDU 5391 水题。

    E - 5 Time Limit:1500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  3. hdu 1544 水题

    水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...

  4. HDU排序水题

    1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...

  5. hdu 2710 水题

    题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...

  6. Dijkstra算法---HDU 2544 水题(模板)

    /* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...

  7. hdu 5162(水题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...

  8. hdu 3357 水题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...

  9. hdu 5038 水题 可是题意坑

    http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数  这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心  If not all ...

随机推荐

  1. 7.Mongodb安全性流程

    1.安全性流程 2.超级管理员 为了更安全的访问mongodb,需要访问者提供用户名和密码,于是需要在mongodb中创建用户 采用了角色-用户-数据库的安全管理方式 常用系统角色如下: root:只 ...

  2. 将list中的元素按照属性分类成树状的map

    技术交流群: 233513714 public LinkedHashMap<String, List<TPhoneModel>> queryPhoneList(List< ...

  3. Eclipse 工作空间(Workspace)---Eclipse教程第07课

    Eclipse 工作空间(Workspace) eclipse 工作空间包含以下资源: 项目 文件 文件夹 项目启动时一般可以设置工作空间,你可以将其设置为默认工作空间,下次启动后无需再配置: 工作空 ...

  4. Hadoop 原理总结

    Hadoop 原理总结   一.Hadoop技术原理 Hdfs主要模块:NameNode.DataNode Yarn主要模块:ResourceManager.NodeManager 常用命令: 1)用 ...

  5. Android学习记录(9)—Android之Matrix的用法

    Matrix ,中文里叫矩阵,高等数学里有介绍,在图像处理方面,主要是用于平面的缩放.平移.旋转等操作. 首先介绍一下矩阵运算.加法和减法就不用说了,对应位相加就好.图像处理,主要用到的是乘法 .下面 ...

  6. nginx清除反向代理缓存

    nginx重启无法清除反向代理的缓存,可以清空安装目录下的proxy_cache文件夹里的内容来清除.

  7. Python列表深浅复制详解

    转自:https://www.cnblogs.com/blaomao/p/7239203.html 在文章<Python 数据类型>里边介绍了列表的用法,其中列表有个 copy() 方法, ...

  8. HA集群基本概念详解

    一.高可用集群的定义 二.高可用集群的衡量标准 三.高可用集群的层次结构 四.高可用集群的分类 五.高可用集群常用软件 六.共享存储 七.集群文件系统与集群LVM 八.高可用集群的工作原理 一.高可用 ...

  9. string 与 byte[] 互转时的注意事项

    1.string 转 byte[] //为UTF8编码 byte[] midbytes=isoString.getBytes("UTF8"); //为ISO-8859-1编码,其中 ...

  10. ocrosoft Contest1316 - 信奥编程之路~~~~~第三关 问题 J: 外币兑换

    http://acm.ocrosoft.com/problem.php?cid=1316&pid=9 题目描述 小明刚从美国回来,发现手上还有一些未用完的美金,于是想去银行兑换成人民币.可是听 ...