uva

Is Levenshtein's distance the right way to tackle this Edit Steps problem?

I'm familiar with Levenshtein's distance, so I decided I would use it to solve UVA's Edit Steps Ladder problem. My solution is: import java.io.*; import java.util.*; class LevenshteinParaElJuez implements Runnable{ static String ReadLn(int maxLength){ // utility function to read from stdin, ...

Uva's 3n+1 problem

I'm solving Uva's 3n+1 problem and I don't get why the judge is rejecting my answer. The time limit hasn't been exceeded and the all test cases I've tried have run correctly so far. import java.io.*; public class NewClass{ /** * @param args the command line arguments */ public static void main(String[] args) th...

UVa #112 Tree Summing

I'm working on UVa #112 Tree Summing. I have what I think should be a working solution but it is not accepted by the online judge due to a basic misunderstanding of the problem on my part. Consider the following inputs: -1 (-1()()) 77 (77(1()())()) or diagrammatically, the trees look like: -1 77 / \ / \ (...

How can I get the following compiled on UVA?

Note the comment below. It cannot compiled on UVA because of a bug in GCC. #include <cstdio> #include <cstring> #include <cctype> #include <map> #include <stdexcept> class Board { public: bool read(FILE *); enum Colour {none, white, black}; Colour check() const; private: struct Index { size_t x; ...

UVA #10410 Tree Reconstruction

I have worked on UVA 10410 Tree Reconstruction several days. But I can't get the correct answer unitl now. I have used an algorithm similar to the one which we always use to recovery a binary tree through the preorder traversal and the inorder traversal. But it can't work. Can anyone help me? Thanks in advance. ...

uvaoj 208 how can i speed up my program

why my program Time Limited Error? because of the sort? this is the question link text #include <cstdio> #include <cstring> using namespace std; int map[22][44]; int book[22]; int total; int sum; int way[22]; int tails[22]; int tail; void init() { memset(map,0,sizeof(map)); memset(book,0,sizeof(book)); sum =0; memset(way,0,size...

UVa 3n+1 Case Recursive Stack Overflow

hi, im trying to solve this very first challange but i get stuck, i like fast program, so i decided to use recursive method not iteration unfortunately, when the input is a big integer (100000 > input > 1000000), its often crash so i debug it, and it shows stack overflow error please help me, i dont know what to do, ive tried to chang...

How c++ assert() can create an infinite loop?

Robot judges suck! I've been accepted by UVA, only after removing the following chunks of code: cin >> ntc; /* extract newline from previous read */ char dummy(0); cin.get(dummy); assert( '\n'==dummy ); /* newline extract completes */ Replacing it with : cin >> ntc; getline( cin, inputN ); /* extract remaining '\n' */ Before replac...

(Yet Another) UVa 3n+1 Help Question

Hi, I have been beating my head against the wall trying to figure out why this is returning "Wrong Answer." I'd greatly appreciate any feedback. Edit: I reposted the code, and this version finally fixed the "Runtime Error" by allowing for multiple spaces between the number pair. It now is saying "Wrong Answer" but as far as I can tel...