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

Wrong answer 4! Please help!
Posted by Grigorenko Vlad 24 Jun 2012 13:46
#include<stdio.h>

int main(void){
    int n,m;
    unsigned int k;
    scanf("%d %d",&n,&m);
    k=0;
    while(n>2 && m>2){
        k=k+4;
        n-=2;
        m-=2;
    }
    if(n==2 && m>=2)
        k=k+2;
    else
        if(m==2 && n>2)
            k=k+3;
    else
        if(m==1 && n>1)
            k++;
    printf("%d",k);
return 0;
}