You win some, you lose some. You get the perfect job -- the one your heart is set on. Or you get snubbed. You win the girl (or guy) of your dreams -- or you strike out. Such are life's ups and downs.

But what if you win and lose at the same time? You land a good job -- but not a great one. Or you do get a plum offer -- but not the one you wanted?

A study published in an upcoming issue of Psychological Science, a journal of the Association for Psychological Science, says you'll find a way to be happy anyway.

"Good outcomes have relative value and absolute value, and that affects our happiness," explains Carnegie Mellon assistant professor Karim S. Kassam, who conducted the study with Carnegie colleague Carey K. Morewedge, Daniel T. Gilbert of Harvard University, and Timothy D. Wilson of the University of Virginia.

If you're a "winner" -- you get the best, relative to the alternatives -- you're happy regardless of the prize's absolute value.

"Losers" -- who win something less valuable than the alternative -- may at first be disappointed, but they usually come around. "People are motivated to think about things in the best possible light," says Kassam. So they move on to reflect on the absolute value, and find satisfaction there.

To test these phenomena, the authors ran two experiments. In the first, 297 people on the Boston streets were given lottery tickets. They were asked to scratch off one side and received cash in the amount printed underneath-$1, $3, $5, or $7. Then they scratched off the other side, revealing either a higher or lower amount. Afterwards, they completed questionnaires rating their happiness, disappointment, or regret.

The "winners" (who got the bigger of two amounts) were, unsurprisingly, happier than the losers -- but also equally happy with any prize. The losers' happiness, by contrast, increased with the prize amounts.

How does this work? A second experiment tested the hypothesis that the losers think harder to find happiness. The researchers distracted the participants brains while asking them to consider differing rewards.

In four trials, 31 participants were asked to memorize either a two- or an eight-digit number and choose one of two boxes with prize amounts ($3 or $5) inside, which were displayed on a screen. At the end, they were told, they'd receive the amount in one of their chosen boxes, randomly selected. Then both boxes opened. Unknown to the participants, the design made them all losers -- they'd always pick the lesser amount. The combinations of memory difficulty -- "cognitive load" -- and cash received ($3 or $5) varied. In each trial, participants rated their feelings.

Again, larger prizes made these losers happier -- but only when they had enough brainpower to think about it. Under higher cognitive load, they were glad to get either amount.

"When you win something, it's always a positive experience," says Kassam. "But if there's this tinge of negative affect, that motivates people to rationalize, to reframe things in a way that will make them happy." The good news: even if you can't do that extra thinking, you'll settle -- for happiness.