zoukankan      html  css  js  c++  java
  • hud 1633 Orchard Trees 点是否在三角形内模板 *

    Orchard Trees

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 418    Accepted Submission(s): 101


    Problem Description
    An Orchardist has planted an orchard in a rectangle with trees uniformly spaced in both directions. Thus the trees form a rectangular grid and we can consider the trees to have integer coordinates. The origin of the coordinate system is at the bottom left of the following diagram: 

    Consider that we now overlay a series of triangles on to this grid. The vertices of the triangle can have any real coordinates in the range 0.0 to 100.0, thus trees can have coordinates in the range 1 to 99. Two possible triangles are shown. 

    Write a program that will determine how many trees are contained within a given triangle. For the purposes of this problem, you may assume that the trees are of point size, and that any tree (point) lying exactly on the border of a triangle is considered to be in the triangle. 
     
    Input
    Input will consist of a series of lines. Each line will contain 6 real numbers in the range 0.00 to 100.00 representing the coordinates of a triangle. The entire file will be terminated by a line containing 6 zeroes (0 0 0 0 0 0). 
     
    Output
    Output will consist of one line for each triangle, containing the number of trees for that triangle right justified in a field of width 4.
     
    Sample Input
    1.5 1.5 1.5 6.8 6.8 1.5
    10.7 6.9 8.5 1.5 14.5 1.5
    0 0 0 0 0 0
     
    Sample Output
      15
      17
     
    Source
     
    这题目有坑,只能枚举从一到九十九,不能节省时间去最小到最大
    彼时当年少,莫负好时光。
  • 相关阅读:
    Redis-Sp:Redis主要功能
    Redis-Sp:Redis介绍
    阿里云-Redis-Help-连接实例-Redis客户端连接:C#客户端StackExchange.Redis
    Samba通过ad域进行认证并限制空间大小《转载》
    SQL函数简述
    SELECT--UNION,UNION ALL,MINUS, INTERSECT,EXISTS
    oracle数据库常用查询一
    oracle以web方式登录EM、ISQLPlus
    关于sys、system、sysman等在EM中登录的问题
    top 命令SQLServer-sybase-oracle
  • 原文地址:https://www.cnblogs.com/l609929321/p/7285946.html
Copyright © 2011-2022 走看看