USTC 1121 Herbal Medicine on Diaoyu Islands
来源:互联网 发布:纯粮白酒怎么优化口感 编辑:程序博客网 时间:2024/04/29 05:50
Memory Limit: 65536kb
Diaoyu Islands were, are and will always be an inalienable part of Chinese territory.
In 1372, a Chinese named Yang Tsai landed on Diaoyu Islands for the first time. There was a detailed record about Diaoyu Islands in a book titled Sail with the Wind, a navigation guidebook published during the reign of Emperor Yongle of Ming Dynasty.
As we know, the Empress Dowager Cixi of Qing Dynasty attended to state affairs for several decades. One day Cixi was very satisfied with the medicine presented by Sheng Xuanhuai and she learnt that the ingredients of the medicine came from Diaoyu Islands. In the tenth month of the nineteenth year of Guangxu's reign, Cixi bestowed Diaoyu Islands to Sheng Xuanhuai to gather medicine ingredients.
One of my friends also grows two kinds of Chinese herbal medicine that grow on Diaoyu Islands, Species A and Species B. He planted a small hedge in his garden for he hadn’t found enough branches. He grows all Species A plants inside the hedge, and each Species A plant values two. Meanwhile, he grows all Species B plants outside the hedge, and each Species B plant values one. The hedge shape is a convex polygon.
You are expected to work out a program to calculate the total value of all the plants inside and outside the hedge.
The input contains multiple test cases.
The first line of each test case contains two integers n and m. n (3 <= n <= 50) is the number of vertices of the convex polygon hedge. m (0 <= m <= 10000) is the number of vertices representing all the plants. This is followed by n lines. Each of the n lines contains a pair of integers representing the coordinates of the vertices of the polygon. The vertices are listed in clockwise order. Each of the following m lines contains a pair of integer coordinates describing the location of the every plant. It is guaranteed that no two plants locate in the same place and no plant locates on the boundary of the hedge.
The input is terminated with a single line containing two zeros.
Print a single line containing the total value of all the plants for each test case.
4 24 55 22 11 36 32 20 0
3
来源:34th ACM/ICPC Asia Regional, Hefei, Preliminary
解题:
题目要判断点是否在凸多边形内,给我们的数据先是一个顺时针的凸多边形,而后给我们一些点让我们判断。套用模板直接过的。
- USTC 1121 Herbal Medicine on Diaoyu Islands
- Islands
- islands
- Medicine.java
- USTC 1117
- USTC 1344
- OEM/ODM all kinds of herbal patches
- 基本药物 essential medicine
- ACdream P1003 Medicine
- ZOJ3812--We need Medicine
- Huatuo's Medicine
- Huatuo's Medicine 【水题】
- Huatuo's Medicine HDU
- HDU5551-Huatuo's Medicine
- [USTC]中科大备忘录
- [USTC]中科大备忘录
- [ustc]那些杀手不太冷
- [USTC]中科大备忘录
- JavaScript 仿LightBox内容显示效果
- MFC的一个bug
- javascript事件处理在IE和FireFox中的区别
- 177本名著浓缩成了177句话
- NAT的完全分析及其UDP穿透的完全解决方案
- USTC 1121 Herbal Medicine on Diaoyu Islands
- 查询数据库重复数据
- 初学进程和线程之心得
- Oracle启动服务详解以及手动控制
- 关于Video Renderer和Overlay Mixer
- FLEX应用的整个过程
- (转)gdbserver远程调试的具体实现
- [字符集]Unicode和UTF-8之间的转换详解
- a