【HDOJ】【BestCoder Round #84】1001 Aaronson
来源:互联网 发布:数码宝贝网络侦探bgm 编辑:程序博客网 时间:2024/04/30 12:23
问题描述
给出一个不定方程
输入描述
输入包含多组数据, 第一行包含一个整数
第一行包含两个整数
输出描述
对于每组数据, 输出
题目有一个补充条件,
很容易看出来这就是个二进制拆分的问题,二进制为
#include<stdio.h>int main(){ int T,n,m,ans; scanf("%d",&T); while (T--) { scanf("%d%d",&n,&m); for (ans=0;n && m;n>>=1,m--) ans+=(n & 1); ans+=n; printf("%d\n",ans); }}
0 0
- 【HDOJ】【BestCoder Round #84】1001 Aaronson
- hdu 5747 Aaronson (BestCoder Round #84 1001)
- BestCoder Round #841001Aaronson
- HDU 5747 BestCoder Round #84 Aaronson (模拟)
- Bestcoder-Aaronson
- 【HDU5747 BestCoder Round 84A】【贪心 细节】Aaronson m范围最少数量2的幂凑成n
- 【HDOJ】【BestCoder Round #84】1004 Dertouzos
- hdoj 5748 Bellovin (LIS) 【BestCoder Round #84 】
- HDOJ 5747 Aaronson
- HDOJ 5747Aaronson
- hdoj 2894 Aaronson (贪心)
- Reading comprehension (BestCoder Round #8) (hdoj 4990)
- HDOJ-BestCoder Round #85 【5777 domino】
- BestCoder Round #84 1001 hdu 5747 模拟
- BestCoder Round #84 Dertouzos
- BestCoder Round #84 题解
- BestCoder Round #84
- BestCoder Round #84
- 数据结构学习工具总结
- Sql Server 2008 R2 清空数据库中ldf日志文件
- CodeForces 288APolo the Penguin and Strings
- classpath、path、JAVA_HOME的作用及JAVA环境变量配置
- Hdu 5730 Shell Necklace(cdq+fft)
- 【HDOJ】【BestCoder Round #84】1001 Aaronson
- HTML5高级编程之像素处理及粒子效果
- 利用数组求解双色球问题
- Eclipse web开发问题解决1
- IOS safari 浏览器 时间乱码(ios时间显示NaN) 问题解决
- HTTP 介绍
- HTML5各引擎显示效率比较
- mysql编码utf8的设置
- HTML5开发中使用MVC模式