H - H

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Submit Status

Description

Sky从小喜欢奇特的东西,而且天生对数字特别敏感,一次偶然的机会,他发现了一个有趣的四位数2992,这个数,它的十进制数表示,其四位数字之和为2+9+9+2=22,它的十六进制数BB0,其四位数字之和也为22,同时它的十二进制数表示1894,其四位数字之和也为22,啊哈,真是巧啊。Sky非常喜欢这种四位数,由于他的发现,所以这里我们命名其为Sky数。但是要判断这样的数还是有点麻烦啊,那么现在请你帮忙来判断任何一个十进制的四位数,是不是Sky数吧。 
 

Input

输入含有一些四位正整数,如果为0,则输入结束。 
 

Output

若n为Sky数,则输出“#n is a Sky Number.”,否则输出“#n is not a Sky Number.”。每个结果占一行。注意:#n表示所读入的n值。 
 

Sample Input

2992 1234 0
 

Sample Output

2992 is a Sky Number. 1234 is not a Sky Number.

 #include<cstdio>
#include<cstring>
int main()
{
int n,m;
while(scanf("%d",&n)&&n!=)
{
m=n;
int num0=;
while(m>)
{
num0+=m%;
m/=;
}
m=n;
int num1=;
while(m>)
{
num1+=m%;
m/=;
}
m=n;
int num2=;
while(m>)
{
num2+=m%;
m/=;
}
if(num1==num0&&num1==num2)
{
printf("%d is a Sky Number.\n",n);
}
else
{
printf("%d is not a Sky Number.\n",n);
}
}
}

CDZSC_2015寒假新人(2)——数学 H的更多相关文章

  1. CDZSC_2015寒假新人(2)——数学 G

    G - G Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  2. CDZSC_2015寒假新人(2)——数学 P

    P - P Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  3. CDZSC_2015寒假新人(2)——数学 D

    D - D Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  4. CDZSC_2015寒假新人(2)——数学 C

    C - C Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  5. CDZSC_2015寒假新人(2)——数学 B

    B - B Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  6. CDZSC_2015寒假新人(2)——数学 A

    A - A Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

  7. CDZSC_2015寒假新人(1)——基础 h

    Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...

  8. CDZSC_2015寒假新人(1)——基础 e

    Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...

  9. CDZSC_2015寒假新人(1)——基础 i

    Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...

随机推荐

  1. java基础知识再学习--maven

    maven 下载安装: Eclipse中创建maven项目: 查询jar包的坐标:search.maven.org 添加完一个jar包的依赖以后,这个jar包所依赖的其他jar包也被导入到项目的bui ...

  2. sql 删除两条完全相同的记录

    delete a from ( select *,ps=row_number()over(PARTITION by cCaption  order by getdate()) from AA_Colu ...

  3. phpwind 去除init.phpwind.net统计功能

    修改的文件如下:global.phplib/staticpage.class.phprequire/template.phpsimple/index.php

  4. JavaWeb学习笔记--HttpServletRequest、HttpServletResponse对象常用方法

    HttpServletRequest HttpSession session = request.getSession(true); //获取会话对象 Cookie[] cookies = reque ...

  5. 迁移笔记:php截取文字的方法

    php内置函数 1. iconv iconv_set_encoding('internal_encoding', 'UTF-8'); $str; //字符串的声明 $num=iconv_strlen( ...

  6. LeetCode_Word Ladder

    Given two words (start and end), and a dictionary, find the length of shortest transformation sequen ...

  7. [置顶] Android学习系列-Android中解析xml(7)

    Android学习系列-Android中解析xml(7) 一,概述 1,一个是DOM,它是生成一个树,有了树以后你搜索.查找都可以做. 2,另一种是基于流的,就是解析器从头到尾解析一遍xml文件.   ...

  8. java package 重命名时注意事项

    如果要对包重命名时,需要关注以下方面: 1. java关联类里的重命名(这个一般通过开发工具会自动修正,如eclipse) 2.配置文件,如原先配置为com.abc,现在更名为com.abc123,这 ...

  9. linux----设置、添加别名(alias,unalias)

    以下的说明针对centOS. 查看当前的别名 在命令行下,直接输入alias来查看. 添加临时的别名 方法为:alias[别名]=[指令名称] 该方法只是临时的,仅对当前终端有效,因此重启系统或在其他 ...

  10. javascript 将递归转化为循环

    function tco(f) { var value; var active = false; var accumulated = []; return function accumulator() ...