题目来源

F: Shattered Cake
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 N perfectly rectangular pieces of width wi and length li, for 1 < i < N. 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 widthW of the cake is known. The restaurant asks for your help to find out the length L of the cake. Fortunately, all pieces of the shattered cake have been kept.
Input The input consists of the following integers: • on the first line, the widthW of the cake; • on the second line, the number N of shattered pieces; • on each of the next N lines, the width wi and length li of each piece. Limits • 1 6 N 6 5000000; • 1 6W,L 6 10000; • for each 1 6 i 6 N, 1 6 wi,li 6 10000. Output The output should be the integer L.
12
Sample Input
4

7

2 3

1 4

1 2

1 2

2 2

2 2

2 1
Sample Output
6

分析:ACM最水题之一看完,对提高信心很有帮助,题如果看懂还是非常easy的,大致就是知道一个矩形宽,然后矩形变成了N个不一样的小矩形,而且每个矩形的长和宽都知道,求原来矩形的长,怎么样是不是很激动,操动起来吧!!

AC程序

#include <stdio.h>
#include <stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{int i,w,n,a,b,sum;sum = 0;scanf("%d",&w);scanf("%d",&n);while(n--){scanf("%d%d",&a,&b);sum += (a*b);}printf("%d\n",(sum)/w);return 0;
}

Shattered Cake相关推荐

  1. (SWERC 2017)

    文章目录 (SWERC 2017) A Cakey McCakeFace C Macaron 题意: 分析: D Candy Chain E Ingredients 题意 分析 F Shattered ...

  2. [Cake] 1. CI中的Cake

    在上一篇C#Make自动化构建-简介中,简单的介绍了下Cake的脚本如何编写以及通过Powershell或者Bash在本地运行Cake脚本.本篇在此基础上,介绍下如何在CI环境中使用Cake. 1. ...

  3. Codeforces Round #343 (Div. 2) D. Babaei and Birthday Cake 线段树维护dp

    D. Babaei and Birthday Cake 题目连接: http://www.codeforces.com/contest/629/problem/D Description As you ...

  4. hdu 4454 Stealing a Cake(三分之二)

    题目链接:hdu 4454 Stealing a Cake 题目大意:给定一个起始点s,一个圆形.一个矩形.如今从起点開始,移动到圆形再移动到矩形.求最短距离. 解题思路:在圆周上三分就可以.即对角度 ...

  5. hdu 1722 Cake 数学题

    Cake                                                                   Time Limit: 1000/1000 MS (Jav ...

  6. 记录使用 Cake 进行构建并制作 nuget 包

    书接上一回(https://www.cnblogs.com/h82258652/p/4898983.html)?[手动狗头] 前段时间折腾了一下,总算是把我自己的图片缓存控件(https://gith ...

  7. zoj 3511 Cake Robbery(线段树)

    题目链接:zoj 3511 Cake Robbery 题目大意:就是有一个N边形的蛋糕.切M刀,从中挑选一块边数最多的.保证没有两条边重叠. 解题思路:有多少个顶点即为有多少条边,所以直接依照切刀切掉 ...

  8. .net持续集成cake篇之cake介绍及简单示例

    cake介绍 Cake 是.net平台下的一款自动化构建工具,可以完成对.net项目的编译,打包,运行单元测试,集成测试甚至发布项目等等.如果有些特征Cake没有实现,我们还可以很容易地通过扩展Cak ...

  9. 使用 Cake 推送 NuGet 包到 AzureDevops 的 Artifacts 上

    大家好,我最近在想如何提交代码的时候自动的打包 NuGet 然后发布到 AzureDevOps 中的 Artifacts,在这个过程中踩了很多坑,也走了很多弯路,所以这次篇文章就是将我探索的结果和我遇 ...

  10. [Cake] 2. dotnet 全局工具 cake

    在上篇博客[Cake] 1. CI中的Cake中介绍了如何在CI中利用Cake来保持与CI/CD环境的解耦. 当时dotnet 2.1还未正式发布,dotnet 还没有工具的支持,使得安装cake非常 ...

最新文章

  1. [经验]无线鼠标和无线键盘真的不能用了?——雷柏的重生之路~
  2. Nature:寻找记忆的痕迹
  3. 中国蚁剑的下载、安装与使用
  4. AMD和CMD出生的背景和它们解决的问题
  5. ASP应用之模板采用
  6. mysql 去掉默认约束_06. 默认约束-创建、添加和删除
  7. gcd常见结论及gcd与斐波那契结合--hdu6363.
  8. 更改mysql数据库存储引擎_MySQL更改数据库表的存储引擎
  9. Open***+ldap配置过程
  10. tinymce的中文语言包
  11. verilog实现pwm
  12. 开盘跳空是否透露超额收益?A股跳一跳因子挖掘
  13. upgrade-insecure-requests强制转http为https
  14. galgame序列号怎么查看_国行Switch能完整体验的游戏有哪些?Switch支架掉了怎么办? | Jump指南...
  15. Android 清理应用缓存
  16. android删除通知栏图标,Android开发系列---UI篇---添加和消除通知栏图标
  17. 两个double之间的运算
  18. IT 行业中Dev、RD、CPO、TeamLeader、QA、PM、PO ,HC,TL 分别是什么的简称,他们分别对应的职责是什么?
  19. latex tips 偏导数符号 单词partial+倒三角 \nabla
  20. 写小论文之引言写什么?

热门文章

  1. Java面试题----基础
  2. 电脑的计算机文件打开格式,如何打开zip文件_怎样在电脑上打开zip文件
  3. 文件夹或文件的隐藏和加密20201024
  4. 杭州电子科技大学acm--2012
  5. 阿阿斯顿发沙发是地方撒旦法
  6. 货币的一种互联网体系架构
  7. python大纲图_干货!!python自学大纲!
  8. 《时代三部曲》感悟四
  9. 读《天才在左,疯子在右》
  10. Asp.net中GridView使用详解