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 1224. Spiral

What is the test case 10 ???
Posted by Nayeem Reza 12 Dec 2013 02:53
#include<cstdio>
#include<cstring>
#include<cassert>
#include<vector>
#include<list>
#include<queue>
#include<map>
#include<set>
#include<deque>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<fstream>
#include<typeinfo>
#include<locale>
#include<iterator>
#include<valarray>
#include<complex>
using namespace std;

int main()
{
    int n,m;

    while(cin>>n>>m){
        int sum = 0,flag = 0,count = -1,x=n*m;
        n--;
        if(n==0 || m==0){
            cout<<"0"<<endl;
            continue;
        }
        while(sum < x){
            if(flag==0){
                sum += m;
                flag = 1;
                m--;
            }
            else if(flag==1){
                sum += n;
                flag = 0;
                n--;
            }
            count++;
        }
        cout<<count<<endl;
    }

    return 0;
}

here is my code, it has got verdict WA in test case 10....