Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cmath>
- using namespace std;
- int main() {
- int n;
- string s;
- double k,m,l=30,l1=4000;
- cin >> n;
- cin >> k;
- for(int i=0;i<n;i++){
- cin >> m >> s;
- if ( (k>m && s=="closer") ||( k<m && s=="further")){
- if ((abs(k-m))/2<l1){
- l1=(abs(k-m))/2;
- }
- }
- else{
- if ((k+m)/2>l){
- l=(k+m)/2;
- }
- }
- k=m;
- }
- cout << l1<< ' ' << l;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement