using System;
public class Test
{
public static void Main()
{
for (decimal x = 1 ; x != 2 ; x+=0.01M) {
decimal y = CustomRound(x);
Console.WriteLine("{0:0.00} {1:0.00}", x, y);
}
}
private static decimal CustomRound(decimal x)
{
var rX = Math.Truncate(x * 100) / 100;
var t = rX * 100 % 5;
return t;
if (t < 3)
rX =- t / 100;
else if (t < 8)
rX =+ t / 100 - 0.05m;
else
rX =+ t / 100;
return rX;
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCWZvciAoZGVjaW1hbCB4ID0gMSA7IHggIT0gMiA7IHgrPTAuMDFNKSB7CgkJCWRlY2ltYWwgeSA9IEN1c3RvbVJvdW5kKHgpOwoJCQlDb25zb2xlLldyaXRlTGluZSgiezA6MC4wMH0gezE6MC4wMH0iLCB4LCB5KTsKCQl9Cgl9CgkKCXByaXZhdGUgc3RhdGljIGRlY2ltYWwgQ3VzdG9tUm91bmQoZGVjaW1hbCB4KQogICAgewogICAgICB2YXIgclggPSBNYXRoLlRydW5jYXRlKHggKiAxMDApIC8gMTAwOwogICAgICB2YXIgdCA9IHJYICogMTAwICUgNTsKICAgICAgcmV0dXJuIHQ7CiAgICAgIGlmICh0IDwgMykKICAgICAgICByWCA9LSB0IC8gMTAwOwogICAgICBlbHNlIGlmICh0IDwgOCkKICAgICAgICByWCA9KyB0IC8gMTAwIC0gMC4wNW07CiAgICAgIGVsc2UKICAgICAgICByWCA9KyB0IC8gMTAwOwogICAgICByZXR1cm4gclg7CiAgICB9Cn0=