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

Автор alpercakan, история, 9 лет назад, По-английски

Since n <= 100, I thought backtracking wouldn't be fast enough (not tried). So, only other solution I could think is greedy solution (sort vertices by degree, start coloring from the one with lowest degree). It seems correct to me (altough I can't prove it) but it gives WA. Anybody can show me how to prove or disprove it (Or maybe how to make greedy work, maybe with some change like trying all nodes with the same degree)?

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

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

Автор alpercakan, история, 9 лет назад, По-английски

For the problem UVa-579 I get AC if I use ((h*60)*0.5)+(m*0.5)-(m*6) for calculation, but if I use (h*30+m/2)-(m*6) I get WA. I know that it's something about precision problem (like comparison), but answer is printed with 3 digits after decimal point; so I didn't think this kind of change in calculation would be a problem. I don't know what's the best way for this kind of calculations. How should I calculate?

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

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