the code is right,at least for two samles, but two slow to work out the answer