I'm with 45.308 on this one concerning the awareness, it all comes down to luck. I don't have a bunch of bear experience, but I had a tricky encounter one time when we flew up to Ft. Drum for some cross training with the 10th Mountain. Out in the bush, HLZ on one side, road on the other, and my sniper partner and I teamed up with a Javelin Team's OP/LP in a small strip of treeline to get some shuteye before nightfall. It was in the afternoon and the guys were awake and alert, but they wake me up saying "Sergeant, Sergeant, there's a bear...". I'm thinking it's out in the HLZ where we were staging our MRE trash (we were briefed about that), tell them to not worry about it, leave him alone and he'll go about his business and roll over to go back to sleep, but they reply "he's in our 'pos'". OK, I'm awake now... I look up and there's a ~250lb black bear about 5yds away from me and they're asking me if I have any live ammo. Of course the most I have is some blanks for the M40 due to getting busted before for having "security ammo" and not wanting to get jacked up again. We leave him be, he goes up to our other OP/LP position and scares the shit out of that guy by standing up on his hind legs growling with an MRE in his mouth about 3 yards away face to face, then takes off not to be seen again.
The learning point of the story is even with six Marines on OP/LP actually watching, a bear was still able to close within 10yds before being spotted. Vegetation and terrain have a big play in whether you see them before they're right on top of you within a distance they can close in the blink of an eye. I still think the best gun for the woods is just like the best gun for any self defense situation; it's the one on you that you know how to use in a split second, and I hope the ER is nearby to sew you up.