第四届吉林省大学生程序设计大赛个人解题报告 Problem A: Harshad Number
来源:互联网 发布:做淘宝客服有什么前途 编辑:程序博客网 时间:2024/04/29 05:47
Problem A: Harshad Number
Welcome to 2010 Jilin Province Collegiate Programming Contest. Do you know 2010 is a magic number? If you add up all the digits of 2010, that is 3, it is just one factor of 2010. The number who has this character is called Harshad number. A Harshad number, or Niven number in a given number base, is an integer that is divisible by the sum of its digits when written in that base. Harshad numbers were defined by D. R. Kaprekar, a mathematician from India. The word "Harshad" comes from the Sanskrit "harṣa", meaning "great joy". The Niven numbers take their name from Ivan M. Niven from a paper delivered at a conference on number theory in 1997. All integers between zero and n are Harshad numbers in base n. The Harshad number is rare in all natural numbers. The ratio is about 10% decreasing with the number value. Your task is to list all the Harshad number between 1000 and 9999 orderly. We just consider the normal decimal base.
Input
This problem has no input
Output
You should output each Harshad number in one line orderly.
Sample Output
1000
……
2010
……
9990
Not all the numbers are listed in the sample. There are just the first, the last, and 2010 itself. The ellipsis expresses what you should calculate.
这道题是一道十足的水题,也就要求你打印1000 - 9999中,能除于自己每一位数加和的数。代码实现如下:
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem A: Harshad Number
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem B: The Farmer’s Heritage
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem F: Coin Game
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem J: Buying and Selling
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem C: The Natural Series
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem H: New Feature in Windows 7
- 河南省第一届大学生程序设计大赛解题报告
- 河南省第一届大学生程序设计大赛解题报告
- 第八届湖南省大学生程序设计大赛 - 笑不语@USC 随笔,感想,解题报告
- 第八届湖南省大学生程序设计大赛 - 笑不语@USC 随笔,感想,解题报告
- 第四届福建省ACM程序设计大赛解题报告(未完待续)
- 华中农业大学第四届程序设计大赛网络同步赛解题报告
- 山东省第四届ACM程序设计大赛 Problem A:Rescue The Princess (计算几何)
- ECNU第四届程序设计竞赛解题报告
- Phone Number 山东省第一届ACM大学生程序设计竞赛(原题) problem A
- 5/30 第三届吉林省大学生程序设计竞赛
- 第七届河南省ACM大学生程序设计大赛 A.物资调度
- 华侨大学第三届程序设计大赛基础组决赛解题报告
- http 异常说明
- "/Symbian/9.2/S60_3rd_FP1/EPOC32/" does not exist
- Emacs bookmark 命令
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem B: The Farmer’s Heritage
- 我来了
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem A: Harshad Number
- 91助手方便将iphone手机中的照片和录像导出到电脑中
- Turbo C的图形系统
- linux 系统函数学习
- 世界上最健康的作息时间表
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem F: Coin Game
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem J: Buying and Selling
- 第四届吉林省大学生程序设计大赛个人解题报告 Problem C: The Natural Series
- 工作培训小结