如果一个数字 十进制的各位数的和 == 十六进制的各位数的和 == 十二进制的各位数的和,则输出,从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的更多相关文章

  1. 【POJ 1995】 Raising Modulo Numbers

    [题目链接] http://poj.org/problem?id=1995 [算法] 快速幂 [代码] #include <algorithm> #include <bitset&g ...

  2. 【POJ - 1995】Raising Modulo Numbers(快速幂)

    -->Raising Modulo Numbers Descriptions: 题目一大堆,真没什么用,大致题意 Z M H A1  B1 A2  B2 A3  B3 ......... AH  ...

  3. 【POJ - 3187】Backward Digit Sums(搜索)

    -->Backward Digit Sums 直接写中文了 Descriptions: FJ 和 他的奶牛们在玩一个心理游戏.他们以某种方式写下1至N的数字(1<=N<=10). 然 ...

  4. POJ 1995:Raising Modulo Numbers 快速幂

    Raising Modulo Numbers Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5532   Accepted: ...

  5. POJ 2196

    #include <iostream> using namespace std; int sum_10; int sum_12; int sum_16; int fun_10(int nu ...

  6. [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 ...

  7. 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 ...

  8. 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'}.  ...

  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 ...

随机推荐

  1. C# 时间戳和时间的相互转换

    时间戳定义为从格林威治时间 1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数. C#格式时间转时间戳Timestamp private in ...

  2. BZOJ 2228 礼物(gift)(最大子长方体)

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2228 题意:给出一个只含有NP两种字母的长方体.从中找出只含有字母N的长方体,造型为a* ...

  3. MongoDB 学习笔记(二) 高级查询

    1.条件运算符 2.$all 匹配所有 3.$exists 判断字段是否存在 4.NUll 值处理 5.$mod 取模处理 6.$ne 不等于 7. $in 包含,与sql用法相同 8. $nin 不 ...

  4. core--线程池

    对于服务器-客户端这种架构的软件,通常客户端的数据来自于服务器,如何让一个服务器进程,来满足多个客户端程序的数据请求?一种简单的方法就是,每当一个客户请求来领,服务器就为该客户端创建一个线程.当有10 ...

  5. UVa 10635 (LIS+二分) Prince and Princess

    题目的本意是求LCS,但由于每个序列的元素各不相同,所以将A序列重新编号{1,2,,,p+1},将B序列重新编号,分别为B中的元素在A中对应出现的位置(没有的话就是0). 在样例中就是A = {1 7 ...

  6. IE6,7下li标签的间隙

    1.在IE6,7下li本身没浮动,但是li内容有浮动的时候,li下边就会产生3px的间隙. 解决办法: 1.给li加浮动 2.给li加vertical-align:top; eg: <!DOCT ...

  7. ajax连接数据库并操作数据库

    Response.Write("<script  type='text/javascript' language='javascript' >alert('用户名不能为空!请输入 ...

  8. IE 火狐浏览器对时间格式的兼容性;使用原型对象的方式 prototype关键字;时间格式化

    在ie中 时间格式如果用横杠来显示  "2013-05-10 19:20:59" 是可以正确识别的(如果用斜杠,IE也可以正确识别), 但是如果是火狐,则只能识别斜杠模式 &quo ...

  9. jsp内置对象和el表达式

    九个内置对象 *out jsp的输出流,用来向客户端响应 *page 当前jsp页面, 它的引用数据类型是Object,即真身中有如下代码 Object page=this; *config 它对应真 ...

  10. PHP配置文件详解php.ini [转]

    [PHP] ; PHP还是一个不断发展的工具,其功能还在不断地删减 ; 而php.ini的设置更改可以反映出相当的变化, ; 在使用新的PHP版本前,研究一下php.ini会有好处的 ;;;;;;;; ...