umsh1ume's blog

By umsh1ume, history, 7 years ago, In English

I need to select maximum vertices in a graph such that the distance between any two selected vertices is less than the given limit? distance between adjacent nodes is 1. Input n,d meaning number of nodes and the limit d, n-1 lines follows denoting edges. Example 6 5 2 1 2 3 4 2 1 6 5 6

Output 5 As all 5 vertices can be selected within the range d

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By umsh1ume, history, 7 years ago, In English

Character recognition is the conversion of images into text. For now we consider each character in the picture is a N*M matrix with only zeros and ones, and we need to recognize K characters. You are to write a program to find minimal number of pixels so that we can recognize each character. The first line of input is three integers N, M, K (1 <= N, M <= 10, 2 <= K <= 6). Which represents the size of matrix and number of characters. Then is following K blocks, which represents the matrix. Notice that each block starts with a blank line. K is number of character matrices You should output the minimum number of pixels, which is the answer Input 2 3 2 111 010 100 100 output 1

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By umsh1ume, history, 8 years ago, In English

In how many ways can we make n digit number from 1,2 and 3 such that no continuous triplet has distinct integers.Ex: 21231122 will not be counted but 22113311122 will be. i.e. 123 or 321 or 312 or 213 or 132 or 231 should not be present in the number

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By umsh1ume, history, 8 years ago, In English

I was trying to find binomial co-efficient nCr mod 1000000007 (n and r are large) using inverse modulo but there is some error. What is the problem in this code? https://ideone.com/SWPmty

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it