WUSTOJ 1327: Lucky Numbers(Java)
题目链接:1327: Lucky Numbers
Description
A lucky number is made by the following rules:
Given a positive integer sequence {x | 1 <= x <= n}. From the first number, delete the last one in every 2 numbers. Select the minimum that has not been unused from the rest numbers. This number is xi. Then delete the last number in every xi numbers.
幸运数字由以下规则制定:
给定正整数序列{x | 1 <= x <= n}。 从第一个数字中删除每2个数字中的最后一个。 从剩余数字中选择尚未使用的最小值。 这个数字是xi。 然后删除每个xi编号中的最后一个数字。
Input
There are several test cases, ended by the end of file.
Each test case has a positive integer n.(3<=n<=10000)
Output
Output the number of lucky numbers in one line.
在一行输出幸运数字的个数。
Sample Input
20
30
Sample Output
6
8
HINT
eg.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
For the first time, delete the last number in every two numbers. The sequence become 1 3 5 7 9 11 13 15 17 19
For the second time, the minimum number that has never been used is 3. Delete the last number in every 3 numbers. The sequence become 1 3 7 9 13 15 19
For the third time, the minimum number that has never been used is 7. Delete the last number in every 7 numbers. The sequence becomes 1 3 7 9 13 15.
Then you cannot delete any numbers. There are 6 numbers left over. So the answer is 6.
例如:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
显然不能每 1 个数删除 1 个,那就无意义了。
第一次,删除每 2 个数字中的最后一个数字。 序列变为1 3 5 7 9 11 13 15 17 19
第二次,删除每 3 个数字中的最后一个数字。 序列变为1 3 7 9 13 15 19
第三次,删除每 7 个数字中的最后一个数字。 序列变为1 3 7 9 13 15。
分析
WUSTOJ 1327: Lucky Numbers(Java)的更多相关文章
- WUSTOJ 1336: Lucky Boy(Java)博弈
题目链接:1336: Lucky Boy 参考博客:LUCKY BOY 博弈--HandsomeHow Description Recently, Lur have a good luck. He i ...
- WUSTOJ 1324: Base64 Coding(Java)未解决,求题解
题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...
- WUSTOJ 1346: DARK SOULS(Java)并查集
题目链接:1346: DARK SOULS 并查集系列:WUSTOJ 1319: 球(Java)并查集 Description CQ最近在玩一款游戏:DARK SOULS,这是一款以高难度闻名的硬派动 ...
- WUSTOJ 1246: 字符串排序(Java)
1246: 字符串排序 题目 输入n(n<100)个字符串,每个字符串长度不超过1000,将他们按字典顺序输出.更过内容点击标题. 分析 Java中的ArrayList()可以比较方便的 ...
- HDU 5676 ztr loves lucky numbers (模拟)
ztr loves lucky numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/I Description ztr ...
- WUSTOJ 1323: Repeat Number(Java)规律统计
题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...
- WUSTOJ 1251: 报数游戏(Java)
1251: 报数游戏 原题链接 Description n个人站成一行玩一个报数游戏.所有人从左到右编号为1到n.游戏开始时,最左边的人报1,他右边的人报2,编号为3的人报3,等等.当编号为n的人(即 ...
- LeetCode Two Add Two Numbers (JAVA)
问题简介:输入两个数字链表,输出求和后的链表(链表由数字位数倒序组成) 问题详解: 给定两个非空链表,表示两个非负整数. 数字以相反的顺序存储,每个节点包含一位数字.对两个整数作求和运算,将结果倒序作 ...
- WUSTOJ 1339: 土豪fcbruce(Java)
题目链接:1339: 土豪fcbruce Description 10年后,就职于Google的fcbruce赞助了武汉科技大学好多钱,学校因此决定扩建.第一步是新建宿舍楼,为了整洁美观,fcbruc ...
随机推荐
- 深度学习面试题29:GoogLeNet(Inception V3)
目录 使用非对称卷积分解大filters 重新设计pooling层 辅助构造器 使用标签平滑 参考资料 在<深度学习面试题20:GoogLeNet(Inception V1)>和<深 ...
- arcgis python 异常处理
import arcpy in_features = "c:/base/transport.gdb/roads" try: # Note: CopyFeatures will al ...
- 【转】iPhone手机获取uuid 安装测试app
iPhone手机获取uuid 安装测试app UDID是一种iOS设备的特殊识别码.除序号之外,每台ios装置都另有一组独一无二的号码,我们就称之为识别码( Unique Device Identif ...
- GRU和LSTM比较
比较: https://www.jianshu.com/p/3774d46b665e https://blog.csdn.net/sinat_33741547/article/details/8282 ...
- 为什么说基于TCP的移动端IM仍然需要心跳保活?(转)
源:https://segmentfault.com/a/1190000006832547 为什么说基于TCP的移动端IM仍然需要心跳保活?
- CentOS 7 配置 nginx php-fpm 详细教程
CentOS 7 配置 Nginx 的步骤如下: 首先更新 yum,没有安装 yum 的自行安装 yum update 1. 安装 Nginx yum install nginx 开启 Nginx 并 ...
- Docker Error response from daemon: driver failed programming external connectivity on endpoint webserver
按照官网的配置, https://docs.docker.com/docker-for-windows/ 当执行到第 5 步时 如果当前你的电脑 80 端口已经被别的程序占用,运行以上命令就会报错,报 ...
- autoComplete TextView
这个比较简单,只是将AutoCompleteTextView绑定一个ArrayAdapter就可以了. 界面布局: <?xml version="1.0" encoding= ...
- 2018 遇到selenium.common.exceptions.WebDriverException问题
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PAT ...
- pip 安装指定版本
pip在安装包的时候可以不需要从网上下载,以windows的scipy为例 pip install scipy==0.15.1 以上表示安装0.15.1版本的scipy,这里用”==”接版本,如果权限 ...
题目链接:1336: Lucky Boy 参考博客:LUCKY BOY 博弈--HandsomeHow Description Recently, Lur have a good luck. He i ...
题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...
题目链接:1346: DARK SOULS 并查集系列:WUSTOJ 1319: 球(Java)并查集 Description CQ最近在玩一款游戏:DARK SOULS,这是一款以高难度闻名的硬派动 ...
1246: 字符串排序 题目 输入n(n<100)个字符串,每个字符串长度不超过1000,将他们按字典顺序输出.更过内容点击标题. 分析 Java中的ArrayList()可以比较方便的 ...
ztr loves lucky numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/I Description ztr ...
题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...
1251: 报数游戏 原题链接 Description n个人站成一行玩一个报数游戏.所有人从左到右编号为1到n.游戏开始时,最左边的人报1,他右边的人报2,编号为3的人报3,等等.当编号为n的人(即 ...
问题简介:输入两个数字链表,输出求和后的链表(链表由数字位数倒序组成) 问题详解: 给定两个非空链表,表示两个非负整数. 数字以相反的顺序存储,每个节点包含一位数字.对两个整数作求和运算,将结果倒序作 ...
题目链接:1339: 土豪fcbruce Description 10年后,就职于Google的fcbruce赞助了武汉科技大学好多钱,学校因此决定扩建.第一步是新建宿舍楼,为了整洁美观,fcbruc ...
目录 使用非对称卷积分解大filters 重新设计pooling层 辅助构造器 使用标签平滑 参考资料 在<深度学习面试题20:GoogLeNet(Inception V1)>和<深 ...
import arcpy in_features = "c:/base/transport.gdb/roads" try: # Note: CopyFeatures will al ...
iPhone手机获取uuid 安装测试app UDID是一种iOS设备的特殊识别码.除序号之外,每台ios装置都另有一组独一无二的号码,我们就称之为识别码( Unique Device Identif ...
比较: https://www.jianshu.com/p/3774d46b665e https://blog.csdn.net/sinat_33741547/article/details/8282 ...
源:https://segmentfault.com/a/1190000006832547 为什么说基于TCP的移动端IM仍然需要心跳保活?
CentOS 7 配置 Nginx 的步骤如下: 首先更新 yum,没有安装 yum 的自行安装 yum update 1. 安装 Nginx yum install nginx 开启 Nginx 并 ...
按照官网的配置, https://docs.docker.com/docker-for-windows/ 当执行到第 5 步时 如果当前你的电脑 80 端口已经被别的程序占用,运行以上命令就会报错,报 ...
这个比较简单,只是将AutoCompleteTextView绑定一个ArrayAdapter就可以了. 界面布局: <?xml version="1.0" encoding= ...
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PAT ...
pip在安装包的时候可以不需要从网上下载,以windows的scipy为例 pip install scipy==0.15.1 以上表示安装0.15.1版本的scipy,这里用”==”接版本,如果权限 ...