在数组中找到两个数相加等于给定的数 摘要:解题思路:注意事项:注意避免数对是两个相同的数参考代码:#include<stdio.h>int main(){ long long n; scanf("%lld",&…… 题解列表 2025年11月17日 0 点赞 0 评论 30 浏览 评分:0.0
T1244-和为给定数 摘要:#include<stdio.h>int main(){ int arr[100001]={0}; int n,m; int x; scanf("%d",&n)…… 题解列表 2025年11月05日 0 点赞 0 评论 84 浏览 评分:0.0
T1244-和为给定数 摘要:#include<stdio.h>int main(){ int arr[100001]={0}; int n;  …… 题解列表 2025年11月05日 0 点赞 0 评论 71 浏览 评分:0.0
使用暴力算法和二分解决给定定数 摘要:解题思路:注意事项:参考代码:import java.util.*;public class Main { public static void main(String[] args) { …… 题解列表 2024年10月17日 0 点赞 0 评论 360 浏览 评分:9.9
和和为为给给定定数数 摘要:解题思路:读取输入后排序,用双指针从两端向中间找和为目标值的数对,根据当前和调整指针参考代码:#include <iostream> #include <vector> #include <alg…… 题解列表 2024年10月16日 0 点赞 0 评论 408 浏览 评分:9.9
二分直接用现成的STL:lower_bound/upper_bound(新增手写二分) 摘要:(# 现成的STL直接逮住用 要想了解更多关于**lower_bound/upper_bound** -> [【C++函数速查】lower_bound和upper_bound使用方法详细解读](ht…… 题解列表 2024年10月12日 0 点赞 1 评论 368 浏览 评分:9.9
Hash无脑过,二分有点坑!!! 摘要:```python # 二分做法 n = eval(input()) ls = sorted(list(map(int, input().split()))) target = eval(in…… 题解列表 2024年04月08日 0 点赞 0 评论 400 浏览 评分:9.9
分治算法-和为给定数.java 摘要:解题思路:这里有一个精髓是对这个arr数组排序,然后进入递归判断。保证当我们在数组的两端同时向中间遍历时,如果当前两个数的和小于目标值,那么我们需要增加较小的数(也就是左边的数),反之我们需要减小较大…… 题解列表 2023年11月27日 0 点赞 0 评论 231 浏览 评分:0.0
sort 和 二分 提一句 上面jcent的计数排序思路太秒了 很牛 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int a[100000];int m,n;//下面为二分模板 int search…… 题解列表 2023年03月22日 0 点赞 0 评论 375 浏览 评分:0.0
和为给定数 摘要:``` import java.util.Arrays; import java.util.Scanner; public class Demo2176 { public static …… 题解列表 2022年03月12日 0 点赞 0 评论 601 浏览 评分:7.0