HDU 2097Sky数
来源:互联网 发布:淘宝宝贝描述上传图片 编辑:程序博客网 时间:2024/06/03 15:58
Sky数
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14327 Accepted Submission(s): 8284
299212340
2992 is a Sky Number.1234 is not a Sky Number.
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>
#include<stack>
#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b){
return a>b;
}
int to12(int n)
{
stack <int> s;
int b,sum=0;
while(1)
{
b=n%12;
//s12[i++]=(char)(b+'0');
s.push(b);
n/=12;
if(n==0)break;
}
while(!s.empty())
{
sum+=s.top();
s.pop();
}
return sum;
}
int to16(int n)
{
stack <int> ss;
int b,sum=0;
while(1)
{
b=n%16;
//s12[i++]=(char)(b+'0');
ss.push(b);
n/=16;
if(n==0)break;
}
while(!ss.empty())
{
sum+=ss.top();
ss.pop();
}
return sum;
}
int to10(int n)
{
return n/1000+n/100%10+n/10%100%10+n%10;
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n;
while(cin>>n&&n)
{
if(to10(n)==to12(n)&&to12(n)==to16(n))printf("%d is a Sky Number.\n",n);
else printf("%d is not a Sky Number.\n",n);
}
return 0;
}
- hdu 2097 Sky数
- HDU 2097 Sky数
- HDU 2097 Sky数.
- HDU 2097 Sky数
- Sky数(HDU 2097)
- HDU 2097 Sky数
- HDU 2097 Sky数
- hdu-2097-Sky数
- hdu-2097-Sky数
- HDU 2097 Sky 数
- hdu-2097-Sky数
- HDU 2097 Sky数
- hdu 2097 Sky数
- HDU 2097Sky数
- HDU 2097 Sky数
- HDU#2097: Sky数
- HDU-2097 Sky数
- HDU 2097 Sky数
- HDU 1087 Super Jumping! Jumping! Jumping!
- POJ 2533 LIS N2
- 【转载】继承(C#)
- HDU 1166 敌兵布阵
- HOJ 1876经理的烦恼
- HDU 2097Sky数
- HDU 2046骨牌铺方格(滚动数组)
- POJ 2352 Stars
- HDU-5053 the Sum of Cube
- HDU 2041
- LeetCode145 Binary Tree Postorder Traversal(迭代实现) Java
- POJ 1195 Mobile phones(二维树状数组)
- ZOJ1091 Knight Moves
- CF 275.5 A. SwapSort