|
|
вернуться в форумcan u help me? here is my code #include<iostream> using namespace std; int main(){ int petr,a,taxi,b; int temp; while(cin>>petr>>a>>taxi>>b){ if(petr>=taxi)cout<<petr<<endl;
else{ temp=taxi-petr; if(a<=b){ while(temp>b){ petr+=a,taxi-=b; temp=taxi-petr; } cout<<petr+a<<endl; } else{ while(temp>a){ petr+=a,taxi-=b; temp=taxi-petr; } cout<<taxi<<endl; } } } } i pass all the test that the discuss give but i still get wa at #4 could u give me some new test? Re: can u help me? here is my code if(a<=b) ---> if(a<b) but i still get wa at #13 Re: can u help me? here is my code Послано Fox 20 мар 2008 17:55 for exanmple try test 1000 2 2000 3 the right answer is 1400 but your prog output 1402 or try this 1 2 12 3 right is 6 but yours is 7 Edited by author 20.03.2008 17:57 Re: can u help me? here is my code Thank u very much! Re: can u help me? here is my code thanks for 2nd test, it really helpfull) Re: can u help me? here is my code Thanks a lot... ^_^ Re: can u help me? here is my code // solve #include <iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; while(a< c) { if(a+b > c) { a=c; break; } a= a+b; if(c <= a) { break; } c = c-d; }
cout<<a<<endl; return 0; } |
|
|