Self Numbers
Self Numbers
Time Limit : 20000/10000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 34 Accepted Submission(s) : 16
#include <stdio.h>
#include <string.h>
int sum[]={};
int All_sum(int n)
{
if (n<)
return n;
else
return (n%)+All_sum(n/);
} void num(int i,int n)
{
int j,k=i-*n,tmp;
if(k<)
k=;
while()
{
tmp=k;
if(k>i)
return ;
tmp+=All_sum(k);
if(tmp==i)
{sum[tmp]+=;return ;}
k++;
}
return ;
} int main()
{
int i,n,Len,k,a,j;
for(i=;i<=;i++)
{
if(i<)n=;else if(i<)n=; else if(i<)n=; else if(i<)n=; else if(i<)n=; else if(i<)n=;
if(sum[i]==)
{
num(i,n);
}
if(sum[i]==)
printf("%d\n",i);
}
return ;
}
Self Numbers的更多相关文章
- Java 位运算2-LeetCode 201 Bitwise AND of Numbers Range
在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- [LeetCode] Add Two Numbers II 两个数字相加之二
You are given two linked lists representing two non-negative numbers. The most significant digit com ...
- [LeetCode] Maximum XOR of Two Numbers in an Array 数组中异或值最大的两个数字
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum re ...
- [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- [LeetCode] Bitwise AND of Numbers Range 数字范围位相与
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers ...
- [LeetCode] Valid Phone Numbers 验证电话号码
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...
- [LeetCode] Consecutive Numbers 连续的数字
Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | ...
- [LeetCode] Compare Version Numbers 版本比较
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 &l ...
- [LeetCode] Sum Root to Leaf Numbers 求根到叶节点数字之和
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number ...
随机推荐
- Unity3D研究院之在把代码混淆过的游戏返混淆回来(七十七)
最近一直在找如何在MAC上混淆Android的DLL,至今没能找到合适的,有大神知道记得告诉我喔.今天群里有人说了一个混淆代码和返混淆代码的工具de4dot ,不查不知道一查吓一跳.这玩意可以把别人混 ...
- 分布式版本控制系统Git-----6.Git 常见命令一览表
说明/备注 命令 备注 保存更新 git add [-i] -i 逐个确认 检查更新 git status 提交更新 git commit [-a] -m "<更新说明>&quo ...
- openstack私有云布署实践【4.1 上层代理haproxy配置 (科兴环境)】
官方文档上的高可用配置,它推荐的是使用haproxy的上层代理来实现服务组件的主备访问.或者负载均衡访问 一开始我也是使用haproxy来做的,但后来方式改了 测试环境:haproxy + n ...
- NYIST OJ 题目42 一笔画问题
水题.无向图欧拉通路的判定.用并查集判定是不是连通图! #include<cstdio> #include<cstring> #include<cmath> #in ...
- cursor:pointer 什么意思?
cursor规则是设定网页浏览时用户鼠标指针的样式,也就是鼠标的图形形状cursor:pointer设定鼠标的形状为一只伸出食指的手,这也是绝大多数浏览器里面鼠标停留在网页链接上方时候的样式另外可以选 ...
- 第八十八节,html5+css3pc端固定布局,搜索区,插入大图,搜索框
html5+css3pc端固定布局,搜索区,插入大图,搜索框 设置一个div作为搜索区域 1.宽度为百分之百 2.最小宽度为1263,因为要考虑到手机,等小屏幕缩小后宽度会自适应,导致破坏布局,将最小 ...
- 第三章:基本HTML结构
1.每个html 文档都应包含以下基本成分: <!DOCTYPE html> <!-- html5的顶部声明,声明这是一个html5的文档- ...
- 【LeetCode】459. Repeated Substring Pattern
Given a non-empty string check if it can be constructed by taking a substring of it and appending mu ...
- Java IO 节点流 ByteArrayInput/OutputStream
Java IO 节点流 ByteArrayInput/OutputStream @author ixenos ByteArrayInputStream 包含一个内部缓冲区(字节数组byte[]),该缓 ...
- Java 内部类和匿名内部类
1.内部类: /* 局部内部类: 在一个类 的方法内部定义另外一个类,那么另外一个类就称作为局部内部类. 局部内部类要注意的细节: 1. 如果局部 内部类访问了一个局部变量,那么该局部变量必须使用fi ...