Practice for Microsoft 2015 Online Test register

Ended

Participants:1406

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-18 13:08:28

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 <string>
#include <cstring>
using namespace std;
int days[105] = {0},cc[105];
int main()
{
    int ncase,req,tmp,cards;
    cin >> ncase;
    while(ncase--)
    {
        for(int i = 1;i <= 100; ++i)
            days[i] = 1;
        cin >>  req >> cards;
        for(int i = 0; i < req; ++i){
            cin >> tmp;
            cc[i] = tmp;
            days[tmp] = 0;
        }
        int maxi = -1,account = 0,index = 0;
        for(int i = 1;i <= 100; ++i)
        {
            if(days[i])
                ++account;
            else{
                if(cards >= 1)
                    ++account,--cards;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX