Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int up,down,step=0,highest=0;
- while(cin>>up>>down)
- {
- do
- {
- step+=up;
- if(step>highest)
- {
- highest=step;
- }
- step%=down;
- }while(step!=0);
- cout<<highest<<endl;
- }
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement