Update 1001.cpp

My Answer to 1001