HDU6043 KazaQ's Socks
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 <algorithm>
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <ctype.h> using namespace std; int main()
{
long long int n,k,cnt=;
while(cin>>n>>k)
{
if(n>=k)
cout<<"Case #"<<cnt++<<": "<<k<<endl;
else
{
int a=(k-n)/(n-),b=(k-n)%(n-);
if(b!=)
cout<<"Case #"<<cnt++<<": "<<b<<endl;
else
{
if(a%==)
cout<<"Case #"<<cnt++<<": "<<n<<endl;
else
cout<<"Case #"<<cnt++<<": "<<n-<<endl;
}
}
}
return ;
}
HDU6043 KazaQ's Socks的更多相关文章
- 【多校联合】(HDU6043)KazaQ's Socks
[多校联合](HDU6043)KazaQ's Socks 一条纯粹的水题,记录下只是因为自己错的太多而已. 原因在于对数据的细节的把握不佳. 原题 KazaQ's Socks Time Limit: ...
- HDU6043 17多校1 KazaQ's Socks 水题
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6043 Problem Description KazaQ wears socks everyday. ...
- 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 ...
- 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 ...
- 2017 Multi-University Training Contest - Team 1 KazaQ's Socks
Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbered f ...
- HDU 6043 - KazaQ's Socks | 2017 Multi-University Training Contest 1
/* HDU 6043 - KazaQ's Socks [ 找规律 ] | 2017 Multi-University Training Contest 1 题意: 一共 n 双袜子编号 1~n,每天 ...
- KazaQ's Socks (找规律)
#include<iostream> using namespace std; #define ll long long ll n, m; ll t; int main(){ while ...
随机推荐
- ionic3 环境配置 + 運行第一個項目
1.首先我們先下載個 nodejs安裝包 地址:https://nodejs.org/en/ 安裝 檢查是否安裝成功,打開命令提示符 輸入 node -v 回車 查看版本 結果: 2.安裝ionic ...
- 我的第一个Java程序
我的第一个Java程序: class Test{ public static void main(String[] args) { System.out.println(" ...
- JavaScript面向对象之Windows对象
JavaScript之Window对象 首先我们先了解一个概念:事件. 事件,就是把一段代码设置好,满足条件时触发.或者说,事件是可以被 JavaScript 侦测到的行为. 网页中每个元素都可以触发 ...
- [0] 解决版本冲突-使用SVN主干与分支功能
解决版本冲突-使用SVN主干与分支功能 1 前言 大多数产品开发存在这样一个生命周期:编码.测试.发布,然后不断重复.通常是这样的开发步骤: 1) 开发人员开发完毕某一版本(如版本A)功能后, ...
- 【知识整理】这可能是RxJava 2.x 最好的入门教程(一)
一.前言 RxJava 对大家而言肯定不陌生,其受欢迎程度不言而喻.而在去年的早些时候,官方便宣布,将在一段时间后不再对 RxJava 1.x 进行维护,而在仓库中另辟蹊径,开始对 RxJava 2. ...
- IBM的人工智能“沃森”首次确诊罕见白血病,只用了10分钟!
患者为一名60岁的女性,最初根据诊断结果,显示她患了急髓白血病.但在经历各种疗法后,效果并不明显. 根据东大医学院研究人员Arinobu Tojo的说法,他们利用Watson系统来对此病人进行诊断.系 ...
- jquery删除表格行
$(".mingxirmspan").click(function(){ $(this).closest("tr").remove(); })
- Python 编码错误的本质原因
转载自:https://foofish.net/python-unicode-error.html 不论你是有着多年经验的 Python 老司机还是刚入门 Python 不久的新贵,你一定遇到过Uni ...
- shell中source与sh区别
shell中使用source conf.sh,是直接运行conf.sh的命令,不创建子shell,类似与html中include,而sh是则创建子shell, 子shell里面 的变量父shell无法 ...
- 什么是VPN,VPN有什么用,怎么获得VPN
什么是VPN? VPN英文全称是“Virtual Private Network”,翻译过来就是“虚拟专用网络”.vpn被定义为通过一个公用网络(通常是因特网)建立一个临时的.安全的连接,是一条穿过混 ...