Programming, oops concept, basic to advance coding, article related to computer Science like SQL database and about new technology related to computer Science.
Problem Statement: Given four number x, y, a and b check if there exists a binary string having x 0's and y 1's such that the total number of subsequence equal to the sequence "01" in it is a and the total number of subsequence equal to the sequence "10" in it is b. Given: A binary string is a string made of the character '0' and '1' only. A sequence a is a subsequence of a sequence b if a can be obtained from b by deletion of several element. Input Format The first line contains a single integer T (1<=T<=10^5), denoting the number of test cases. Each of the next T lines contains four integers x, y, a and b (1<=x, y<=10^5, 0<=a, b<=10^9) Sample input: ...
Problem Statement: Given a number in base 10 convert it in base 2, 3, 4,5,.......,9 Code: n=int(input("enter a number with base 10:")) b=int (input("enter the base in which you want to convert:")) p=1 num=0 while(n>0): rem=n%b num=rem*p+num p=p*10 n=n//b print(num) Screansort of code and output:
Comments
Post a Comment