Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Need help with Pascal! Please!


  • Please log in to reply
2 replies to this topic

#1 happiness


    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 09 February 2011 - 12:00 PM

So, here's my problem. =/
This Saturday, from 3 pm to 8 pm in central European time (GMT + 1:00), I'll have to solve like 5 tasks using Pascal. Now, that wouldn't be a problem at all if I had been going to the classes at school. But, since I caught a flu and have been staying in bed for a while, I have no clue on how to deal with arrays and strings. I have only the basic knowledge about syntax and so.
So, ummm... I was wondering if there was anyone who'd be so kind to help me out with those tasks on Saturday?
I'll be thankful forever.
  • 0

#2 Luthfi


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts
  • Programming Language:PHP, Delphi/Object Pascal, Pascal, Transact-SQL
  • Learning:C, Java, PHP

Posted 09 February 2011 - 09:09 PM

Hi there, welcome aboard to CodeCall!

You can start by posting the problems of the tasks, what you have done so far, and where you are "stuck". Perhaps one thread for each task to make the discussion neat and clean.
  • 0

#3 happiness


    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 12 February 2011 - 06:50 AM

The king of Fancyland has bought a piece of land that's in an area which is made from pieces of square shape. The price of the land if being measured by the number of the whole square-shaped pieces [fields] which are on the parcel. Due to this, it's easier to calculate the price of the parcel in Fancyland than in Yukiland. [that’s another random country in the task]. Your task is to write a program which will calculate the price of the parcel which is bought. Pieces of the field which make [form] the parcel form a closed polygon which apexes are corners of square fields. For example, polygon from the picture [which fits the first from the three examples] contains three square fields [square-shaped fields, so its value [price] is 3.

In the first line of standard input is a whole number N [whole number is 3,4,5 and so, not 0.25 or 1/4]
(3<=N<=100). N is the number of apexes of the polygon. In every line of the following N lines there are couples of whole numbers Xi and Yi, coordinates of i-th apex of the polygon. The apexes are given in order in which they appear in the perimeter of the polygon. You can suppose that there won't be coordinates lesser than [under] -500 or bigger [above] 500 and that the polygon will be convex. [because the law in Fancyland says so]


The output has to contain only one line in which there is one whole number [the price (value) of the parcel (piece of land) that is bought. The price equals the number of whole square-shaped fields in it.


1 1
5 3
5 4
3 5

3 3
2 5
3 4
5 2
4 2


0 0
0 -50
-50 -51
-51 -50
-50 0

  • 0

Also tagged with one or more of these keywords: pascal

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download