poj 2196 Specialized Four-Digit Numbers
如果一个数字 十进制的各位数的和 == 十六进制的各位数的和 == 十二进制的各位数的和,则输出,从2992到9999
#include <cstdio>
int toDD(int n)
{
;
while(n)
{
sum += n%;
n /= ;
}
return sum;
}
int splitSum(int n)
{
;
while(n)
{
sum += n%;
n /= ;
}
return sum;
}
int toHex(int n)
{
;
while(n)
{
sum += n % ;
n /= ;
}
return sum;
}
int main()
{
int i,n;
; i < ; ++i)
{
if((n = splitSum(i)) == toHex(i) && n == toDD(i))
printf("%d\n",i);
}
;
}
poj 2196 Specialized Four-Digit Numbers的更多相关文章
- 【POJ 1995】 Raising Modulo Numbers
[题目链接] http://poj.org/problem?id=1995 [算法] 快速幂 [代码] #include <algorithm> #include <bitset&g ...
- 【POJ - 1995】Raising Modulo Numbers(快速幂)
-->Raising Modulo Numbers Descriptions: 题目一大堆,真没什么用,大致题意 Z M H A1 B1 A2 B2 A3 B3 ......... AH ...
- 【POJ - 3187】Backward Digit Sums(搜索)
-->Backward Digit Sums 直接写中文了 Descriptions: FJ 和 他的奶牛们在玩一个心理游戏.他们以某种方式写下1至N的数字(1<=N<=10). 然 ...
- POJ 1995:Raising Modulo Numbers 快速幂
Raising Modulo Numbers Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 5532 Accepted: ...
- POJ 2196
#include <iostream> using namespace std; int sum_10; int sum_12; int sum_16; int fun_10(int nu ...
- [Swift]LeetCode902. 最大为 N 的数字组合 | Numbers At Most N Given Digit Set
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- 902. Numbers At Most N Given Digit Set
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
- LeetCode902. Numbers At Most N Given Digit Set
题目: We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. ...
- [LeetCode] 902. Numbers At Most N Given Digit Set 最大为 N 的数字组合
We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Not ...
随机推荐
- 5.cadence原理图上[原创]
一.库管理 1.打开原理图,,按键盘P键 在目标库下可以直接收索需要的元件,则可直接找到 在原理图中放置器件时,结束放置快捷键:Esc 双击后,可自动将该元件对应的库添加到你的库中,该方法找元件效果好 ...
- [Topcoder]ZigZag(dp)
题目链接:https://community.topcoder.com/stat?c=problem_statement&pm=1259&rd=4493 题意:给一串数字,求出最长的波 ...
- jquery ajax 开发手记
1.json解析的格式要求更严格了,必须全部加引号,否则无法识别 {"result":"false"} 2.ashx如果要使用Session需要继承接口IReq ...
- Android 用户界面---拖放(Drag and Drop)(二)
拖拽事件监听器和回调方法 View对象既可以用实现View.OnDragListener接口的拖放事件监听器,也可以用View对象的onDragEvent(DragEvent)回调方法来接收拖拽事 ...
- HibernateTemplate 查询
Spring中常用的hql查询方法getHibernateTemplate()上 一.find(String queryString); 示例:this.getHibernateTempl ...
- 如何将SD卡或者TF卡的debian系统刷入nand
1. 在windows端下载辅助文件: a) http://dl.cubieforums.com/loz/boot_partition/bootloader/cubie_nand_uboot_part ...
- VS2015新功能
今天有幸参加了微软的 Visual Studio Dev Day,趁还没有忘记今天的学习内容. 先把这些内容记录下来,如果有其他人也参加此次交流活动,请补充完善. VS2015新功能 1,Roslyn ...
- mongodb主从复制
1)主服务器--master --port 20001 2)从服务器--slave --source 127.0.0.1:20001 --port 20002 注释:--master 以主服务器形式启 ...
- postgresql - mac 启动 关闭 postgresql
/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data stop /Library/PostgreSQL/9.3/bin/ ...
- taobao
taobao */--> UP | HOME taobao Table of Contents 1 taobao 1 taobao 欣然小铺 Date: 2013-09-25 Wen Autho ...