解:当0<x≤1时,y=x2,当1<x≤2时,ED交AB于M,EF交AB于N,如图,CD=x,则AD=2-x,∵Rt△ABC中,AC=BC=2,∴△ADM为等腰直角三角形,∴DM=2-x,∴EM=x-(2-x)=2x-2,∴S△ENM= 1 2 (2x-2)2=2(x-1)2,∴y=x2-2(x-1)2=-x2+4x-2=-(x-2)2+2,∴y= x2,(0<x≤1) ?(x?2)2+2,(1<x≤2) ,故选:A.