User Tools

Site Tools


prelude_to_self-describing_sequence

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
prelude_to_self-describing_sequence [2011/09/20 06:11] – created jtkorbprelude_to_self-describing_sequence [2011/09/20 06:28] jtkorb
Line 1: Line 1:
 ===== Prelude to Self-describing Sequence ====== ===== Prelude to Self-describing Sequence ======
  
-First, start by reading the problem statement for [[http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=33&page=show_problem&problem=990|Self-describing Sequence]].  The input format is the same.+First, start by reading the problem statement for [[http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=33&page=show_problem&problem=990|Self-describing Sequence]]. 
 + 
 +For this prelude, create an array, ''fr'', that contains the index of each place in ''f(n)'' where ''f(n)'' changes values (that is, where the next run of identical values appears). 
 + 
 +  n                      10  11  12 13 14 15 16 
 +  f(n)  1                        6  6  6  7 
 +  fr[n] 1          12  16   ... 
 + 
 +This array is a kind of run-length encoding of function ''f(n)''.
  
 ===== Input ===== ===== Input =====
  
-Like Pairsumonious Numbers, the input is a sequence of test cases, one per line.  The first number on the line is Nfollowed by N*(N-1)/2 additional numbers.+Input consists of a sequence of integers, one per line.  The last entry is a 0which should not be processed.
  
 ===== Output ===== ===== Output =====
  
-Print a line of output for each line of input.  The first number on the line is N*(N-1)/2followed by the N*(N-1)/2 input numbers in sorted order, from lowest to highest.+For each non-zero input value''k'', print the value of ''n'' where ''f(n)'' equals ''k''.
  
 ===== Sample Input ===== ===== Sample Input =====
prelude_to_self-describing_sequence.txt · Last modified: 2011/09/20 06:34 by jtkorb