Practice for Microsoft 2015 Online Test register

Ended

Participants:1406

Verdict:Wrong Answer
Score:70 / 100
Submitted:2014-10-18 13:33:43

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 <algorithm>
using namespace std;
class Goods{
public:
    int need;
    int value;
    Goods():need(0), value(0){
    }
    friend istream& operator>>(istream& is, Goods& goods);
};
istream& operator>>(istream& is, Goods& goods){
    is>>goods.need>>goods.value;
    return is;
}
int comp(const Goods& g1, const Goods& g2){
    if(g1.value*1.0/g1.need > g2.value*1.0/g2.need)
        return 1;
    else
        return 0;
}
void fun(Goods* goods, int idx, int& total, int M, int& max){
    if(idx<0){
        if(total > max)
            max = total;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX