当前位置:网站首页>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; }
边栏推荐
- [算法] 剑指offer2 golang 面试题2:二进制加法
- 地球围绕太阳转
- How to improve the deletion speed of sequential class containers?
- Excel导入,导出功能实现
- KF UD分解之UD分解基础篇【1】
- Introduction to the daily practice column of the Blue Bridge Cup
- Derivation of logistic regression theory
- Mixed use of fairygui button dynamics
- Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
- InnoDB dirty page refresh mechanism checkpoint in MySQL
猜你喜欢
![Fundamentals of UD decomposition of KF UD decomposition [1]](/img/e9/564e0163c3756c0ba886913f1cfaef.jpg)
Fundamentals of UD decomposition of KF UD decomposition [1]
![[Chongqing Guangdong education] Shandong University College Physics reference materials](/img/56/4ac44729c3e480a4f779d6a890363a.jpg)
[Chongqing Guangdong education] Shandong University College Physics reference materials
![[algorithm] sword finger offer2 golang interview question 6: sum of two numbers in the sorting array](/img/d5/4bda133498f71ae9fd7a64c6cba8f0.png)
[algorithm] sword finger offer2 golang interview question 6: sum of two numbers in the sorting array

Edit distance (multi-source BFS)
![[algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix](/img/17/e7c9bfa867030af97eb66a7932c7e3.png)
[algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix

3月15号 Go 1.18 正式版发布 了解最新特色以及使用方法

FairyGUI簡單背包的制作

Prove the time complexity of heap sorting

Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)

Easy to use shortcut keys in idea
随机推荐
Acwing-116 pilot brother
[算法] 剑指offer2 golang 面试题7:数组中和为0的3个数字
错误:排序与角标越界
基本Dos命令
FairyGUI人物状态弹窗
MySQL error warning: a long semaphore wait
Database table splitting strategy
【GNSS】抗差估计(稳健估计)原理及程序实现
rtklib单点定位spp使用抗差估计遇到的问题及解决
Game 280 weekly
记录:初次cmd启动MySQL拒接访问之解决
[algorithm] sword finger offer2 golang interview question 12: the sum of the left and right sub arrays is equal
[Chongqing Guangdong education] Shandong University College Physics reference materials
Containers and Devops: container based Devops delivery pipeline
The earth revolves around the sun
Role movement in the first person perspective
[算法] 剑指offer2 golang 面试题8:和大于或等于k的最短子数组
Combination of fairygui check box and progress bar
微信小程序开发心得
wsl常用命令