Posts

007. Clock Seconds

007. Clock Seconds time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a clock that tells time in the usual way: hours, minutes, and seconds. When you wake up in the morning, you want to figure out how many seconds you slept for. Conveniently, you fell asleep the night before at exactly 12:00 AM. Remember that there are 60 seconds in a minute and 60 minutes in an hour. Input The first line of input contains a positive integer   h   indicating the current number of hours displayed on the clock ( 1   <=   h   <=   11 ). The second line of input contains a positive integer   m   indicating the current number of minutes displayed on the clock ( 0   <=   m   <=   59 ) The third line of input contains a positive integer   s   indicating the current number of seconds displayed on the clock ( 0   <=   s ...

006. Distance

006. Distance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Find the distance between two 2D points. Remember that the distance formula is   𝑑 = ( π‘₯ 2 − π‘₯ 1 ) 2 + ( 𝑦 2 − 𝑦 1 ) 2 ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ √ d = ( x 2 − x 1 ) 2 + ( y 2 − y 1 ) 2 math.sqrt   will calculate the square root of a number. Also, you also have to add the line     import math   at the top of the program. Input The first two lines contain the X and Y coordinates of the first point respectively. The second two lines contain the X and Y coordinates of the second point respectively. Each coordinate will have an integer value between -1000 and 1000, inclusive. Output A double N representing the distance between the two points Examples input Copy 1 1 2 2 output Copy 1.4142135623730951 input Copy 1 1 1 1 output Copy 0.0

005. Fizz Buzz

005. Fizz Buzz time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Take in a number from 1 through 1000, print   Fizz   if the number is divisible by 3, print   Buzz   if the number is divisible by 5, or   FizzBuzz if the number is divisible by both. If none of these conditions are true, print nothing Input The only line of input contains a single positive integer N between 1 and 1000 inclusively Output Fizz ,   Buzz ,   FizzBuzz , or nothing Examples input Copy 1 output Copy input Copy 3 output Copy Fizz input Copy 5 output Copy Buzz input Copy 15 output Copy FizzBuzz

004. Polygons

004. Polygons time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The sum of the angles in a triangle is 180, and the sum of the angles in a square is 360. In fact, the sum of angles in any polygon increases by 180 with each side added to the polygon. In this problem, you must figure out the sum of angles of a polygon, given its number of sides. Input The first line of the input contains a positive integer   T   indicating the number of test cases in the problem. The next   T   lines each contain a positive integer   n   ( 1   <=   n   <=   100 ): the number of sides of each polygon. Output Output   T   integers: the sum of the angles in each polygon. Example input Copy 4 3 4 5 6 output Copy 180 360 540 720

003. Triangle Sum

003. Triangle Sum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Triangles are one of the simplest geometric shapes. Equilateral triangles have the special property of all three of their sides being equal to each other. In this problem, you will be given a list of side lengths of equilateral triangles. You should find the sum of the perimeters of the triangles, given that the triangles are all equilateral. Input The first line of the input will contain a positive integer   n   indicating the number of triangles. Each of the next   n   lines will contain an integer   t , indicating the side length of each triangle. Output Print one number, the calculated sum of the perimeters of the triangles. Example input Copy 3 3 4 6 output Copy 39 Note In the example, the first triangle has a side length of 3, so it has a perimeter of 9. The second triang...

002. Triple Product

  002. Triple Product time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Basic math operations are very important in programming applications. In this problem, your task is to calculate the product of two integers, multiplied by three. Input The first line of input contains a positive integer   a   no greater than 2000. The second line of input contains a positive integer   b   no greater than 2000. Output Print a single positive integer   c : the product of   a   and   b   multiplied by 3. Example input Copy 3 5 output Copy 45

001. Square The Number

  001. Square The Number time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A number squared is defined as the number multiplied by itself. In this problem, given a number   n , print the number   𝑛 2 n 2 . Input The only line of input contains a positive integer   n . Output Print the number   𝑛 2 n 2 :   n   multiplied by itself. Example input Copy 6 output Copy 36

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Setting Up PostgreSQL Logical Replication with Docker Compose

Regex 101: An Introduction to Regular Expressions for Developers