#include<cstdio>#include<algorithm>usingnamespace std;constint nmax =100000;int a[nmax], n, m, i;boolFind(int index,int key){int left = index +1, right = n -1, mid;while(left <= right){
mid =(left + right)/2;if(a[mid]< key) left = mid +1;elseif(a[mid]> key) right = mid -1;elsereturntrue;}returnfalse;}intmain(){scanf("%d%d",&n,&m);for(i =0; i < n; i++)scanf("%d",&a[i]);sort(a, a + n);for(i =0; i < n -1; i++)if(Find(i, m - a[i]))break;if(i == n -1)printf("No Solution");elseprintf("%d %d", a[i], m - a[i]);return0;}
1048 Find Coins解题代码测试结果问题整理解题代码#include<cstdio>#include<algorithm>using namespace std;const int nmax = 100000;int a[nmax], n, m, i;bool Find(int index, int key) { int left = index + 1, right = n - 1, mid; while (left <= right) { m