لینکهای مفید برای شرکت در مسابقه:
توجه کنید که سوالات مسابقه ترتیب خاصی ندارند.
میتوانید سوالات خود را از قسمت "سوال بپرسید" مطرح کنید.
A rectangular cake is transported via a truck to a restaurant. On the way to the destination, the truck hits a pothole, which shatters the cake in perfectly rectangular pieces of width and length , for .
At the destination, the damage is assessed, and the customer decides to order a replacement cake of the same dimensions. Unfortunately, the original order form was incompletely filled and only the width of the cake is known. The restaurant asks for your help to find out the length of the cake.
Fortunately, all pieces of the cake have been kept.
The input consists of the following integers:
The output should be the integer .
برای حل این سوال از مساحت کیکهای خورد شده استفاده میکنیم.
به وضوح مساحت کیک بزرگتر برابر است با مجموع مساحتهای کیکهای خرد شده. حال میتوانیم از جمع مساحت مستطیلهای ورودی، مساحت مستطیل بزرگتر را به دست آورده و با تقسیم آن بر که یکی از ابعاد مسطیل است، مقدار که همان بعد دیگر مستطیل است، به دست میآید.