KazaQ's Socks
来源:互联网 发布:gtp手机吉他谱软件 编辑:程序博客网 时间:2024/05/29 10:07
KazaQ wears socks everyday.
At the beginning, he hasn n pairs of socks numbered from 1 1 to n 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 aren−1 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 thek k-th day.
At the beginning, he has
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
KazaQ would like to know which pair of socks he should wear on the
For each case, there is a line contains two numbers
3 73 64 9
#include <cstdio>#include <algorithm>using namespace std;int main(){ long long t=1,n,k,a[2]; while(~scanf("%lld %lld",&n,&k)) { a[1]=n-1,a[0]=n; if(k<=n) { printf("Case #%lld: %lld\n",t++,k); } else { k-=n; if(k%(n-1)==0) { long long num=k/(n-1); printf("Case #%lld: %lld\n",t++,a[num%2]); } else printf("Case #%lld: %lld\n",t++,k%(n-1)); } } return 0;}
阅读全文
0 0
- KazaQ's Socks
- KazaQ's Socks
- KazaQ's Socks
- 1011.KazaQ's Socks
- hdu6043--KazaQ's Socks
- HDU6043-KazaQ's Socks
- KazaQ's Socks
- HDU-KazaQ's Socks
- KazaQ's Socks
- KazaQ's Socks
- KazaQ's Socks
- hdu6043 KazaQ's Socks
- KazaQ's Socks
- KazaQ's Socks
- KazaQ's Socks HDU
- 杭电 KazaQ's Socks
- HDU 6043 KazaQ's Socks
- HDU6043 KazaQ's Socks【规律】
- [RK3288][Android6.0] 调试笔记 --- ComponentName的使用
- zzuli2174
- android 关于封装tabbar,任意修改样式
- 购物车AngularJs
- 在GitHub多个帐号上添加SSH公钥
- KazaQ's Socks
- Js中JSON.stringify()、JSON.parse()、eval()详解
- Java-科学计数法 (20)
- idea使用maven创建java web项目
- 实践
- EditText 去掉下划线 仿微信边框 selector
- 回归树和分类树的区别
- 图片的一些相关操作
- 洛谷1563 玩具谜题