Ivy_End's blog

By Ivy_End, 10 years ago, In English

1A - Theatre Square

Analysis

Calculate the number of flagstones used to cover the length and width, then multiply them to get the correct answer.

Notice: Pay attention to the data range. Use unsigned long long

Solution

#include <iostream>

using namespace std;

int main()
{
    unsigned long long n, m, a, ans = 0;
    cin >> n >> m >> a;
    if(n % a == 0) { n /= a; }
    else { n = n / a + 1; }
    if(m % a == 0) { m /= a; }
    else { m = m / a + 1; } 
    cout << n * m << endl; 
    return 0; 
} 
  • Vote: I like it
  • -30
  • Vote: I do not like it

| Write comment?
»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can you write it in English,please?