摘要:
输入n(n<=100000)个整数,找出其中两个数使之和为m。 题解: 解法一: #define _CRT_SECURE_NO_WARNINGS#include<iostream>#include<algorithm>using namespace std; int main(){ int n[10 阅读全文
posted @ 2020-02-23 18:46
BlueValentines
阅读(252)
评论(0)
推荐(0)
摘要:
求方程的一个根:f(x)=x^3-5x^2+10x-80=0,要求|f(a)|<=10^-6。 题解:求导后可知该方程单增,且f(0)<0,f(100)>0。 #define _CRT_SECURE_NO_WARNINGS#include<iostream>#include<cmath>using 阅读全文
posted @ 2020-02-23 17:31
BlueValentines
阅读(314)
评论(0)
推荐(0)
摘要:
在包含size个元素的,从小到大顺序的int数组a里查找比给定整数p小的,下标最大的元素,找不到返回-1 题解: int LowerBound(int a[],int size,int p) { int begin=0; int end=size-1; int pos=-1; while(begin 阅读全文
posted @ 2020-02-23 17:05
BlueValentines
阅读(295)
评论(0)
推荐(0)

浙公网安备 33010602011771号