HANOI, Vietnam— President Barack Obama and his Vietnamese counterpart announced sweeping new cooperation Monday to bolster both countries' military might, an accord prompted by the rise of China and that until recently seemed inconceivable for the two wartime foes.