当前位置:网站首页>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; }
边栏推荐
- FGUI工程打包发布&导入Unity&将UI显示出来的方式
- Programming homework: educational administration management system (C language)
- [算法] 剑指offer2 golang 面试题2:二进制加法
- 错误: 找不到符号
- Sharing ideas of on-chip transplantation based on rtklib source code
- Easy to use shortcut keys in idea
- The port is occupied because the service is not shut down normally
- Teach you to release a DeNO module hand in hand
- Comparative analysis of the execution efficiency of MySQL 5.7 statistical table records
- 编辑距离(多源BFS)
猜你喜欢
![[算法] 剑指offer2 golang 面试题8:和大于或等于k的最短子数组](/img/8c/1b6ba3b1830ad28176190170c98628.png)
[算法] 剑指offer2 golang 面试题8:和大于或等于k的最短子数组

微信小程序开发心得

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

Unity3d, Alibaba cloud server, platform configuration

Combination of fairygui check box and progress bar

Office提示您的许可证不是正版弹框解决

The service robots that have been hyped by capital and the Winter Olympics are not just a flash in the pan

FairyGUI增益BUFF數值改變的顯示

Mysql database reports an error: row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT=DY

(core focus of software engineering review) Chapter V detailed design exercises
随机推荐
Novatel board oem617d configuration step record
【无标题】
WSL common commands
【GNSS数据处理】赫尔默特(helmert)方差分量估计解析及代码实现
Fundamentals of UD decomposition of KF UD decomposition [1]
【干货】提升RTK模糊度固定率的建议之周跳探测
Comparative analysis of the execution efficiency of MySQL 5.7 statistical table records
[algorithm] sword finger offer2 golang interview question 12: the sum of the left and right sub arrays is equal
RTKLIB: demo5 b34f.1 vs b33
[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
Idea problem record
[GNSS] robust estimation (robust estimation) principle and program implementation
In 2020, the average salary of IT industry exceeded 170000, ranking first
Theoretical derivation of support vector machine
Unity3D,阿里云服务器,平台配置
Detailed explanation of balanced binary tree is easy to understand
Role movement in the first person perspective
堆排序【手写小根堆】
1041 be unique (20 points (s)) (hash: find the first number that occurs once)
Liste des boucles de l'interface graphique de défaillance