Skynumber
64-bit integer IO format: Java class name:
Input
Output
Sample Input
2992
1234
0
Sample Output
2992 is a Sky Number.
1234 is not a Sky Number.
代码:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <iostream>
#include <ctype.h>
#include <iomanip>
#include <queue>
#include <map>
#include <stdlib.h> using namespace std; int sum_k(int n,int k)
{
int s=;
while(n!=)
{
s+=n%k;
n/=k;
}
return s;
}
int main()
{
int n;
while(~scanf("%d",&n)){
if(n==)
break;
int a,b,c;
a=sum_k(n,);
b=sum_k(n,);
c=sum_k(n,);
if(a==b&&a==c)
printf("%d is a Sky Number.\n",n);
else
printf("%d is not a Sky Number.\n",n);
}
}
Skynumber的更多相关文章
随机推荐
- testlink于smarty配置和使用
于testlink于,采用smarty首先配置. 一般在过程化的编程中.创建一个smarty.inc.php的文件来配置Smarty的信息,其它文件引入就可以,目的是为了不改动smarty.class ...
- Sliverlight之 特效
1,OpacityMask控件的部分渐隐(见Project16) (1) 控件的OpacityMask有什么作用 说明:设置所选区域不透明度的画笔,一般结合LinearGradientBrush或Ra ...
- dbus 和 policykit 实例篇(python) ()转
使用policykit 的程序一般都有一个dbus daemon程序来完成相关操作,这个dbus daemon 会在系统注册一个system bus 服务名,用于响应要求root privileged ...
- Jenkins(转)
1 修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│ └─JavaHelloWorld│ ...
- swift的struct本节描述结构的类型
<span style="font-size:24px;">struct David { var x = 0;//一个结构的定义,两个字段x,y var y = 0;/ ...
- Directx11学习笔记【二十】 使用DirectX Tool Kit加载mesh
本文由zhangbaochong原创,转载请注明出处:http://www.cnblogs.com/zhangbaochong/p/5788482.html 现在directx已经不再支持.x文件了, ...
- 程序猿学英语—In July the English learning summary
七月的英语学习更加曲折,七月初.查看更多,周六和周日可以保证每天两小时的英语教室学习.周一到周 五一般是上完晚自习九点多来机房学习英语,学习一个小时十点多再回宿舍. 考完试,回家待了五天,不好意思的说 ...
- hdu 4864 Task (馋)
# include <stdio.h> # include <algorithm> # include <string.h> using namespace std ...
- URAL 1553. Caves and Tunnels 树链拆分
一颗树 每次出发点右键值是0 2操作模式1.第一i右键点值添加x 2.乞讨u至v在这条路上右上方值 树为主的连锁分裂称号 #include <cstdio> #include <cs ...
- [LeetCode145]Binary Tree Postorder Traversal
题目: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Giv ...