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 ...
随机推荐
- JavaScript eval() 为什么使用eval()是一个坏主意 什么时候可以使用eval()
---------------------------------------------------------------------------------------------------- ...
- ModelDriven
功能: submit 之后显示结果 1.项目结构 2.web.xml <?xml version="1.0" encoding="UTF-8"?> ...
- slf4j 之logback日志之环境安装【一】
一.maven引用. 传送门:http://www.slf4j.org/manual.html#projectDep <dependency> <groupId>ch.qos. ...
- Faster-R-CNN编译使用及相应问题解决
1.首先opencv是需要安装的,我用的ubuntu14.04,opencv3.0,具体安装教程可以参考网上很多,不想多提. 2.安装几个依赖包:cython,python-opencv和easydi ...
- c#委托与事件(详解)
引言 委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易.它们就像是一道槛儿,过了这个槛的人,觉得真是太容易了,而没有过去 ...
- 转:apache 的mod-status
最近发现在apache的监控方面,apache 2开始自带的apache mod-status其实是个不错的工具,下面摘录并笔记之: 如果是linux的话,可以这样设置: 在httpd.conf中添加 ...
- USACO 2.3 Cow Pedigrees
Cow Pedigrees Silviu Ganceanu -- 2003 Farmer John is considering purchasing a new herd of cows. In t ...
- socket编程——一个简单的例子
从一个简单的使用TCP例子开始socket编程,其基本步骤如下: server client ++++ ...
- ckplayer 项目实战
<div class="control-group" id="videoDiv" style="display: none;"> ...
- hdu和poj的基础dp30道
题目转自:https://crazyac.wordpress.com/dp%E4%B8%93%E8%BE%91/ 1.hdu 1864 最大报销额 唔,用网上的算法连自己的数据都没过,hdu的数据居然 ...