当前位置:网站首页>All in one 1405: sum and product of prime numbers
All in one 1405: sum and product of prime numbers
2022-07-06 12:57:00 【Studying hard】
【 Title Description 】
The sum of two prime numbers is S, What is the maximum product of them ?
【 Input 】
One is not greater than 10000 The positive integer S, Is the sum of two prime numbers .
【 Output 】
An integer , Is the maximum product of two prime numbers . The data is guaranteed to have a solution .
【 sample input 】
50【 sample output 】
589#include<stdio.h> int main() { int a[10001],b[10001]; a[0] = 2; int i, j; int count = 1; for (i = 3; i <= 9999; i += 2) { for (j = 3; j <= i; j += 2) { if (i % j == 0) { break; } } if (i == j) { a[count] = i; count++; } } for (i = 0; i < count; i++) { b[i] = a[i]; } int n; scanf("%d", &n); int num = 0; for (i = 0; i < count; i++) { for (j = 0; j < count; j++) { if (a[i] + b[j] == n) { if (a[i] * b[j] > num) { num = a[i] * b[j]; } } } } printf("%d", num); return 0; }
边栏推荐
- It has been solved by personal practice: MySQL row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT
- Comparative analysis of the execution efficiency of MySQL 5.7 statistical table records
- FairyGUI复选框与进度条的组合使用
- 抗差估计在rtklib的pntpos函数(标准单点定位spp)中的c代码实现
- [algorithm] sword finger offer2 golang interview question 10: subarray with sum K
- Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
- 编辑距离(多源BFS)
- Halcon knowledge: gray_ Tophat transform and bottom cap transform
- Code example of MATLAB reading GNSS observation value o file
- [Chongqing Guangdong education] reference materials for regional analysis and planning of Pingdingshan University
猜你喜欢

The master of double non planning left the real estate company and became a programmer with an annual salary of 25W. There are too many life choices at the age of 25

Design and implementation of general interface open platform - (39) simple and crude implementation of API services

地球围绕太阳转

There is no red exclamation mark after SVN update

Fabrication of fairygui simple Backpack

FairyGUI复选框与进度条的组合使用

rtklib单点定位spp使用抗差估计遇到的问题及解决

Unity3D,阿里云服务器,平台配置

Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)
![[算法] 劍指offer2 golang 面試題2:二進制加法](/img/c2/6f6c3bd4d70252ba73addad6a3a9c1.png)
[算法] 劍指offer2 golang 面試題2:二進制加法
随机推荐
记录:Navicat Premium初次无法连接数据库MySQL之解决
Introduction to the daily practice column of the Blue Bridge Cup
GPS高程拟合抗差中误差的求取代码实现
Liste des boucles de l'interface graphique de défaillance
服务未正常关闭导致端口被占用
【rtklib】在rtk下使用抗差自适应卡尔曼滤波初步实践
Fairygui joystick
最短Hamilton路径 (状压DP)
Realization of the code for calculating the mean square error of GPS Height Fitting
(core focus of software engineering review) Chapter V detailed design exercises
Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
记录:动态Web项目servlet访问数据库404错误之解决
Usage differences between isempty and isblank
Unity3d, Alibaba cloud server, platform configuration
Design and implementation of general interface open platform - (39) simple and crude implementation of API services
FairyGUI人物状态弹窗
Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)
Problems and solutions of robust estimation in rtklib single point location spp
On March 15, the official version of go 1.18 was released to learn about the latest features and usage
Fairygui character status Popup