c= cafea, s= sendvis; g= gogosi
si primul drumet: 1c+2s+3g= 25
al doilea drumet: 1c+1s+5g=24
al treilea drumet: 3s+1c+1g= ?
daca ne uitam la primii doi drumeti, obervam ca diferenta e de 1 leu, adica : 1s= 2g+1 leu si vom inlocui sendvisul cu 2g+1
adica:
1c+2(2g+1)+3g=25
1c+2g+2+3g=25
1c+5g+2=25
1c+5g=27
si la al doilea drumet:
1c+2g+1+5g=24
1c+7g=25
daca 1c+5g=27 si 1c+5g= 25, asta inseamna ca: 2g= 2 lei, adica g = 1 leu
adica 1s= 2g+ 1 leu= 2*1+1= 3
si dupa inlocuim s si g la primul drumet pt a afla c: 1c+6+3=25, adica 1c= 16 lei
iar pt al treilea drumet avem: 3s+1c+1g= 3*3+1*16+1= 26