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

: please help me why it is wrong
Posted by xinxin 17 Sep 2016 19:54
#include<stdio.h>
#include<string.h>
int f(int n,int m)
{
    if(n==1||m==1)
        return 0;
    if(n==2&&m>1)
        return 2;
    if(n==3&&m==2)
        return 3;
    if(m>2&&n>2)
    return f(n-2,m-2)+4;

}
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    printf("%d",f(n,m));
    fflush(stdin);
    getchar();
    return 0;
}
Re: : please help me why it is wrong
Posted by Egor 30 Oct 2016 16:22
Input "N=1 M=1" doesn't give you zero.