vazhadval's blog

By vazhadval, history, 6 years ago, In English

I get "runtime error on test 1" message and I think my code is OK

Problem name: Theater Square

CODE:

using System;

namespace ConsoleApp6 { class Program { static void Main(string[] args) {

int n = Convert.ToInt32(Console.ReadLine());
        int m = Convert.ToInt32(Console.ReadLine());
        int a = Convert.ToInt32(Console.ReadLine());
        int m1 = 0;
        int n1 = 0;
        if (a >= m)
        {
            m1 = 1;
        }
        if(a<m)
        {
            m1 = m / a + 1;
        }
        if (a >= n)
        {
            n1 = 1;
        }
        if(a<n)
        {
            n1 = n / a + 1;
        }
        Console.WriteLine(m1 * n1);
    }
}

}

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it