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 ;
}
最新文章
- MyBatis的resultMap
- Android开发学习清单
- 用extern定义全局变量
- js的隐含参数(arguments,callee,caller)使用方法
- ANSI X9.19 MAC算法
- 自定义EditText实现一键删除数据
- TabHost理解与使用
- PL/SQL 9.0工具技巧
- android studio 快捷笔记
- Qt使用中碰到的问题
- PAT (Advanced Level) 1092. To Buy or Not to Buy (20)
- javaScript数组去重方法
- Appsacn 定期自动化扫描
- BeautifulSoup总结
- Win7 vs2017 WDK 1803 1809 驱动开发 出错 KMDF
- numpy 切片
- iOS8中的定位服务
- Swoole学习(一)了解一下Swoole的强大并在Centos安装Swoole及PHP扩展开启
- {Emgu}{C#}保存图片、视频等
- 文件查找记录类型 - TSearchRec - 文件操作(二)