10010.c

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=951

Haha ,I solve it today,not difficult but a lot of work to do and details to notice.