Kids’ Riddle
来源:互联网 发布:宇宙以知最大的星球 编辑:程序博客网 时间:2024/06/04 17:53
问题 B: Kids’ Riddle
时间限制: 1 Sec 内存限制: 512 MB提交: 31 解决: 8
[提交][状态][讨论版]
题目描述
Friends, have you ever taken the April Fools Contest 2017 at Codeforces? There is a problem called Kids’ Riddle. The problem description is given below: Programmers’ kids solve this riddle in 5 to 10 minutes. How fast can you do it? After long time thinking, the authors of our problem found out the rule. Just count the number of holes in hexadecimal notation. And now, it becomes the problem to you. Please solve the Kids’ Riddle problem.
输入
The input contains a single integer n(0 ≤ n ≤ 2000000000).
输出
Output a single integer.
样例输入
61441
样例输出
2
提示
The hexadecimal notation of 61441 is F001, there are two holes in it.
就是让你找这个数十六进制下的圈的个数
#include <bits/stdc++.h>using namespace std;int a[16] = { 1,0,0,0,1,0,1,0,2,1,1,2,0,1,0,0 };int main(){int n;while(~scanf("%d", &n)){int cnt = a[n % 16];n /= 16;while (n){cnt += a[n % 16];n /= 16;}printf("%d\n", cnt);}}
0 0
- Kids’ Riddle
- riddle
- Crazy Kids
- Kids' Wishes
- Einstein's Riddle
- [BZOJ3495][PA2010][2-SAT]Riddle
- Codeforces896A Nephren gives a riddle
- Codeforces896A Nephren gives a riddle
- 入侵检测系统KIDS
- 小留学生 parachute kids
- 小留学生 parachute kids
- Positive Comments for Kids
- puzzles for kids
- Kids Table - Government Shutdown
- SGU495-Kids and Prizes
- kids sports jerseys wholesale
- kids日志系统介绍
- 【SGU495】【Kids and Prizes】
- 第一章 1-1 基础知识
- Android进阶系列之Support Annotation Library使用详解
- MKL学习——线性代数概念相关
- ZOJ3772-Calculate the Function
- cuda由5.0版本升级到5.5版本后编译器未找到导入的项目 CUDA 5.0.props
- Kids’ Riddle
- 关于VideoView播放视频问题
- linux网络编程(8)——数据的IO和复用
- 用户登录界面
- 关于jquery封装的AJAX详解[转载]
- 同一系统启动多个Tomcat服务
- JAVA 分页查询
- javamail设置多个收件人发送简单文本邮件
- js对象字面量的使用