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. 5. css定位 居中

    1.准备工作 (1)添加背景图片 background: url('images/grass.png') (2)背景图片格式 background-size:contain; #完全限制在方框 #co ...

  2. 利用插件对某些网页执行javascript代码

    说明 javascript在浏览器地址栏中可以运行,也可以按F12在控制台中运行,还可以写一个插件让javascript针对某些网页执行,可以使用chrome浏览器的Content scripts,C ...

  3. 孤荷凌寒自学python第三十一天python的datetime.timedelta模块

     孤荷凌寒自学python第三十一天python的datetime.timedelta模块 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) datetime.timedelta模块是一个表示 ...

  4. (原)UE4 制作执行队列(Action Queue)

    队列和树在游戏开发中是比较常见的数据结构,在一定范围能保证执行的顺序. 结合一些设计模式技巧,往往可以做一些神器.     如加载块chunk管理,任务系统(当然也可以使用行为树来做复杂的任务系统). ...

  5. 系统编程--标准IO

    1.流和FILE对象 对于国际字符集,一个字符可以由一个以上的字节来表示.标准I/O文件流可以用来操作单字节和多字节(宽,wide)字符集.一个流的方向(orientation)决定了字符是以单字节还 ...

  6. shell之正则表达式

    正则表达式(regular expression ,REGEXP): 元字符: .:匹配任意单个字符 []:匹配指定范围内的任意单个字符 [^]:匹配指定范围外的任意字符 字符集合:使用[字符集合] ...

  7. UVa 1326 - Jurassic Remains(枚举子集+中途相遇法)

    训练指南p.59 #include <cstdio> #include <cstring> #include <cstdlib> #include <map& ...

  8. 普通用户操作tomcat项目时报:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program

    在使用普通用户更新tomcat项目适合出现这个信息,Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At ...

  9. VS调试时不捕捉Exception

    在方法上添加 [DebuggerHidden] 这样,发生错误的时候,VS就不会捕捉到这个错误,否则,会在错误的地方中断. [DebuggerHidden] public void DeleteAll ...

  10. SimpleMDE编辑器 + 提取HTML + 美化输出

    开发步骤: 1. 安装和引入(npm或者bower都可以) $ bower install simplemde --save //css - debug目录下为开发版本 <link rel=&q ...