ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1087. The Time to Take Stones

what is wrong?
Posted by Levan 7 Jan 2016 18:56
i have WA #2
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    int win = 0;
    for(int i = 0; i < m; i++)
    {
        int a;
        cin >> a;
        n -= a;
        if(i % 2 == 0)
            win = 2;
        else win = 1;
    }

    cout << win << endl;

    return 0;
}