Блог пользователя Tyr

Автор Tyr, 12 лет назад, По-английски

Hi !

Can any of java coders provide me a good template for submitting solutions in different online judges ? I always have trouble with StringTokenizer and so on..., maybe you say so forget java ! and code in C++ but I say java is Cool and java coders are different so I want to be different to (despite the fact that language is nothing but a tool and algorithm and problem solving is important as we see in Knuth TAOCP that he uses Assembly !)

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор Tyr, 12 лет назад, По-английски

Hi, I want to generate bit strings of length n and exactly m ones I came up with this algorithm but can't make it more efficient any Idea ? or am I doing optimization right ?


// cin >> number >> no; // sample input 3 1 // smaple output: // 0 0 1 // 0 1 0 // 1 0 0 int number, nOnes, no; int solution[10000]; void backtrack(int n) { if(n == number) { if(nOnes == no) print(); } else { int candidates[] = {0, 1}; for(int i = 0; i < 2; i++) { if(candidates[i] == 1) { nOnes += 1; if(nOnes > no){ nOnes--; return; } } solution[n] = candidates[i]; backtrack(n + 1); if(candidates[i]) nOnes -= 1; } } }

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор Tyr, 12 лет назад, По-английски

Hi

Yesterday I just found this site "jutge.org" and I thought that it's great site for newbies (like me)

my question is , have (has?) anybody participated in this site and solved problems and how he/she evaluates the material of this site ? Does it worth spending a summer solving tasks listed in "Algorithm" course by this website ? Please leave a comment if you have something to say :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • -16
  • Проголосовать: не нравится