首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
P5300
直线交点种类 题解:
romanhuang
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; i...
P5300
直线交点种类 题解:
romanhuang
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; i...
P1826
最大子数组和 题解:Kadane 算法
快乐小土狗
使用 Kadane 算法,可以在一次遍历中求出最大子数组和,时间复杂度 O(n),空间复杂度 O(1)。 #include <stdio.h> int main() { int n; scanf("%d", &n); ...
P552
移动零 题解:快慢指针
快乐小土狗
#include <stdio.h> #define MAXN 100010 int nums[MAXN]; int main() { int n; scanf("%d", &n); for (int i = 0; i < ...
P552
移动零 题解:直接模拟
快乐小土狗
#include <stdio.h> #define MAXN 100010 // 最大数组长度1e5 int nums[MAXN]; int main() { int n; // 输入数组长度 scanf("%d", &...
P10070
接雨水 题解:双指针经典
快乐小土狗
#include <stdio.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int *height = (int *)malloc(n * si...
P5127
动态查找的问题 题解:
smy886
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; ...
P2011
字符串替换 题解:
smy886
//灵活调库 #include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; ...
P8683
最短无序连续子数组 题解:
帅小虎
解题思路 核心思想:排序 + 双指针 拷贝并排序 将原数组 nums 复制一份得到 sorted,并对 sorted 升序排序。 排序后的数组就是整个数组最终应该变成的有序状态。 寻找左右边界 ...
P8702
双基回文数 题解:
huhu380
#include <iostream> #include <string> #include <stack> #include <algorithm> using namespace std; bool IsHuiwen(con...
P5367
进制转换5 题解:
1234567890338
#include<iostream> #include<algorithm> #include<math.h> using namespace std; int main(){ string s; cin >> s...
P5367
进制转换5 题解:
1234567890338
#include<iostream> #include<algorithm> #include<math.h> using namespace std; int main(){ string s; cin >> s...
P10132
拼正方形 题解:
snake
6个木棍拼成一个正方形,只有下面两种情况: 第一种情况 排序,先枚举蓝色边,再枚举红色边,那么绿色边+黄色边的值已经确定了,记sum[i]sum[i]sum[i]表示两条边之和为iii的方案数,对于每个枚举到的蓝色边和红色边,加入答案即可。sumsumsum可以由蓝色边更新。 ...
P1368
排列与二进制 题解:C语言
yngshq
#include <stdio.h> int main() { int i,k,n,m,count=0; while(scanf("%d %d",&n,&m)!=...
P1259
进制转换2 题解:python
yngshq
while True: try: x=int(input(),16) y=format(x,...
P1178
进制转换 题解:用python比较简单
yngshq
while True: try: x=int(input()) x=format(x,'b...
P1176
十进制和二进制 python题解:
yngshq
while True: try: a=int(input()) a=format(a,'b...
P1097
负二进制 题解:
yngshq
#include <stdio.h> #include <math.h> #define maxsize 100 int main() { int x,temp,remainder;  ...
P1085
校门外的树 题解:
yngshq
#include <stdio.h> int main() { int L,M,start,final,i=0,j=0,k,count=0; int len[10001]; &nb...
P1348
百鸡问题 题解:
yngshq
#include <stdio.h> int chicken(int n) { int x,y,z; double sum; for(x=0;x<=10...
P1045
平方和与倒数和 题解:
yngshq
#include <stdio.h> int a(int x) { int i,sum=0; for(i=1;i<=x;i++) { &n...
P1735
统计卡牌的值 题解:
yngshq
#include <stdio.h> #include <string.h> #define maxsize 50 int main() { char s[4]={'J','Q','...
P1500
求S(n) 题解:
yngshq
#include <stdio.h> int S(n) { return n; } int main() { int n,y; while(scanf(...
P1034
水仙花数 题解:
yngshq
#include <stdio.h> #include<stdbool.h> bool flower(int x) { int sum,temp,k; temp=x; &...
P1003
翻转数的和 题解:
yngshq
#include <stdio.h> #include <string.h> #define maxsize 100 int flopToint(char x[]) { int i,j,k,len,ret=0; &nbs...
P1428
整数和 题解:
yngshq
#include <stdio.h> int main() { int i,N,m,k=0; scanf("%d",&m); wh...
P1085
校门外的树 题解:
ZeroQi_404
#include<iostream> using namespace std; int main(){ int L,M; cin >> L >> M; int tree[10001]; for(int i=0;i<=L...
P1040
利润提成 题解:绝对简洁
ZeroQi_404
#include <iostream> using namespace std; int main() { double x, n = 0; cin >> x; if (x > 1000000) { ...
P1178
进制转换 题解:
lhy535
关于这个大数10进制转2进制问题。 我已经试过,如果你不考虑大数,把他当作long long 来处理,可以过50%用例,这个可以用来骗分。(当然我再平时练习的时候不建议这么做) 思路: 首先我们得清楚10进制转2进制的本质 %2和 /2到底是什么含义。 %2...
P1014
加密算法 题解:
Yggdrasil753
#include<iostream> #include<string> #include<cctype> using namespace std; int main(){ char ch[256] = {0}; ...
P1043
计算Sn 题解:
QAQ熊猫QAQ
#include<stdio.h> #include<math.h> int main() { int a, n; int sum=0; scan...
P5305
计算 \( 3 \times 3 \) 矩阵的行列式 题解:
QAQ熊猫QAQ
#include<stdio.h> int main() { int arr[3][3]; for (int i = 0; i < 3; i++) {  ...
P5303
统计三角形数量 题解:
QAQ熊猫QAQ
#include<stdio.h> int is_triangle(int a, int b, int c) { if (a + b > c && a + c > b && b + c > ...
P1377
旋转矩阵加强版 题解:新手易懂版(个人认为)
gyhhhhhh
#include <stdio.h> int check0(int n, int a[10][10], int b[10][10]) { for(int i=0; i<n; i++) f...
P1078
文件压缩 题解:
快乐小土狗
#include<iostream> #include<cstring> #include<cmath> #include<cstdio> #include<algorithm> using namespace std;...
P1573
梦中的统计 题解:
快乐小土狗
#include <iostream> using namespace std; int main() { long long M, N; long long cnt[10] = {0}; // 存储0~9的出现次数,初始化为0 long ...
P5104
约瑟夫问题的实现 题解:
绫小路754
#include<stdio.h> #include<string.h> struct node{ int num; int flag;//用来判断是否出局 }; int main() {...
P5104
约瑟夫问题的实现 题解:
绫小路754
#include<stdio.h> #include<string.h> struct node{ int num; int flag;//用来判断是否出局 }; int main() {...
P1001
01序列 题解:
itachi
天才就是百分之九十九的汗水 #include <iostream> using namespace std; int main() { cout << "000000" <<...
P1126
存下到达每个地点所需时间,如果没有不可达地点而最大所需时间不为t,输出NO
泠灵绫
#include <bits/stdc++.h> using namespace std; typedef struct node { int sx,sy; int step; } node; const int maxn=105; char mpt[...
P816
长度一定的连续子序列的最大平均值 题解:
快乐小土狗
#include <stdio.h> #include <stdlib.h> int main() { int n, k; scanf("%d %d", &n, &k); int nums[10000...
P8722
勇气比赛 题解:
kiypop
//已0为根构造二叉树 // 0 // (N) / \(G) // 1 2 //可以得到这样的规律 ...
P4355
二叉树的先序序列 题解:c语言递归
yk123
#include<stdio.h> #include <string.h> void getPre(char* str1,char* str2,char* str3,int len,int Inindex,int Postindex, int Preindex){ ...
P4922
打印杨辉三角形 题解:c语言递归
yk123
#include<stdio.h> int S(int n ,int m){ &n...
P815
Battle Over Cities 题解:
快乐小土狗
#include <iostream> #include <vector> #include <cstring> using namespace std; const int MAXN = 1005; vector<int> a...
P5124
求S(n)的值 题解:
wmj
#include<stdio.h> int main(){ int n; while(scanf("%d",&n)!=EOF){ printf("%d\n&qu...
P5124
求S(n)的值 题解:
wmj
#include<stdio.h> int main(){ int n; while(scanf("%d",&n)!=EOF){ printf("%d\n&qu...
P5124
求S(n)的值 题解:
wmj
#include<stdio.h> int main(){ int n; while(scanf("%d",&n)!=EOF){ printf("%d\n&qu...
P814
N皇后问题 题解:回溯
快乐小土狗
#include <bits/stdc++.h> // 初始化全局标记数组(N最大10,对角线最大长度20) int col[11] = {0}; // 标记列是否被占用:col[j]=1表示第j列有皇后 int diag1[21] = {0}; // 标记主对角线(...
P1286
最短路径 题解:C语言+SPFA+并查集
OOOOOIN
#include<stdio.h> #include<stdlib.h> #include<string.h> #define M 105 #define INF 0x3f3f3f3f3f3f3f3fLL #define E 405 //有并查...
1
2
我要提问
全站热榜
1
无法正确通过题目都是哪些原因造成的?
2
机试如何才能快速提高?
3
[置顶]计算机考研择校分析【25考研必读】
4
题目难点:数学公式不断化解
5
详细题解(站在巨人的肩膀上)
6
A+B问题 题解:C
7
【25计算机考研】39所985院校录取分数线汇总
8
逻辑很简单,但是实现却要小心多多
9
广度优先搜索计算每个人移动到每个位置需要去掉障碍物的最少数目,最后求和的最小值
10
2048游戏 题解:简洁实现