锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
#include <iostream>
#include <limits>
using namespace std;
template<typename T>
void showMinMax()
{
cout << "min: " << numeric_limits<T>::min() << endl;
cout << "max: " << numeric_limits<T>::max() << endl;
cout << endl;
}

int main()
{
cout << "short:" << endl;
showMinMax<short>();
cout << "int:" << endl;
showMinMax<int>();
cout << "long:" << endl;
showMinMax<long>();
cout << "long long:" << endl;
showMinMax<long long>();
cout << "float:" << endl;
showMinMax<float>();
cout << "double:" << endl;
showMinMax<double>();
cout << "long double:" << endl;
showMinMax<long double>();
cout << "unsigned short:" << endl;
showMinMax<unsigned short>();
cout << "unsigned int:" << endl;
showMinMax<unsigned int>();
cout << "unsigned long:" << endl;
showMinMax<unsigned long>();
cout << "unsigned long long:" << endl;
showMinMax<unsigned long long>();
}
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;

struct Node
{
int i,j;
int value;
};
long num[100000];
vector<Node> matrix;

int main()
{
long n;
long long m;
scanf("%ld %lld",&n,&m);
long i,j;
for(i = 0;i < n;++i)
{
scanf("%ld",&num[i]);
}

for(i = 0;i < n;++i)
{
if(num[i] > m)
{
break;
}
}

if(i < n)
{
printf("-1\n");
return 0;
}
long long res = -1;
long long sum;
long max,min = 0;
for(i = 0;i < n;++i)
{
if(i > 0)
{
min = 1000000;
for(j = 0;j < matrix.size();++j)
{
if(matrix[j].j == i - 1 && matrix[j].value < min)
{
min = matrix[j].value;
}
}
}
else
{
min = 0;
}
sum = 0;
Node node;
max = -1;
for(j = i;j < n;++j)
{
sum += num[j];
if(sum <= m)
{
if(max < num[j])
{
max = num[j];
}
node.i = i;
node.j = j;
node.value = max + min;
matrix.push_back(node);
if(j == n - 1)
{
if(res != -1)
{
if(node.value < res)
{
res = node.value;
}
}
else
{
res = node.value;
}
}
}
else
{
break;
}
}
}
printf("%lld\n",res);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;

struct Node
{
int i,j;
int value;
};
long num[100000];
vector<Node> matrix;

int main()
{
long n;
long long m;
scanf("%ld %lld",&n,&m);
long i,j;
for(i = 0;i < n;++i)
{
scanf("%ld",&num[i]);
}

for(i = 0;i < n;++i)
{
if(num[i] > m)
{
break;
}
}

if(i < n)
{
printf("-1\n");
return 0;
}
long long res = -1;
long long sum;
long max,min = 0;
for(i = 0;i < n;++i)
{
if(i > 0)
{
min = 1000000;
for(j = 0;j < matrix.size();++j)
{
if(matrix[j].j == i - 1 && matrix[j].value < min)
{
min = matrix[j].value;
}
}
}
else
{
min = 0;
}
sum = 0;
Node node;
max = -1;
for(j = i;j < n;++j)
{
sum += num[j];
if(sum <= m)
{
if(max < num[j])
{
max = num[j];
}
node.i = i;
node.j = j;
node.value = max + min;
matrix.push_back(node);
if(j == n - 1)
{
if(res != -1)
{
if(node.value < res)
{
res = node.value;
}
}
else
{
res = node.value;
}
}
}
else
{
break;
}
}
}
printf("%lld\n",res);
return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> fun(int n)

{
vector<int> last,all;
int i,j,k;
for(i = 1;i < 10;++i)
all.push_back(i);
if(n == 1)
return all;
int size;
int num;
for(i = 2;i <= n;++i)
{
last = all;
all.clear();
size = (int)last.size();
for(j = 0;j < size;++j)
{
for(k = 0;k < 10;++k)
{
num = last[j] * 10 + k;
if(num % i == 0)
all.push_back(num);
}
}
last.clear();
}
return all;
}
int
聽MaxSubsequenceSum(
const
聽
int
聽A[],
int
聽N)
{
聽聽聽聽
int
聽ThisSum,MaxSum,i,j,k;
聽聽聽聽
聽聽聽聽MaxSum聽
=
聽
0
;
聽聽聽聽
for
(i聽
=
聽
0
;i聽
<
聽N;i
++
)
聽聽聽聽聽聽聽聽
for
(j聽
=
聽i;j聽
<
聽N;j
++
)
聽聽聽聽聽聽聽聽
{
聽聽聽聽聽聽聽聽聽聽聽聽ThisSum聽
=
聽
0
;
聽聽聽聽聽聽聽聽聽聽聽聽
for
(k聽
=
聽i;k聽
<=
聽j;k
++
)聽聽聽聽ThisSum聽
+=
聽A[k];聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽
if
(ThisSum聽
>
聽MaxSum)聽聽聽聽MaxSum聽
=
聽ThisSum;
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
聽聽聽聽
return
聽MaxSum;
}
int
聽MaxSubsequenceSum(
const
聽
int
聽A[],
int
聽N)
{
聽聽聽聽
int
聽ThisSum,MaxSum,i,j;
聽聽聽聽
聽聽聽聽MaxSum聽
=
聽
0
;
聽聽聽聽
for
(i聽
=
聽
0
;i聽
<
聽N;i
++
)
聽聽聽聽
{
聽聽聽聽聽聽聽聽ThisSum聽
=
聽
0
;
聽聽聽聽聽聽聽聽
for
(j聽
=
聽i;j聽
<
聽N;j
++
)
聽聽聽聽聽聽聽聽
{
聽聽聽聽聽聽聽聽聽聽聽聽ThisSum聽
+=
聽A[k];聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽
if
(ThisSum聽
>
聽MaxSum)聽聽聽聽MaxSum聽
=
聽ThisSum;
聽聽聽聽聽聽聽聽}
聽聽聽聽}
聽聽聽聽聽聽聽聽
聽聽聽聽
return
聽MaxSum;
}
static
聽
int
聽MaxSubSum(
const
聽
int
聽A[],
int
聽Left,
int
聽Right)
{
聽聽聽聽
int
聽MaxLeftSum,MaxRightSum;
聽聽聽聽
int
聽MaxLeftBorderSum,MaxRightBorderSum;
聽聽聽聽
int
聽LeftBorderSum,RightBorderSum;
聽聽聽聽
int
聽Center,i;
聽聽聽聽
聽聽聽聽
if
(Left聽
==
聽Right)
聽聽聽聽聽聽聽聽
if
(A[left]聽
>
聽
0
)聽聽聽聽
return
聽A[left];
聽聽聽聽聽聽聽聽
else
聽聽聽聽
return
聽
0
;
聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽Center聽
=
聽(Left聽
+
聽Right)聽
/
聽
2
;
聽聽聽聽MaxLeftSum聽
=
聽MaxSubSum(A,Left,Center);
聽聽聽聽MaxRightSum聽
=
聽MaxSubSum(A,Center聽
+
聽
1
,Right);
聽聽聽聽
聽聽聽聽MaxLeftBorderSum聽
=
聽
0
;
聽聽聽聽LeftBorderSum聽
=
聽
0
;
聽聽聽聽
for
(i聽
=
聽Center;i聽
>=
聽Left;i
--
)
聽聽聽聽
{
聽聽聽聽聽聽聽聽LeftBorderSum聽
+=
聽A[i];
聽聽聽聽聽聽聽聽
if
(LeftBorderSum聽
>
聽MaxLeftBorderSum)聽聽聽聽MaxLeftBorderSum聽
=
聽LeftBorderSum;
聽聽聽聽}
聽聽聽聽
聽聽聽聽MaxRightBorderSum聽
=
聽
0
;
聽聽聽聽RightBorderSum聽
=
聽
0
;
聽聽聽聽
for
(i聽
=
聽Center聽
+
聽
1
;i聽
<=
聽Right;i
++
)
聽聽聽聽
{
聽聽聽聽聽聽聽聽RightBorderSum聽
+=
聽A[i];
聽聽聽聽聽聽聽聽
if
(RightBorderSum聽
>
聽MaxRightBorderSum)聽聽聽聽MaxRightBorderSum聽
=
聽RightBorderSum;
聽聽聽聽}
聽聽聽聽
聽聽聽聽
return
聽Max3(MaxLeftSum,MaxRightSum,MaxLeftBorderSum聽
+
聽MaxRightBorderSum);
}
int
聽MaxSubsequenceSum(
const int聽聽A[],int
聽N)
{
聽聽聽聽
return
聽MaxSubSum(A,
0
,N聽
-
聽
1
);聽聽聽聽
}
intMaxSubsequenceSum(
const int
聽A[],
int
聽N)
{
聽聽聽聽
int
聽ThisSum,MaxSum,i;
聽聽聽聽
聽聽聽聽ThisSum聽
=
聽MaxSum聽
=
聽
0
;
聽聽聽聽
for
(i聽
=
聽
0
;i聽
<
聽N;i
++
)
聽聽聽聽
{
聽聽聽聽聽聽聽聽ThisSum聽
+=
聽A[i];
聽聽聽聽聽聽聽聽
if
(ThisSum聽
>
聽MaxSum)
聽聽聽聽聽聽聽聽聽聽聽聽MaxSum聽
=
聽ThisSum;
聽聽聽聽聽聽聽聽
else
聽聽聽聽聽聽聽聽聽聽聽聽ThisSum聽
=
聽
0
;
聽聽聽聽}
聽聽聽聽
聽聽聽聽
return
聽MaxSum;
}
鍙傝冦婃暟鎹粨鏋勪笌綆楁硶鍒嗘瀽銆?/font>
class
聽X;
void
聽fun(X聽
*
x)
{
聽聽
//
聽鍦ㄨВ寮曠敤鎸囬拡涔嬪墠紜俊瀹冮潪0
聽聽
if
(x聽
!=
聽
0
)
聽聽聽聽
//
聽瑙e紩鐢ㄦ寚閽?/span>
}
聽聽
class聽Type;
void聽op(const聽Type聽&t1,const聽Type聽&t2);
int聽main()

{
聽聽Type聽obj1;
聽聽//聽璁劇疆obj1涓烘煇涓?br />
聽聽//聽閿欒錛氬紩鐢ㄥ弬鏁扮殑瀹炲弬涓嶈兘涓?
聽聽op(obj1,0);
聽聽//聽
聽聽return聽0;
}