본문 바로가기

분류 전체보기68

[Lucky Algorithm] Time Conversion Given a time in -hour AM/PM format, convert it to military (-hour) time. Note: Midnight is on a -hour clock, and on a -hour clock. Noon is on a -hour clock, and on a -hour clock.Input FormatA single string containing a time in -hour clock format (i.e.: or ), where and .Output FormatConvert and print the given time in -hour format, where . import java.io.*; import java.util.*; import java.text.*;.. 2017. 10. 4.
[Lucky Algorithm] Birthday Cake Candles Colleen is turning years old! Therefore, she has candles of various heights on her cake, and candle has height . Because the taller candles tower over the shorter ones, Colleen can only blow out the tallest candles.Given the for each individual candle, find and print the number of candles she can successfully blow out.Input FormatThe first line contains a single integer, , denoting the number of.. 2017. 10. 3.
[Lucky Algorithm] Staircase Consider a staircase of size : # ## ### #### Observe that its base and height are both equal to , and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.Write a program that prints a staircase of size .Input FormatA single integer, , denoting the size of the staircase.Output FormatPrint a staircase of size using # symbols and spaces.Note: The last line mus.. 2017. 10. 3.
[Lucky Algorithm] Plus Minus Given an array of integers, calculate which fraction of its elements are positive, which fraction of its elements are negative, and which fraction of its elements are zeroes, respectively. Print the decimal value of each fraction on a new line.Note: This challenge introduces precision problems. The test cases are scaled to six decimal places, though answers with absolute error of up to are accep.. 2017. 10. 3.
[Lucky Algorithm] Diagonal Difference Given a square matrix of size , calculate the absolute difference between the sums of its diagonals.Input FormatThe first line contains a single integer, . The next lines denote the matrix's rows, with each line containing space-separated integers describing the columns.ConstraintsOutput FormatPrint the absolute difference between the two sums of the matrix's diagonals as a single integer. impor.. 2017. 10. 3.
[Lucky Algorithm] A Very Big Sum You are given an array of integers of size . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.Input FormatThe first line of the input consists of an integer . The next line contains space-separated integers contained in the array.Output FormatPrint a single value equal to the sum of the elements in the array.Constraints import.. 2017. 10. 3.