|
|
back to boardDiscussion of Problem 1607. TaxiWA #14??? Posted by Argos 18 Sep 2011 11:01 #include "stdio.h" #include "conio.h" #include "iostream" #include "math.h" using namespace std; void main() { int GP,P,GT,S,y=1; scanf("%i",&GP);scanf("%i",&P);scanf("%i",>);scanf("%i",&S); if((GP+P>=GT)||(GP>=GT)) { if(GP>=GT) printf("%i",GP); else if(GP+P>=GT) printf("%i",GT); } else { while(y!=0) { if((GP<GT)&&(y!=0)&&(GP+P<=GT)) GP+=P; else y=0; if((GT>GP)&&(y!=0)&&(GT-S>=GP)) GT-=S; else y=0; } //if(GP>=GT)printf("%i",GP); //else printf("%i",GT); if(GP+P<=GT) printf("%i",GP); else { if(GT-S<=GP) printf("%i",GP); else printf("%i",GT); } } getch(); } |
|
|