HDU6043 17多校1 KazaQ's Socks 水题
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6043
At the beginning, he has n pairs of socks numbered from 1 to n in his closets.
Every morning, he puts on a pair of socks which has the smallest number in the closets.
Every evening, he puts this pair of socks in the basket. If there are n−1 pairs of socks in the basket now, lazy KazaQ has to wash them. These socks will be put in the closets again in tomorrow evening.
KazaQ would like to know which pair of socks he should wear on the k-th day.
For each case, there is a line contains two numbers n,k (2≤n≤109,1≤k≤1018).
#include<iostream>
#include<cstdio> using namespace std; int main()
{
int t=;
long long n,k,res;
while(~scanf("%lld%lld",&n,&k))
{
if(k<=n)
{
res=k;
}
else
{
k-=n;
int q=k%(n-);
if(q==)
if(k/(n-)%==)
res=n;
else
res=n-;
else
res=q;
}
printf("Case #%d: %lld\n",t++,res);
}
return ;
}
HDU6043 17多校1 KazaQ's Socks 水题的更多相关文章
- 17 多校1 Add More Zero 水题
Problem Description There is a youngster known for amateur propositions concerning several mathemati ...
- HDU 6140 17多校8 Hybrid Crystals(思维题)
题目传送: Hybrid Crystals Problem Description > Kyber crystals, also called the living crystal or sim ...
- 2019浙大校赛--E--Potion(签到水题)
一丢丢思维就ok 题目大意: 魔法师要煮药,有n个等级的药,所需要的药物为a1,a2...an,意为第n级需要多少药物,下一行为库存的不同等级药物,药物可降级使用不可升级. 思路:从高级药物开始解,把 ...
- 【多校联合】(HDU6043)KazaQ's Socks
[多校联合](HDU6043)KazaQ's Socks 一条纯粹的水题,记录下只是因为自己错的太多而已. 原因在于对数据的细节的把握不佳. 原题 KazaQ's Socks Time Limit: ...
- HDU6043 KazaQ's Socks
Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbered f ...
- 2017ACM暑期多校联合训练 - Team 1 1011 HDU 6043 KazaQ's Socks (找规律)
题目链接 Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbe ...
- HDU 6043 KazaQ's Socks (规律)
Description KazaQ wears socks everyday. At the beginning, he has nn pairs of socks numbered from 11 ...
- 2017 Multi-University Training Contest - Team 1 1011&&HDU 6043 KazaQ's Socks【规律题,数学,水】
KazaQ's Socks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
- 杭电 KazaQ's Socks
KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbered from 1 to n in his cl ...
随机推荐
- input事件在ie9以下不兼容问题完美解决
上周四好不容易加了几天班把刚接手的一个pc页面做完,周五同事说要兼容ie7~ie9,结果在上面一跑,输入都没法输入. 我的需求是用6个span作为虚拟的密码输入框,实际上是用一个藏在页面里的input ...
- 11. Container With Most Water C++
知识点:双指针遍历大大减少不必要的比较和计算 方法1:Brute Force(执行时间惨不忍睹,共进行n(n-1)/2次比较) class Solution { public: int maxArea ...
- 在ubuntu14中搭建邮箱服务器
1.前提准备 1.1在服务器上安装ubuntu14 1.2为ubuntu14配置静态ip 使用命令 sudo vim /etc/network/interfaces打开配置文件 修改内容如下: 使用命 ...
- 有关String的一些方法的使用
1.String字符串是引用数据类型. 2.String是常量,如果看到给String进行赋值的情况,是说明将该String的地址进行改变了. 3.String的一些常用的方法 toUpperCase ...
- java 中多播、广播编程
在 IP 协议层,有多播.广播的概念.IP 地址分为网络地址和主机地址,主机地址全部为1,就是广播地址.多播使用 D 类地址,从 224.0.0.0 到 239.255.255.255.IP 多播需要 ...
- npm run dev 报错 版本太低
解决方案是: 先用命令: npm -v 查看下你的版本(我原来是 V3.1 不行) 然后用 cnpm install -g npm 更新版本 npm - v 变成最新的4.0.4 npm run d ...
- elasticsearch在CentOS环境下开机启动
验证环境,OS版本:CentOS-7-x86_64-Minimal-1708:ES版本:elasticsearch-6.2.2. 1.创建文件elasticsearch #!/bin/bash # # ...
- LY.JAVA面向对象编程.内存图
2018-07-06 一个对象的内存图 两个对象的内存图 三个对象的内存图 this static super 向上转型 向下转型
- javascript void函数
<a href="javascript:doTest2();void(0);">here</a> 但这儿的void(0)究竟是何含义呢? Javascrip ...
- 2.python函数编程-filter函数
fileter功能主要使用在需要对数据进行多种操作,并对数据进行过滤的操作. 普通函数实现: movie = ['sb_alex', 'wupei', 'tiger', 'goosb','xxfd', ...