首页
DreamJudge
院校信息
考研初试
考研复试
机试真题
考研面试
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
zxjrheaven
2025年3月24日 21:59
连续合数段 题解:暴力
P1493
回复 0
|
赞 0
|
浏览 1.2k
#include <bits/stdc++.h> using namespace std; int sss[10005]; int dp[10005]; void shusu(int n) { for(int i=3;i<=n;i++) { int flag=1; for(int j=2;j<sqrt(i)+1;j...
Xsw777
2025年3月11日 14:35
连续合数段 题解:纯C语言
P1493
回复 0
|
赞 3
|
浏览 1.3k
#include <stdio.h> #include <math.h> int IsNum(int n){ if(n<2) return 0; int i; for(i=2;i<=sqrt(n);i++){ if(n%i == 0){ ...
RingoCrystal
2025年2月8日 11:18
连续合数段 题解:存储起来,用加一判断
P1493
回复 0
|
赞 5
|
浏览 1.0k
#include <bits/stdc++.h> using namespace std; bool isprime(int x) { if (x < 2) return false; // 1 不是质数 for (int i = 2; i * i <= x; i++) { if (x % i == 0) { return false; } } return true; } int main() { int x, y; wh...
Pure
2023年10月24日 16:58
连续合数段 题解:
P1493
回复 0
|
赞 2
|
浏览 1.7k
#include<bits/stdc++.h> int a[1000005]; int count1 = 0; int maxn = 1, tag = 0; //判断合数 bool judge(int n) { for (int i = 2; i <= (int)sqrt(n); i++) if (n%i == 0) if (n != 2) return true; return false; } //把合数存到数组a void save(...
Bzreach
2023年3月16日 14:32
用最易理解的方法来解决,只用了数组。
P1493
回复 0
|
赞 8
|
浏览 3.3k
没用到什么stl函数,按照小白的思维来做的。 #include <bits/stdc++.h> using namespace std; bool he (int a){ //判断是否为合数 int flag=0; for(int i=2;i<=sqrt(a);i++){ if(a%i==0){ flag = 1; return true; } } if(flag==0){ return false; ...
题目
连续合数段
题解数量
5
发布题解
在线答疑
热门题解
1
用最易理解的方法来解决,只用了数组。
2
连续合数段 题解:存储起来,用加一判断
3
连续合数段 题解:纯C语言
4
连续合数段 题解:
5
连续合数段 题解:暴力