hdu 5158(水题)
Have meal
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 756 Accepted Submission(s): 507
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?
[Technical Specification]
1<=n, m<=100
1 100
0
#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(水题)的更多相关文章
- HDU-1042-N!(Java大法好 && HDU大数水题)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Subm ...
- HDU 5391 水题。
E - 5 Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 1544 水题
水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...
- HDU排序水题
1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...
- hdu 2710 水题
题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...
- Dijkstra算法---HDU 2544 水题(模板)
/* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...
- hdu 5162(水题)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...
- hdu 3357 水题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...
- hdu 5038 水题 可是题意坑
http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数 这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心 If not all ...
随机推荐
- ImageButton的坑 ImageButton 有问题
最近在用ImageButton,发现,我如果new ImageButton,并且 设置Warp_content,但是它并不会正真的warp,它会有一个边框. 不知道怎么回事. 后来,在代码里面使用Im ...
- 自动化测试环境搭建--Python及selenium
安装pyhton 访问Python官网:http://www.python.org 下载页Windows下找到适合64位系统的版本 下载后双击安装 安装后查看计算机->属性->高级系统设置 ...
- python中subprocess.Popen执行命令并持续获取返回值
先举一个Android查询连接设备的命令来看看Python中subprocess.Popen怎么样的写法.用到的命令为 adb devices. import subprocess order='ad ...
- Python全栈工程师 (exercises)
# 1:给定一个数,判断他是正数,负数,还是0 a = int(input("请输入一该个整数")) if a == 0: print(a, "是0") eli ...
- java开发环境的安装
1.Java是一门面向对象的编程语言,由sun公司开发的,目前公司已经被oracle公司收购.那么作为一门编程语言,它有自己的编程环境.并不是你编写了java代码后,就能在任何平台上运行,它的运行有自 ...
- Nginx出现500错误解决办法
查看错误日志D:\nginx\logs\error.log 得知:Nginx配置文件中会将路径中的 \t 默认转义成 空格 改为双斜杠就可以了
- InfluxDB执行语句管理(query management)
本文属于<InfluxDB系列教程>文章系列,该系列共包括以下 17 部分: InfluxDB学习之InfluxDB的基本概念 InfluxDB学习之InfluxDB的基本操作 Influ ...
- Spring 事件机制
通过模拟邮件的发送,说明Spring的事件监听机制 事件类 package org.zln.module_chapter2.event; import org.springframework.cont ...
- 【bzoj3669】[Noi2014]魔法森林 Kruskal+LCT
原文地址:http://www.cnblogs.com/GXZlegend/p/6797748.html 题目描述 为了得到书法大家的真传,小E同学下定决心去拜访住在魔法森林中的隐士.魔法森林可以被看 ...
- Linux命令 -磁盘和文件系统类
声明:本文所涉及到的Linux命令均为最常见的用法,未列举之参数,自行查阅man 1.df 磁盘容量 -h 以人类易读方式展示(GB.KB)等 df -h /usr 2.du 文件或目录的容量 -s ...