Codeforces-Problem 1A


1A. Theatre Square
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.
What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

Input
The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).
Output
Write the needed number of flagstones.

Examples
input
6 6 4
output
4

Problem link:  https://codeforces.com/contest/1/problem/A


Solution

  • [tab]
    • C
      • #include<stdio.h>
        #include<conio.h>
        #include<stdlib.h>
        
        int main()
        {
            int n,m,a;
            long int i,j;
            scanf("%d%d%d",&n,&m,&a);
            i=n/a;
            j=m/a;
            if(i*a!=n)
            i++;
            if(j*a!=m)
            j++;
            printf("%ld",i*j);
        }
        
    • C++
      • #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            int n,m,a;
            long long int i,j;
            cin>>n>>m>>a;
            i=n/a;
            j=m/a;
            if(i*a!=n)
            i++;
            if(j*a!=m)
            j++;
            cout<<i*j;
        }
        



If you have any problem suggestion to post please comment below
3/Technology/post-list
Name

Codeforces,53,Problem Solve,90,Programming Tricks,1,URI,37,
ltr
item
DorHubs: Codeforces-Problem 1A
Codeforces-Problem 1A
codeforces easy problem, code forces 1A solution,
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK1ZQXr2qCljjIF7ODt3ZGheYJiiafl6_9UTCPh7xmOLpl0OODKZtRjsmo3u6nTlCn1nnYUrqlyO5aMaKj3biYwk-xLo3LmPhMUHLvJKq5RjL3Wn3Um13LTcKqf0PkFGaTR-lAu3koNWI/s320/Codeforces-1A.gif
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK1ZQXr2qCljjIF7ODt3ZGheYJiiafl6_9UTCPh7xmOLpl0OODKZtRjsmo3u6nTlCn1nnYUrqlyO5aMaKj3biYwk-xLo3LmPhMUHLvJKq5RjL3Wn3Um13LTcKqf0PkFGaTR-lAu3koNWI/s72-c/Codeforces-1A.gif
DorHubs
https://dorhubs.blogspot.com/2019/06/codeforces-problem-1a.html
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/2019/06/codeforces-problem-1a.html
true
9087637800571592252
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy