HDU 多校联合 6033 6043
http://acm.hdu.edu.cn/showproblem.php?pid=6033
Add More Zero
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 449 Accepted Submission(s): 319
Nowadays,
he is preparing a thought-provoking problem on a specific type of
supercomputer which has ability to support calculations of integers
between 0 and (2m−1) (inclusive).
As a young man born with ten fingers, he loves the powers of 10 so much, which results in his eccentricity that he always ranges integers he would like to use from 1 to 10k (inclusive).
For
the sake of processing, all integers he would use possibly in this
interesting problem ought to be as computable as this supercomputer
could.
Given the positive integer m, your task is to determine maximum possible integer k that is suitable for the specific supercomputer.
64
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int main()
{
int m;
int cast=;
while(scanf("%d",&m)!=EOF)
{
printf("Case #%d: %0.f\n",++cast,floor(m*1.0*log(2.0)/log(10.0)));//floor 向下取整
}
return ;
}
KazaQ's Socks
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 389 Accepted Submission(s): 246
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 <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
//前n天顺序出现,后来前n-2天顺序出现,n-1,n交替出现
//1.2.3.4.1.2.3.1.2.4.1.2.3.1.2.4........
int main()
{
ll n,m,cast=,ans;
while(scanf("%lld%lld",&n,&m)!=EOF)
{
printf("Case #%lld: ",++cast);
if(m<=n) printf("%lld\n",m);
else
{
ans=(m-n)/(n-)%;
if((m-n)%(n-)==) printf("%lld\n",ans==?n-:n);
else printf("%lld\n",(m-n)%(n-));
}
}
return ;
}
HDU 多校联合 6033 6043的更多相关文章
- HDU 多校联合练习赛2 Warm up 2 二分图匹配
Warm up 2 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total ...
- HDU 多校联合 6045
Is Derek lying? Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- hdu 5288||2015多校联合第一场1001题
pid=5288">http://acm.hdu.edu.cn/showproblem.php?pid=5288 Problem Description OO has got a ar ...
- HDU 5792---2016暑假多校联合---World is Exploding
2016暑假多校联合---World is Exploding Problem Description Given a sequence A with length n,count how many ...
- 2016暑假多校联合---Windows 10
2016暑假多校联合---Windows 10(HDU:5802) Problem Description Long long ago, there was an old monk living on ...
- hdu5379||2015多校联合第7场1011 树形统计
pid=5379">http://acm.hdu.edu.cn/showproblem.php? pid=5379 Problem Description Little sun is ...
- 2016暑假多校联合---Rikka with Sequence (线段树)
2016暑假多校联合---Rikka with Sequence (线段树) Problem Description As we know, Rikka is poor at math. Yuta i ...
- 2016暑假多校联合---Substring(后缀数组)
2016暑假多校联合---Substring Problem Description ?? is practicing his program skill, and now he is given a ...
- 2016暑假多校联合---To My Girlfriend
2016暑假多校联合---To My Girlfriend Problem Description Dear Guo I never forget the moment I met with you. ...
随机推荐
- File的getPath()和getAbsolutePath()和getCanonicalPath()的差别
这几个方法是有一次无意的发现,我当时也不知道什么意思,就百度了,查到了一些列子: 原文地址http://www.blogjava.net/dreamstone/archive/2007/08/08/1 ...
- 如何组织CSS?
前端工程师在开发一个单页面或者小网站的时候有可能不会在意CSS的组织问题,但如果要开发一个中大型的网站,就要好好的组织CSS文件,不然会增加维护成本,整个网站的结构也没条理性. 如何组织CSS?一般常 ...
- POJ 1459 最大流 第二题
http://poj.org/problem?id=1459 也是网络流的基础,只是虚拟出一个源点和终点,对应的生产值和消费值就加到与源点和终点的边上,然后做一次bfs就好了. #include &l ...
- XML之序列化C#实体类,DataTable,List
1. static void Main(string[] args) { #region 实体类 Request patientIn = new Request(); patientIn.System ...
- vue.js路由vue-router(一)——简单路由基础
前言 vue.js除了拥有组件开发体系之外,还有自己的路由vue-router.在没有使用路由之前,我们页面的跳转要么是后台进行管控,要么是用a标签写链接.使用vue-router后,我们可以自己定义 ...
- JS的解析与执行过程—全局预处理阶段之全局词法环境对象
问题:有如下代码 var a = 1; function pop() { alert(a); var a = 5; } pop();//执行结果,弹出undefined 这段代码的执行结果为undef ...
- 学习NLP:《精通Python自然语言处理》中文PDF+英文PDF+代码
自然语言处理是计算语言学和人工智能之中与人机交互相关的领域之一. 推荐学习自然语言处理的一本综合学习指南<精通Python自然语言处理>,介绍了如何用Python实现各种NLP任务,以帮助 ...
- promise的弊端
promise的弊端 promise彻底解决了callback hell,但也存在以下一些问题 延时问题(涉及到evnet loop)(http://www.ruanyifeng.com/blog/2 ...
- 基于zookeeper实现分布式配置中心(二)
上一篇(基于zookeeper实现分布式配置中心(一))讲述了zookeeper相关概念和工作原理.接下来根据zookeeper的特性,简单实现一个分布式配置中心. 配置中心的优势 1.各环境配置集中 ...
- UVALive 6867 Plane Ticket Pricing
Plane Ticket Pricing Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu ...