-
//zoj1180 Self Numbers
-
//Accepted 1180 C++ 00:00.29 1360K
-
#include <stdio.h>
-
#include <string.h>
-
#define MAXN 1000000
-
bool flag[MAXN+1];//index is self number
-
int sum(int n)
-
{
-
int s = 0;
-
while (n){
-
s += n%10;
-
n /= 10;
-
}
-
return s;
-
}
-
void generate()
-
{
-
int i;
-
memset(flag,false,sizeof(flag));
-
for (i=1; i<=MAXN; ++i)
-
if (!flag[i]) {
-
int n = i+sum(i);
-
while (n<=MAXN && !flag[n]){
-
flag[n] = true;
-
n = n+sum(n);
-
}
-
}
-
for (i=1; i<=MAXN; ++i)
-
if (!flag[i]) printf ("%d/n",i);
-
}
-
int main()
-
{
-
generate();
-
return 0;
-
}
相关推荐
Sobel原理及计算过程详解
该算子包含两组3x3的矩阵,分别为横向及纵向,将之与图像作平面卷积,即可分别得出横向及纵向的亮度差分近似值。首先,我们需要构建一个Sobel算子,通常是一个 3x3 的矩阵。Sobel算子可以分别计算水平和垂直方向的梯度值,然后将两者合并得到总梯度值。索贝尔算子(Sobel operator)主要用作边缘检测,在技术上,它是一离散性差分算子,用来运算图像亮度函数的灰度近似值。所以,我们假设选择图像矩阵中的点A(1, 1),即第二行第二列的元素,对应的。接下来,我们将使用Sobel算子计算这个点的梯度值。
zoj 1180 Self Numbers(大数,灵活题)
In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for d
华为使用MicroG安装并使用Google服务教程
鉴于众多华为手机用户因无法使用Google服务而感到不便,我经过多次摸索和测试,总结了一份简单易懂的教程,希望能够帮助到大家。无论是需要使用Google Play商店下载应用,还是需要使用Google服务进行工作和学习,本文将详细介绍如何在华为手机上安装并使用Google服务。二、前置条件软件要求:Aurora Store(替代Google Play商店)、MicroG Companion、MicroG Server(替代Google框架)
zoj 1180 Self Numbers
从1开始,以每一个标记为0的数为起点,产生序列,序列中的任何数的标记都置为1,最后找出标记为0的,即为所求数。 #include #include #include #define MAX 1000001 int a[MAX]; int getSum(int n){ int sum=n; while(n>0){ sum+=(n%10);
Notepad++ XML Tools插件:手把手教你格式化混乱XML与一键语法检查(保姆级教程)
本文详细介绍了如何使用Notepad++的XML Tools插件格式化混乱的XML文件并进行一键语法检查。通过插件安装、格式化实战和语法排错的完整流程,帮助开发者高效处理XML数据,提升API通信和数据存储的工作效率。特别适合需要快速验证和整理XML配置的开发人员。
STM32 USB AUDIO实战指南——从零构建音频设备
本文详细介绍了如何使用STM32F407构建USB音频设备,从硬件准备到软件配置,再到音频播放和录制功能的实现。通过STM32CubeMX配置和实战代码示例,帮助开发者快速掌握USB Audio Class规范,实现低延迟、高质量的音频传输,适用于语音交互、音乐播放等多种场景。
[HDU4432][TJ02B]Sum of divisors
#include #include #include #include #include #include #include #include #include #define inf (1ull<<63)-1 #define N 100005 #define maxn 100005 #define pb(a) push_back(a) #define mem(a,b)
维护测试监控LLM应用
LangFuse: 开源 + SaaS(免费/付费),LangSmith 平替,可集成 LangChain 也可直接对接 OpenAI API;LangSmith: LangChain 的官方平台,SaaS 服务(免费/付费),非开源,企业版支持私有部署;调试 Prompt 的 Playground测试/验证系统的相关指标数据集管理各种指标监控与统计:访问量、响应时长、Token 费等等。
【2017多校】第四场C题:CountingDivisors
预备知识:一个大于11的正整NN,如果它的标准分解式为:N=Pa11Pa22⋯PannN = P_1^{a_1}P_2^{a_2}\cdots P_n^{a_n} ,那么它的正因数个数为σ0(N)=(1+a1)(1+a2)⋯(1+an)\sigma_0(N) = (1+a_1)(1+a_2)\cdots(1+a_n)。题目:Counting Divisors Time Limit: 10000
深入解析EtherCAT通讯DS402协议下的伺服电机控制模式选择与配置
本文深入解析了EtherCAT通讯DS402协议下的伺服电机控制模式选择与配置,详细介绍了六种核心控制模式(如PPM、CSP、CSV、CST)的应用场景及实战技巧。通过EtherCAT和DS402协议的高效配合,实现工业自动化中伺服电机的精准控制,提升设备性能与稳定性。
Visual Studio调试技巧与实用方法总结(实战经验分享)
本文根据多年的项目实战经验,详细介绍一些Visual Studio常用的高效调试手段与技巧。
POJ1316 ZOJ1180 UVA640 Self Numbers
//2_2_1: Self Numbers 10000以内的自数 POJ1316 ZOJ1180 UVA640 #include #include #include using namespace std; const int N = 10000 + 100; int sum(int n) { if(n < 10) return n; else return (n % 10) + su
嵌入式工程师成长之路(1)——元件基础(试读版)
上拉电阻阻值选错导致MCU反复重启?0欧电阻竟然能“背锅”信号干扰?高精密采样电阻的温漂毁了整个控制系统?——这些问题,都是基础不牢!优快云硬件领域头部博主十年经验汇总,涵盖电阻分类、封装、实战选型、避坑指南,附带职业进阶路径,助你从小白进阶为“电路医生”!
ZOJ1180 Self Numbers 开始刷水题模式
In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for dig
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
Probability and Statistics - 4th edition
Probability and Statistics - 4th edition
ZOJ Problem Set–1180 Self Numbers
Time Limit: 10 Seconds Memory Limit: 32768 KB In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be...
SIMATIC S7-1200, S7-1500 PID 控制[手册]
SIMATIC S7-1200, S7-1500 PID 控制[手册]
php C++ - zoj 1180 Self Numbers
AC - C++// Run Time(ms) 1160// Run Memory(KB) 1160#include #include #include using namespace std;int maxDigit = 6;const int NUMBER = 1000001;char arr[NUMBER];void run(int ndigit, i
HDU1128 UVA640 UVALive5326 ZOJ1180 Self Numbers【水题】
Self Numbers Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8398 Accepted Submission(s): 3683 Problem Description In 1949 the Ind
Self Numbers POJ - 1316 ZOJ 1180 UVA640
In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for dig...
POJ1316 Self Numbers【水题】
Self Numbers Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24481 Accepted: 13690 Description In 1949 the Indian mathematician D.R. Kaprekar discovered a
ZOJ-1180
水题,自己看吧 #include #include #include static int d(int n) { int sum = n; while (n) { sum += n % 10; n /= 10; } return sum; } int main() { int i, temp, *array = malloc(1000001 * sizeof(int));
CF_448E_Divisors
Divisors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bizon the Champion isn't just friendly, he also is a rigorous
zoj 1180
//1180#include using namespace std;#define MAX 1000001bool x[MAX];//from the initial to calculate the number.which satisfy the equation ABCD = abcd + a + b + c +d;int main(){ memset
Divisors of the Divisors of An Integer
题目链接:Divisors of the Divisors of An Integer 我们直接看每个质因子的贡献即可。 假设这个质因子有x个,那么我们构造某一个数的时候可以选0,1,2,3,…,x个,然后对应的因子就有1,2,3,4,5,…,x个。 所以每个因子的贡献就是(x+1)*(x+2)/2 但是要注意1e7+7不是质数,所以没有逆元,需要在取模之前除以2. 然后对于阶乘分解我们可以提前预处理出所有质数。 复杂度:O(T*n) AC代码: #pragma GCC optimize("-Ofast
HDU 6069 Counting Divisors(求因子)
Counting Divisors Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 2316 Accepted Submission(s): 833 Problem Description In mat
POJ1316 ZOJ1180 UVA640
本题是求1-10000以内的自私数,主要思想是利用帅选法进行求解。 首先:构造一个数组a,且a[i]=i 然后:设置a[d(i)]=i 最后:扫描数组a,筛选出a[i]=i的数 Java代码如下:
1万+



被折叠的 条评论
为什么被折叠?



