There are two solutions:
(1) http://codeforces.net/gym/100395/submission/8702299 Compiler : GNU C++ time: 3000 ms
(2) http://codeforces.net/gym/100395/submission/8702312 Compiler : MS C++ time: 670 ms
Why is visual studio so fast working with double?
deleted
Links redirect to mainpage.