KazaQ's Socks HDU
来源:互联网 发布:mac版ps存储快捷键 编辑:程序博客网 时间:2024/06/05 16:52
KazaQ wears socks everyday.
At the beginning, he hasn 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 aren−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 -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
Case #1: 3Case #2: 1Case #3: 2
找规律 模拟
#include <stdio.h>typedef long long ll;int main() {ll n , k , m , m1 , m2;int Case = 1;while(~scanf("%lld%lld",&n,&k)) {if(k <= n) m = k;else {m = k - n;m1 = m/(n-1);m2 = m%(n-1);if(m2) {if(m1%2) {m = m2;}else{if(m2 == n-1) m = n;else m = m2;}}else {if(m1%2) m = n-1;else m = n;}}printf("Case #%d: %d\n",Case++,m);}return 0;}
阅读全文
0 0
- HDU-KazaQ's Socks
- KazaQ's Socks HDU
- HDU 6043 KazaQ's Socks
- hdu 6043 KazaQ's Socks
- HDU 6043 KazaQ's Socks
- HDU 6043 KazaQ's Socks
- HDU 6043 KazaQ's Socks 找规律
- HDU 6043 KazaQ's Socks 【规律】
- HDU 6043 KazaQ's Socks(周期)
- HDU 6043 KazaQ's Socks【规律】
- HDU 6043 KazaQ's Socks(水~)
- (数学)HDU 6043 KazaQ's Socks
- hdu 6043 KazaQ's Socks(规律)
- KazaQ's Socks
- KazaQ's Socks
- KazaQ's Socks
- 1011.KazaQ's Socks
- hdu6043--KazaQ's Socks
- CF_17C Balance
- Java方法参数及其传递
- Windows环境下使用CMake编译OpenCV3.0和OpenCV_contrib
- 自测01—打印沙漏
- AOSP 安卓源码-ubuntu开发环境搭建
- KazaQ's Socks HDU
- 调整数组使奇数全部都位于偶数前面
- MVC中Form表单标签
- Linq详细介绍
- 第9周项目3 利用二叉树遍历思想解决问题(1)
- python大作战之排序
- Unity添加Vungle广告的方式
- 数据结构专题——线性表之双链表及其Java实现
- 10/29 运维考试题目