Candy bar A has 267 calories
Candy bar B has 255 calories
Work to show:
A+2B=777
2A + B =789
rearrange the first equation to solve for A:
A=777-2B
plug 777-2B in for A in the second equation, and solve for B:
2(777-2B)+B=789
1554-4B+B=789
1554-789=3B
765=3B
B=255
substitute 255 in for B in the first rearranged equation, and solve for A:
A=777-2(255)
A=777-510
A=267
So candy bar A has 267 calories, and candy bar B has 255.