当前位置:网站首页>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; }
边栏推荐
- [untitled]
- Fairygui joystick
- Unity3d makes the registration login interface and realizes the scene jump
- Role movement in the first person perspective
- FairyGUI循环列表
- 异常:IOException:Stream Closed
- [Chongqing Guangdong education] reference materials for regional analysis and planning of Pingdingshan University
- Derivation of logistic regression theory
- Matlab读取GNSS 观测值o文件代码示例
- FGUI工程打包发布&导入Unity&将UI显示出来的方式
猜你喜欢
![[algorithme] swordfinger offer2 golang question d'entrevue 2: addition binaire](/img/c2/6f6c3bd4d70252ba73addad6a3a9c1.png)
[algorithme] swordfinger offer2 golang question d'entrevue 2: addition binaire

Derivation of logistic regression theory

基本Dos命令
![[算法] 剑指offer2 golang 面试题10:和为k的子数组](/img/63/7422489d09a64ec9f0e79378761bf1.png)
[算法] 剑指offer2 golang 面试题10:和为k的子数组

rtklib单点定位spp使用抗差估计遇到的问题及解决
![[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity](/img/9d/7284c1399964d3fb48886f12e4941c.jpg)
[dry goods] cycle slip detection of suggestions to improve the fixed rate of RTK ambiguity

The earth revolves around the sun

Design and implementation of general interface open platform - (39) simple and crude implementation of API services
![[算法] 剑指offer2 golang 面试题9:乘积小于k的子数组](/img/65/fc3fb5a217a3b44f506b695af53e2c.png)
[算法] 剑指offer2 golang 面试题9:乘积小于k的子数组

FairyGUI条子家族(滚动条,滑动条,进度条)
随机推荐
[算法] 剑指offer2 golang 面试题7:数组中和为0的3个数字
Liste des boucles de l'interface graphique de défaillance
Office提示您的许可证不是正版弹框解决
记录:动态Web项目servlet访问数据库404错误之解决
IText 7 generate PDF summary
堆排序【手写小根堆】
【无标题】
Itext 7 生成PDF总结
[算法] 剑指offer2 golang 面试题4:只出现一次的数字
[GNSS data processing] Helmert variance component estimation analysis and code implementation
PRIDE-PPPAR源码解析
Force buckle 1189 Maximum number of "balloons"
Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
最短Hamilton路径 (状压DP)
Derivation of logistic regression theory
Mysql database reports an error: row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT=DY
GNSS定位精度指标计算
[Yu Yue education] guide business reference materials of Wuxi Vocational and Technical College of Commerce
(the first set of course design) 1-4 message passing interface (100 points) (simulation: thread)
Edit distance (multi-source BFS)