[Offer收割]编程练习赛50 register

Ended

Participants:326

Verdict:Time Limit Exceeded
Score:0 / 100
Submitted:2018-03-11 14:21:54

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
double array[100+10];
int m,n;
bool isFound;
double maxSum;
void solve(int index , int count, double sum){
  if(index<n){
    if(count==m){
      if(floor(sum)==sum){
        maxSum = sum;
        isFound = true;
      }
    }else if(!isFound){
      solve(index+1,count+1,sum+array[index]);
      if(!isFound){
        solve(index+1,count,sum);
      }
    }
  }
}
bool compare(int a,int b){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX