POJ 1142 Smith Numbers

操作系统期末大题类型题解 额,OS主要这回考程序分析题,PV操作、生产者消费者啊,哲学家进餐问题,死锁问题啊,如何避免死锁,经典银行家算法,页面置换算法啥的,磁盘调度......总计还有很多,就不一一说了 PV操作 谈到PV操作,首先要了解什么是信号量,其实就是用来解决互斥与同步问题的,分为原语wait(S)和signal(S),也就是我们常说的PV操作,在这里给出王道上的概念 wait(S){ while(S>0) S=S-1; } signal(S){ S=S+1; } 记录型信号量 阅读详情

 

Smith Numbers
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 7141 Accepted: 2505

Description

While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that number was equal to the sum of the digits of the prime factors of that number. Got it? Smith's telephone number was 493-7775. This number can be written as the product of its prime factors in the following way: 
4937775= 3*5*5*65837
The sum of all digits of the telephone number is 4+9+3+7+7+7+5= 42,and the sum of the digits of its prime factors is equally 3+5+5+6+5+8+3+7=42. Wilansky was so amazed by his discovery that he named this kind of numbers after his brother-in-law: Smith numbers. 
As this observation is also true for every prime number, Wilansky decided later that a (simple and unsophisticated) prime number is not worth being a Smith number, so he excluded them from the definition. 
Wilansky published an article about Smith numbers in the Two Year College Mathematics Journal and was able to present a whole collection of different Smith numbers: For example, 9985 is a Smith number and so is 6036. However,Wilansky was not able to find a Smith number that was larger than the telephone number of his brother-in-law. It is your task to find Smith numbers that are larger than 4937775!

Input

The input file consists of a sequence of positive integers, one integer per line. Each integer will have at most 8 digits. The input is terminated by a line containing the number 0.

Output

For every number n > 0 in the input, you are to compute the smallest Smith number which is larger than n,and print it on a line by itself. You can assume that such a number exists.

Sample Input

4937774
0

Sample Output

4937775

Source

 

 

在MDK5.37版本中添加Complier Version 5( 解决Missing Compiler Version 5 ) 本文章仅作为个人学习记录,方法也是从其他博主的博客中得到的,链接如下:二、Keil——Missing Compiler Version 5 和 core_cm3.c 问题解决 - YI颗白菜 - 博客园 (cnblogs.com) 问题描述 更新最新的keil版本(MDK5.37)后,在编译以前版本的工程文件时,发现出现了非常多的报错,在网上搜索之后发现原来时编译器版本不匹配的问题,即MDK5.37中使用的是Version 6版本的编译器,而缺少Version 5,对于以前编写的工 阅读详情

相关推荐

手把手教你用CEFSharp打造防关联指纹浏览器(附完整代码)

本文详细介绍了如何基于CEFSharp框架,从零开始构建一个企业级的防关联指纹浏览器。通过剖析核心架构、多进程隔离实现、动态指纹混淆(如Canvas、WebGL)的实战代码,以及代理集成与性能优化,为跨境电商、广告投放等场景提供了一套可控、安全的开源解决方案。

fern8的博客 961

Smith Numbers (POJ-1142)(素数判定+整数分解)

While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: ...

菜鸡的博客 353

3步搞定专利数据爬取:用Selenium绕过国家知识产权局反爬(附完整代码)

本文详细介绍了3种高效获取专利数据的技术方案,重点解析了使用Selenium绕过国家知识产权局反爬的实战方法,并提供了完整代码示例。文章还探讨了Requests+lxml轻量级方案和混合技术策略,帮助开发者根据需求选择最佳数据爬取方案,特别适合需要专利统计数据的开发者参考。

weixin_29029995的博客 1111

poj1142.Smith Number(数学推导)

Smith Number Time Limit: 1 SecMemory Limit: 64 MB Submit: 825Solved: 366 Description While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed th...

weixin_30633507的博客 156

科研绘图神器Origin2024最新中文版安装教程:5分钟搞定所有配置

本文提供了一份详细的Origin2024中文版安装与配置指南。从系统环境核查、安装包获取验证,到分步安装、语言切换及关键初始设置,手把手教你5分钟完成所有基础配置。同时,指南还分享了首次启动后的个性化设置与高效绘图工作流,助你快速上手这款科研绘图神器,提升数据处理与图表制作效率。

weixin_29247219的博客 1041

【MATLAB代码】雷达观测目标跟踪模型|H-infinity Filter(H无穷大滤波)与EKF(扩展卡尔曼滤波)的对比。附完整代码,订阅专栏后可直接查看

对比了经典扩展卡尔曼滤波(EKF)与H∞优化的EKF(H∞-EKF)在目标跟踪中的性能。通过MATLAB仿真实验,结果显示:在存在模型误差和测量噪声的情况下,H∞-EKF相比经典EKF在位置误差上降低

985工科博士毕业,专攻定位、导航和滤波等算法研究。从业10年,主要使用MATLAB 243

1059 Prime Factors(求出一个质数的质因数个数)(素数表)

Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p​1​​​k​1​​​​×p​2​​​k​2​​​​×⋯×p​m​​​k​m​​​​. Input Specification: Each input file co...

qq_41698081的博客 398

强化学习优化多目标冲突推理的决策过程设计

1. 背景介绍 强化学习(Reinforcement Learning,RL)作为机器学习的一个重要分支,近年来在计算机科学和人工智能领域取得了显著的进展。其核心思想是通过试错来学习最优策略,从而在复杂的环境中实现目标。然而,在多目标冲突推理(Multi-Objective Conflict Reasoning,MOCR)问题上,强化学习面临着诸多挑

AI天才研究院 1511

【LEETCODE】【史密斯数】

【LEETCODE】【史密斯数】 题目描述 Simth数的概念:一个非素数,其各位之和等于其所有质因数的各位之和。例如: 4=22,4=2+2,所以4是一个史密斯数。 22=211,2+2=2+1+1,22也是一个史密斯数。 27=333,2+7=3+3+3,27也是一个史密斯数。 解答要求 时间限制:1000ms, 内存限制:100MB 输入 第一行输入一个整数n(1<n<200),表示有n组测试数据。 接下来每行一个数num(1<=num<=5000000)。 输出 对于输入的每

walh131458的博客 4017

2025年下半年网络规划设计师综合知识真题及答案解析

1983年,ARPANet完成技术转型,对此后的 Internet发展全关重要,这一转型是指( ) A.电路交换转向分组交换 B.商业化转型 C.民用化转型 D.从 NCP 协议转向 TCP/IP 答案:D 解析:ARPANet 最初使用 NCP (Network Control Protocol)协议进行主机问通信。1983年1月1日,ARPANet 正式切换到TCP/IP 协议族,为后续Internet的发展奠定了统一协议基础。

鹿鸣天涯 927

一点击打印电脑就卡死?资源管理器停止工作的解决方法

Windows11共享的HP1022n打印机导致客户端打印时资源管理器崩溃卡死,电脑停止工作。

gary18的专栏 582

poj1142

题目不难,素数判定+整数唯一分解定理

小小小小杜 1412

MicroCap声学仿真介绍(二)-创建声学仿真元件

声学库里包含孔、管、障板辐射器等器件,我们只需要按照仿真的需求,将声学库里的器件排列好,输入参数,用线连接起来即可。这里我们用D指代孔的直径,L指代孔的长度,N代表孔的数量。26.在弹出的界面中做如下设置:需要先在右面的选框里找到对应的项,然后右键Add Part,再之后就如下设置。3.在弹出的界面中,选择“Macro file(.mac)”,并点击右上角的“OK”下面就以声学仿真中常见的“孔”来做示例,跟大家一块演示一下宏程序的新建。10.在上图中“Value”中填入“R”,然后点击左边的“OK”按钮;

山无忧的博客 2199

poj 1142 Smith Numbers 筛法

poj 1142 Smith Numbers 筛法 While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that

klc的博客 698

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

poj1142 Smith Numbers

Poj1142 Smith NumbersSmith Numbers Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13854 Accepted: 4716 DescriptionWhile skimming his phone directory in 1982, Albert Wilansk

千山鸟飞绝 338

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

poj 1142 Smith Numbers

分类:其他 难度:1.5   题意:将一个数各个位的和,与因式分解的每个因数各个位的和,如相等,为smith数,4937775= 3*5*5*65837,4+9+3+7+7+7+5= 42, 3+5+5+6+5+8+3+7=42。求大于给出的n的最小smith数。因式分解,map记录因式分解结果,map[因数]=出现次数。 #include #include using namespac

Maverick 934

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

分解质因数——Poj 1142 Smith Numbers

Smith Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10627   Accepted: 3723 Description While skimming his phone directory in 1982, Albert Wilansk

Vector 3746

poj 1142 Smith Numbers 【容斥原理】

Smith Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12750   Accepted: 4356 Description While skimming his phone directory in 1982, Albert Wilansky, a

世界很大 754

POJ_1142_Smith Numbers

分解质因数

edward_108 292

POJ1142——Smith Numbers

Smith Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12388   Accepted: 4244 Description While skimming his phone directory in 1982, Albert Wilansky, a

Alex 1003

poj1142Smith Numbers

链接1:http://poj.org/problem?id=1142  链接2:http://openoj.awaysoft.com:8080/judge/contest/view.action?cid=269#problem/B  Smith Numbers Description While skimming his phone directory in 1982, Albert Wi

JHC23的专栏 679

UVa 10042 && POJ 1142 - Smith Numbers

做了个非搜索题,smith数,又是由于忽略条件导致一直卡题,题目中说smith数是非素数,所以要单独判断,smith数比较密集,暴力枚举即可 此处只给出poj的代码,两者输入略有差别,uva的就不再给出 #include #include using namespace std; bool isprime[10005]; int prime[1500]; int factor[

DC的ACM奋斗史 1351

Poj 1142 Smith Numbers

暴力 1WA于因数唯一的smith数处理 2Y #include #include int count(int y){ int res=0,tp=y; while(y){ res+=y%10;y/=10; } return res; } bool Smith(int x){ int left=count(x); int i,right=0; int tp=x;

On my fighting way 735
上一篇: POJ 1141 Brackets Sequence
下一篇: POJ 1143 Number Game
bobten2008
博客等级 码龄18年 153粉丝 157原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值