1 solutions

  • 0
    @ 2025-11-5 17:16:51

    C :

    #include<stdio.h>
    int main()
    {
        long int n,m,a,s;
        while(~scanf("%ld%ld%ld",&n,&m,&a))
        {
            s=((m+a-1)/a)*((n+a-1)/a);
            printf("%ld\n",s);
        }
       return 0;
    }
    

    C++ :

    #include<cstdio>
    #include<iostream>
    #include<cmath>
    
    using namespace std;
    
    int main()
    {
    //    freopen("in.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
        long long n, m, a;
        while(cin >> n >> m >> a)
        {
            long long tn = (n % a == 0 ? n / a : n / a + 1);
            long long tm = (m % a == 0 ? m / a : m / a + 1);
            cout << tn * tm << endl;
        }
        return 0;
    }
    
    
    • 1

    Information

    ID
    18245
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By