A team of top U.S. high school math students, including two from the Washington suburbs, has placed second in the 20th International Mathematical Olympiad, a two-day test of mathematical reasoning and creativity held in Bucharest, Romania.

The U.S. had been ahead in the contest, conducted on July 6 and 7, until the final problem on which Romania scored high to win the event.

One American, Mark Kleiman, of New York City, was the only competitor from any of the 17 countries participating to receive a perfect mark of 40.

Ehud Reiter, 17, of Rockville, who was graduated last month from Thomas Wooton High School in Montgomery County, had 31 points to finish second on the eight-member American team. Randall Dougherty, 17, a June graduate of W.T. Woodson High School in Fairfax County, finished fourth among the Americans with 29 points.

Last Spring Dougherty scored highest in the country in a nationwide competition involving about 370,000 students to pick the U.S. team. Reiter was second in that test, sponsored by the Mathmatiematical Association of America.

The United States won the International Olympiad last year for the first time, with Dougherty, who made the team three years in a row, getting a perfect mark.

According to Samuel Greitzer, a retired professor at Rutgers in New Jersey who coaches the U.S. team, Dougherty had an upset stomach during this year's Olympiad. But Dougherty said his stomach had nothing to do with his score.

"I just missed some," he said.

Dougherty, who is the son of a Navy captain, said he plans to enter the University of California at Berkeley in September to major in math after a summer of doing "hopefully nothing."

For Reiter, whose father is a geophysicist, it was his first year on the U.S. math team. He said he doesn't know what he will specialize in when he enters Harvard in the fall.

"This year there's been so much math," Reiter said. "It's made me kind of sick of math. I need a break from it.

"You know, the best part of the (contest) program was not the math. It was meeting all the people."

Final team scores in the Olympiad were Romania, 237; United States, 225; Great Britain, 201; Vietnam, 200, and Czechoslovakia, 195.

The Soviet Union, Hungary and East Germany, which traditionally score well in the contest, did not participate this year.