http://www.codeforces.com/contest/618/problem/A

明明觉得是水题,而我却做了一个小时。

明明觉得代码没有错,而我却错了好几次。

因为我的名字不叫明明,也不叫铭铭T_T最后还是铭神指出了我的错误

又新学到了新的姿势:

  1.浮点数的比较要用eps来比较

  2.log2(n)要写成log10(n)/log10(2)

其他的话这道题目刚开始没有思路,其实在草稿纸上写一下就可以发现了哦我的表达能力太差了只可意会不可言传T_T

 #include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <queue>
#include <vector>
#include <algorithm> #define rep(i,a,n) for(int i = a;i < n;i++)
#define per(i,n,a) for(int i = n-1;i >=a;i--)
#define pb push_back
#define VI vector<int>
#define QI queue<int>
#define log2(N) log10(N)/log10(2)
#define eps 1e-8 typedef long long ll; using namespace std; int n;
//int a[M][P] = {}; void solve(int b){
int m = b;
while(log2(m) - floor(log2(m))>eps){
m--;
}
int tmp = b - m;
int d = floor(log2(m)+);
if(tmp == ){
printf("%d",d);
return;
}
printf("%d ",d);
solve(tmp);
} int main(){
while(~scanf("%d",&n)){
solve(n);
puts("");
}
return ;
}

CodeForces 618A Slime Combining的更多相关文章

  1. Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) A. Slime Combining 水题

    A. Slime Combining 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=2768 Description Your frien ...

  2. Codeforces 1038D - Slime - [思维题][DP]

    题目链接:http://codeforces.com/problemset/problem/1038/D 题意: 给出 $n$ 个史莱姆,每个史莱姆有一个价值 $a[i]$,一个史莱姆可以吃掉相邻的史 ...

  3. HPU周赛题目解析

    A - Wilbur and Swimming Pool Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  4. Codeforces--618A--Slime CombiningCrawling(数学)

     Slime CombiningCrawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144KB ...

  5. Wunder Fund Round 2016 (Div. 1 + Div. 2 combined)

    现在水平真的不够.只能够做做水题 A. Slime Combining 题意:就是给n个1给你.两个相同的数可以合并成一个数,比如说有两个相同的v,合并后的值就是v+1 思路:直接模拟栈 #inclu ...

  6. Codeforces Round #508 (Div. 2) D. Slime

    D. Slime 题目链接:https://codeforces.com/contest/1038/problem/D 题意: 给出两个数,然后每次可以对相邻的两个数合并,比如x,y,那么合并过后就是 ...

  7. 【Codeforces 1038D】Slime

    [链接] 我是链接,点我呀:) [题意] 题意 [题解] 相当于让你确定每个数字前面的系数是-1还是+1 有个结论是这样每次和相邻的减的话, 任何出除了全"-1"和全"+ ...

  8. Codeforces 1038 D. Slime

    [传送门] 其实就是这些数字前面能加正负号,在满足正负号均出现的情况下价值最大.那么就可以无脑DP$f[i][j][k]$表示到了第$i$位,正号是否出现($j$.$k$为$0$或$1$)能得到的最大 ...

  9. @codeforces - 618G@ Combining Slimes

    目录 @description@ @solution@ @part - 0@ @part - 1@ @part - 2@ @part - 3@ @accepted code@ @details@ @d ...

随机推荐

  1. angularjs向后台传递数据,与后端进行交互

    angularjs之数据交互 function loadLeftFirstNodes (){ $http.get(sourceUrl,{ params:{ mpId: mpId, visits: ce ...

  2. JSon解析

    1.解析总是犯糊涂 在图中,[]  中括号表示是jsonarray,{} 小括号 表示对象  这个解析可以写成: JSONArray array=new JSONArray(result); for( ...

  3. Docker - Install docker on CentOS

    1. 准备 由于 Dokcer 需要 64bit OS, 版本号 3.10 或者更新的版本.所以,需要我们先确认我们的 CentOS 系统 $ uname -r output :: 3.10.0-22 ...

  4. Ansible 模块命令介绍

    copy模块: 目的:把主控端/root目录下的a.sh文件拷贝到到指定节点上 命令:ansible 10.1.1.113 -m copy -a 'src=/root/a.sh dest=/tmp/' ...

  5. cxf webservice 生成wsdl方法参数名称为arg0问题

    在通过cxf生成webservice服务时,如果你是用ServerFactoryBean,那么在生成wsdl时,方法的参数名称会被自动命名为arg0,arg1...,如: <xsd:comple ...

  6. [原创]用windows7连接windows2003的终端服务器时,出现"由于这台计算机没有远程桌面客户端访问许可证,远程会话被中断"的问题

    用windows7连接windows2003的终端服务器时,出现"由于这台计算机没有远程桌面客户端访问许可证,远程会话被中断"的问题,原因是终端服务器授权方式设置为了"每 ...

  7. ftp org.apache.commons.net.ftp.FTPClient 判断文件是否存在

    String path = "/SJPT/ONPUT/HMD_TEST/" ; FtpTool.getFTPClient().changeWorkingDirectory(path ...

  8. git pull push 不用输入用户名和密码的方法

    1.在计算机的安装盘下找到 '用户' 这个文件夹打开. 2.找到'用户' 文件夹下面你当前的用户. 3.新建'.gitconfig' 文件 4. [user] email =  name = [pus ...

  9. Counter Mode ( CTR )

    Encryption Decryption

  10. Mac php使用gd库出错 Call to undefined function imagettftext()

    第一次在Mac下使用ThinkPHP,用到验证码功能时报如题的错误: Call to undefined function Think\imagettftext() 然后检查自己的GD库,发现安装上了 ...