cf 1A Theatre Square

After finishing more than ten CF A and B questions, I couldn't wait to start writing my first blog to commemorate the beginning of my ACM.

Pure white, there are many shortcomings in the code, I hope you can advise. I also hope that my problem-solving report can be of little help to you.

1,CodeForces 1A

Theatre SquareClick    here to open the link

The meaning of the question: There is an area of ​​n*m that requires you to cover it with a*a bricks that can overlap. Find the minimum number of bricks

Idea: Treat n and m separately, and replace the area problem with a line problem. Find the lines with length a respectively

It is enough to cover the required number of lines of length n and m.

#include <iostream>
#include<cstdio>
using namespace std;


intmain()
{
    long long  n,m,a;
    long long ans=1;
    scanf("%lld%lld%lld",&n,&m,&a);
    if(n%a==0)
        years*=n/a;
    else
        years*=n/y+1;
    if(m%a==0)
        years*=m/y;
    else
        years*=m/y+1;
    printf("%lld\n",ans);
    return 0;
}

   

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326608627&siteId=291194637