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. C语言中固定大小的数据类型的输入和输出

    在使用C语言时,对数据的大小要求比较严格时,例如要使用32位的整数类型,这时要使用 int32_t,无论平台如何变化,数据大小仍然是32位,固定位数的数据类型还有 uint32_t.uint64_t ...

  2. 关于Django模板渲染一个很重要的用途

    一般情况下我们在模板利用django的for标签循环生成html代码时,可以同时生成形如: "{% url 'dormitory:hygiene_detail' pk={{ id }} %} ...

  3. js与objective-c的交互-备

    在写 JavaScript 的时候,可以使用一个叫做 window 的对象,像是我们想要从现在的网页跳到另外一个网页的时候,就会去修改 window.location.href 的位置:在我们的 Ob ...

  4. Ubuntu apache 禁止目录浏览

    $ sudo vim /etc/apache2/sites-enabled/000-default 将Options后面Indexes前面加上"-"表示禁止目录浏览: <Di ...

  5. android批量文件上传(android批量图片上传)

    项目中多处用到文件批量上传功能,今天正好解决了此问题,在此写出来,以便日后借鉴. 首先,以下架构下的批量文件上传可能会失败或者不会成功:   1.android客户端+springMVC服务端:服务端 ...

  6. (DP)Best Time to Buy and Sell Stock

    题目: Say you have an array for which the ith element is the price of a given stock on day i. If you w ...

  7. 简单dp hdu-4105-Electric wave

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4105 题目意思: 给一个字符串,求最大的分隔空格数,记所有被分隔的数为a1,a2,a3,..... ...

  8. if条件语句练习(相亲)

    public class a { public static void main(String[] arg){ //F是房子,Q是钱,N是能力,等于0说明没有,等于1说明有: 有一项具备则可以嫁,都不 ...

  9. ubuntu 16.04 Ubuntu 安装GDebi,从而安装deb文件

    其实在ubuntu直接双击deb文件就能安装,可是我现在装了ubuntu 16.04后,发现谷歌浏览器的deb和搜狗输入法的deb都不能直接双击安装,有点小问题. 但是安装GDebi软件后,直接在终端 ...

  10. fcntl,F_GETFL,F_SETFL,flags

    1.获取文件的flags,即open函数的第二个参数: flags = fcntl(fd,F_GETFL,0); 2.设置文件的flags: fcntl(fd,F_SETFL,flags); 3.增加 ...