1796227230a:3:{s:6:"coding";a:15:{i:0;O:8:"stdClass":4:{s:2:"id";i:771;s:5:"title";s:51:"Fraction String to Decimal and Percentage Formatter";s:5:"level";s:4:"Hard";s:8:"question";s:1069:"
Problem Name: Fraction String to Decimal and Percentage Formatter
Problem Description:
Read a fraction string in the form "num/den" (e.g., "3/8"). Parse numerator and denominator as integers, compute the floating-point value, and print both the decimal (to 4 decimal places) and the percentage (to 2 decimal places with a % sign).
Formula / Concept:val = num / den; f"{val:.4f} {val:.2%}"
Input Format:
A single string "num/den" where den != 0.
Output Format:
Print decimal (4 places) and percentage (2 places with %) separated by a space.
Constraints:
-10^6 <= num <= 10^6, 1 <= den <= 10^6
Algorithm (Notes):
Problem Name: Mixed Base Sum (Binary, Octal, and Hexadecimal)
Problem Description:
Read three strings on one line: a binary number B, an octal number O, and a hexadecimal number H (without prefixes). Convert each to decimal using int(s, base) and print their sum in decimal and uppercase hexadecimal.
Formula / Concept:total = int(b, 2) + int(o, 8) + int(h, 16)
Input Format:
Three space-separated strings: B (base 2), O (base 8), H (base 16).
Output Format:
Print the decimal sum and uppercase hexadecimal sum separated by a space.
Constraints:
Each input represents a non-negative integer <= 10^8.
Algorithm (Notes):
Problem Name: Parse HH:MM:SS Time into Total Seconds and Decimal Minutes
Problem Description:
Read a timestamp in HH:MM:SS format, parse hours, minutes, and seconds using split(":") and int(), then compute total seconds and total minutes (as a float formatted to 2 decimal places).
Formula / Concept:total_sec = h * 3600 + m * 60 + s; total_min = total_sec / 60
Input Format:
A single string in HH:MM:SS format.
Output Format:
Print total seconds (integer) and total minutes (to 2 decimal places) separated by a space.
Constraints:
0 <= HH <= 99, 0 <= MM <= 59, 0 <= SS <= 59
Algorithm (Notes):
Problem Name: Scientific Notation and Fixed-Point Formatter
Problem Description:
Read a floating-point number X and an integer precision P. Print X in fixed-point format with P decimals and in lowercase scientific notation with P decimals, separated by a space.
Formula / Concept:f"{x:.{p}f} {x:.{p}e}"
Input Format:
Two space-separated values: float X and integer P.
Output Format:
Print fixed-point and scientific notation representations separated by a space.
Constraints:
-10^9 <= X <= 10^9, 0 <= P <= 6
Algorithm (Notes):
Problem Name: Parse Date DD/MM/YYYY and Output ISO Format YYYY-MM-DD
Problem Description:
Read a date string in D/M/YYYY or DD/MM/YYYY format, parse day, month, and year as integers, and output it zero-padded in ISO-8601 format YYYY-MM-DD.
Formula / Concept:d, m, y = map(int, input().split("/")); f"{y:04d}-{m:02d}-{d:02d}"
Input Format:
A single date string in DD/MM/YYYY format.
Output Format:
Print the date in YYYY-MM-DD format.
Constraints:
1 <= d <= 31, 1 <= m <= 12, 1 <= y <= 9999
Algorithm (Notes):
Problem Name: Convert Feet and Inches to Centimeters
Problem Description:
Read a height given as feet and inches (two integers) and convert it into centimeters using 1 foot = 12 inches and 1 inch = 2.54 cm.
Formula / Concept:total_inches = feet * 12 + inches; cm = total_inches * 2.54
Input Format:
Two space-separated integers: feet and inches.
Output Format:
Print the height in centimeters formatted to 2 decimal places.
Constraints:
0 <= feet <= 100, 0 <= inches <= 11
Algorithm (Notes):
Problem Name: Comma-Separated Integers Sum and Product
Problem Description:
Read four integers separated by commas (e.g., 2,3,4,5). Parse them using split(","), cast to int, and print their sum and product.
Formula / Concept:a, b, c, d = map(int, input().split(","))
Input Format:
A single line containing four comma-separated integers.
Output Format:
Print the sum and product separated by a space.
Constraints:
-1000 <= a, b, c, d <= 1000
Algorithm (Notes):
Problem Name: Formatted Item Invoice Line
Problem Description:
Read an item name, integer quantity, and unit price (float). Compute the total cost and print it in the format: "<item> x <qty> = $<total>" where total has thousands separators and 2 decimal places.
Formula / Concept:f"{item} x {qty} = ${total:,.2f}"
Input Format:
Line 1: item name. Line 2: integer quantity. Line 3: float unit price.
Output Format:
Single formatted invoice line.
Constraints:
1 <= qty <= 10^6, 0 <= price <= 10^6
Algorithm (Notes):
Problem Name: Base-N String to Decimal Conversion
Problem Description:
Given a string S representing a non-negative integer in base B (2 <= B <= 36), cast it to a base-10 integer using int(S, B) and print the decimal value.
Formula / Concept:int(S, B)
Input Format:
One line containing string S and integer base B separated by a space.
Output Format:
Print the base-10 integer value.
Constraints:
2 <= B <= 36, 1 <= len(S) <= 20
Algorithm (Notes):
Problem Name: Float Truncation, Nearest Integer, and Fractional Part
Problem Description:
Read a positive floating-point number X. Print its truncated integer part using int(X), its rounded integer using round(X), and its fractional part (X - int(X)) formatted to 4 decimal places.
Formula / Concept:int(x), round(x), x - int(x)
Input Format:
A single non-negative floating-point number X.
Output Format:
Print int(X), round(X), and fractional part (to 4 decimals) separated by spaces.
Constraints:
0 <= X <= 10^6
Algorithm (Notes):
Problem Name: String Concatenation vs Integer Addition
Problem Description:
Read two numeric strings S1 and S2. First print their string concatenation (S1 + S2), and on the same line separated by a space, print their numeric sum after casting both to int.
Formula / Concept:s1 + s2 and int(s1) + int(s2)
Input Format:
Two space-separated numeric strings S1 and S2.
Output Format:
Print the concatenated string and the integer sum separated by a space.
Constraints:
0 <= int(S1), int(S2) <= 10^9
Algorithm (Notes):
Problem Name: Binary, Octal, and Hexadecimal Representation
Problem Description:
Read a non-negative integer N and print its binary, octal, and uppercase hexadecimal representations without prefixes (no 0b, 0o, 0x).
Formula / Concept:f"{n:b} {n:o} {n:X}"
Input Format:
A single non-negative integer N.
Output Format:
Print binary, octal, and uppercase hexadecimal representations separated by spaces.
Constraints:
0 <= N <= 10^9
Algorithm (Notes):
Problem Name: Character to ASCII Code and Code to Character
Problem Description:
Read a single character C and an integer ASCII code K on two lines. Print the ASCII value of C using ord() and the character corresponding to K using chr().
Formula / Concept:ord(c), chr(k)
Input Format:
Line 1: a single printable character C. Line 2: an integer K (32 <= K <= 126).
Output Format:
Print ord(C) and chr(K) separated by a space.
Constraints:
32 <= K <= 126
Algorithm (Notes):
Problem Name: Sum and Average of Three Space-Separated Numbers
Problem Description:
Read three space-separated floating-point numbers from a single line, cast them to float, and print their sum and average formatted to 2 decimal places.
Formula / Concept:a, b, c = map(float, input().split()); avg = (a + b + c) / 3
Input Format:
One line containing three space-separated numbers.
Output Format:
Print Sum and Average formatted to 2 decimal places separated by a space.
Constraints:
-10^6 <= a, b, c <= 10^6
Algorithm (Notes):
Problem Name: Formatted Student Profile Output
Problem Description:
Read a student's name (string), age (integer), and GPA (float) on three separate lines, and print a formatted profile string: "Name: <name> | Age: <age> | GPA: <gpa>" with GPA rounded to 2 decimal places.
Formula / Concept:f"Name: {name} | Age: {age} | GPA: {gpa:.2f}"
Input Format:
Line 1: Name (string). Line 2: Age (integer). Line 3: GPA (float).
Output Format:
Single formatted line as specified.
Constraints:
1 <= len(Name) <= 50, 1 <= Age <= 120, 0.0 <= GPA <= 10.0
Algorithm (Notes):