Created
June 4, 2017 16:55
-
-
Save MohamedTaha98/bae07e93d456639d4e1a8dcd88677cf4 to your computer and use it in GitHub Desktop.
Problem Solving
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
long n, m, a, flagstones; | |
cin >> n >> m >> a; | |
if (n % a == 0 && m % a == 0) | |
flagstones = (n / a) * (m / a); | |
else if (n % a != 0 && m % a == 0) | |
flagstones = ((n / a) + 1) * (m / a); | |
else if (n % a == 0 && m % a != 0) | |
flagstones = (n / a) * ((m / a) + 1); | |
else | |
flagstones = ((n / a) + 1) * ((m / a) + 1); | |
cout << flagstones << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment