Posts

Showing posts from March, 2022

power

  Integers in Python can be as big as the bytes in your machine's memory. There is no limit in size as there is:     (c++ int) or     (C++ long long int). As we know, the result of   grows really fast with increasing  . Let's do some calculations on very large integers. Task Read four numbers,  ,  ,  , and  , and print the result of  . Input Format Integers  ,  ,  , and   are given on four separate lines, respectively. Constraints Output Format Print the result of   on one line. Sample Input 9 29 7 27 Sample Output 4710194409608608369201743232 Note : This result is bigger than  . Hence, it won't fit in the long long int of C++ or a 64-bit integer. # Enter your code here. Read input from STDIN. Print output to STDOUT print ( int ( input ())** int ( input ())+ int ( input ())** int ( input ()))

Triangle Quest 2

  You are given a positive integer   . Your task is to print a palindromic triangle of size  . For example, a palindromic triangle of size   is: 1 121 12321 1234321 123454321 You can't take more than two lines. The first line (a  for -statement) is already written for you. You have to complete the code using exactly one print statement. Note : Using anything related to  strings  will give a score of  . Using more than one  for -statement will give a score of  . Input Format A single line of input containing the integer  . Constraints Output Format Print the palindromic triangle of size   as explained above. Sample Input 5 Sample Output 1 121 12321 1234321 123454321 for  i  in   range ( 0 , int ( input ())):  #More than 2 lines will result in 0 score. Do not leave a blank line also      print  ((...

ACB Angle

Image
   is a right triangle,   at  . Therefore,  . Point   is the midpoint of hypotenuse  . You are given the lengths   and  . Your task is to find   (angle  , as shown in the figure) in degrees. Input Format The first line contains the length of side  . The second line contains the length of side  . Constraints Lengths   and   are natural numbers. Output Format Output   in degrees. Note:  Round the angle to the nearest integer. Examples : If angle is 56.5000001°, then output  57° . If angle is 56.5000000°, then output  57° . If angle is 56.4999999°, then output  56° . Sample Input 10 10 Sample Output 45° import  math degree_sign = u '\N{DEGREE SIGN}' print (   str ( round (math.degrees(math.atan( int ( input ())/ int ( input ()))) ))+ str (degree_sign))