如果一个数字 十进制的各位数的和 == 十六进制的各位数的和 == 十二进制的各位数的和,则输出,从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. 上海二手房8月排名:链家、悟空找房、中原、太平洋、我爱我家、易居、房天下、iwjw、房多多、房好多、q房网、、、

    房产网站总结 链家: 悟空找房: 中原: 太平洋: 我爱我家: 易居: 房天下: iwjw:有较多二手房信息 链家称王 房多多领跑电商平台 近日,云房数据公布了8月上海房产中介成交数据,从排行榜来看, ...

  2. LBS由ip查经纬度

    LBS API: https://api.map.baidu.com/highacciploc/v1?qcip=223.104.5.201&qterm=pc&ak=NLwCqrDce4 ...

  3. [转载]mysql的binlog安全删除

    [转载]mysql的binlog安全删除  理论上,应该在配置文件/etc/my.cnf中加上binlog过期时间的配置项,expire_logs_days = 10 但是如果没有加这一项,随着产生越 ...

  4. 配置centos防火墙(iptables)开放80端口

    #添加规则 /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #保存 /etc/rc.d/init.d/iptables save

  5. PHP学习笔记03——函数

    <!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www. ...

  6. mysql装载本地文件及模式匹配

    使用load data装载本地文件到表中,文件每行一条记录,列值之间用tab分隔,并按照次序一一列出,对于无值或丢失的情况可以使用\N.但是在使用insert into插入的时候不能使用\N,而应该是 ...

  7. 每天一个Linux命令(2): ls

    ls命令是linux下最常用的命令.ls命令就是list的缩写缺省下ls用来打印出当前目录的清单如果ls指定其他目录那么就会显示指定目录里的文件及文件夹清单. 通过ls 命令不仅可以查看linu ...

  8. Node.js的循环依赖

    我们知道在实际编程过程中,要尽可能的减少或者规避循环依赖情况的发生.但在现实环境中,有时却不得不产生循环依赖.Node.js不提倡使用循环依赖,但真有如此情况发生时Node.js也有办法解决.这篇博文 ...

  9. android EditText控件可输入正负数及小数位

    设置android:inputType="numberSigned|numberDecimal" <EditText android:id="@+id/editTe ...

  10. 使用poi解析Excel

    解析XLS package xls; import java.io.FileInputStream; import java.io.IOException; import java.io.InputS ...