vijos- P1385盗窃-月之眼 (水题 + python)
背景
怪盗基德 VS OIBH
第三话
描写叙述
怪盗基德第三次来到熟悉的OIBH总部。屡屡失败的OIBH这次看守的是The Eye of Moon。还是那个
房间。还是那扇门,不同的是OIBH对password锁进行了改进。这次屏幕上仅仅显示一个数n(基德:这是
改进了还是退化了?)。
password生成方法:设集合A中A={1,2,...,n}。B为A子集。
对于B中随意一个元素x,2x均不在集合B中。
B中元素数目最大值即为password。
格式
输入格式
一行,一个整数n(1<=n<=maxlongint)
输出格式
仅仅有一个整数m。表示B中元素最大值
限制
OIBH在6s内就会发现,所以每一个点仅仅有1s时间给你
提示
简单数学题哦~~
来源
From 玛维-影之歌;
感谢vijos的朋友提供数据
对于long long 的数据我们无法用遍历的方法去做仅仅能通过写出关于n的方程组解决这个问题
通过题目我们能够发现
假设我去51-100中的50个人。肯定是符合条件的
我再去13 - 24中的13个人还是符合条件的,如此,不断的递推下去。将全部符合条件的数目加起来就能够了
#!/usr/bin/env python3
# -*- coding: utf-8 -*- def fun(n):
if n == 1:return 1
if n == 0:return 0
ans = fun(n / 2 / 2)
ans += n - n / 2
return ans
import math
n = int(raw_input())
print fun(n)
vijos- P1385盗窃-月之眼 (水题 + python)的更多相关文章
- Contest2037 - CSU Monthly 2013 Oct(中南大学2013年10月月赛水题部分题解)
Problem A: Small change 题解:http://www.cnblogs.com/crazyapple/p/3349469.html Problem B: Scoop water 题 ...
- 【BZOJ】初级水题列表——献给那些想要进军BZOJ的OIers(自用,怕荒废了最后的六月考试月,刷刷水题,水水更健康)
BZOJ初级水题列表——献给那些想要进军BZOJ的OIers 代码长度解释一切! 注:以下代码描述均为C++ RunID User Problem Result Memory Time Code_Le ...
- 水题 ZOJ 3876 May Day Holiday
题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- Atcoder 水题选做
为什么是水题选做呢?因为我只会水题啊 ( 为什么是$Atcoder$呢?因为暑假学长来讲课的时候讲了三件事:不要用洛谷,不要用dev-c++,不要用单步调试.$bzoj$太难了,$Topcoder$整 ...
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar 水题
A. Checking the Calendar 题目连接: http://codeforces.com/contest/724/problem/A Description You are given ...
- HDU 4706 Children's Day (水题)
Children's Day Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- hdu 1201:18岁生日(水题,闰年)
18岁生日 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- Disillusioning #1 水题+原题赛(被虐瞎)
https://vijos.org/tests/542c04dc17f3ca2064fe7718 好一场 水题 比赛啊 t1直接上暴力费用流10分QAQ,虽然一开始我觉得可以不用的,直接dfs可以得出 ...
随机推荐
- How to read a paper efficiently
How to read a paper efficiently Structure of a Journal a Journal Article Title Keywords Abstract Int ...
- Python笔记(十)——操作SQLServer
#encoding=utf-8 # 先通过如下命令安装模块 # pip install --trusted-host pypi.python.org pymssql # pip类似于RedHat里的y ...
- /etc/rsyslog.conf配置文件说明
一.authpriv.* /var/log/secure 服务名称[连接符号]日志等级 日志记录位 ...
- 第4章 部署模式 Three-Tiered Distribution(三级分布)
影响因素 Tiered Distribution 中讨论的影响因素也适用于此模式.有关这些通用影响因素的讨论,请参阅"Tiered Distribution".下列影响因素仅适用于 ...
- 关于生sql中的空值
在数据库中的空值无非就是两种形式的表示 一种是什么都没有,一种是以NuLL显示的 , 那么在C# 读取出来怎么判断呢, DtStatus.Rows[0]["FetchCode"]. ...
- MySQL 5.6 Reference Manual-14.1 Introduction to InnoDB
14.1 Introduction to InnoDB 14.1.1 InnoDB as the Default MySQL Storage Engine 14.1.2 Checking InnoDB ...
- Boost字符串处理
(1):Boost学习之格式化输出--format: 原文链接:http://www.cnblogs.com/lzjsky/archive/2011/05/05/2037327.html 此文非常详细 ...
- auto_ftp_sh
#!/usr/bin/env python # -*- coding:utf-8 -*- import paramiko import time mydate = time.strftime( ...
- Ad_hoc_polymorphism 备份
https://en.wikipedia.org/wiki/Polymorphism_(computer_science) https://en.wikipedia.org/wiki/Ad_hoc_p ...
- Android对手尽皆铩羽,鸿蒙如何绝地求生?
Android对手尽皆铩羽,鸿蒙如何绝地求生? 作为华为绝地反击备胎计划中的重要组成部分,鸿蒙被国人寄予了厚望.但是,除了热情我们更应该理性关注,鸿蒙对决Android未来有几成胜算?还有哪些问题需要 ...