Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- using namespace std;
- ofstream fout("furnici.out");
- int main()
- {
- char dir;
- int i,n,x,rez=0,l;
- freopen("furnici.in", "r", stdin);
- scanf("%d %d",&l,&n);
- for(i=0;i<n;i++)
- {
- scanf("%d %c\n",&x,&dir);
- if(dir=='S')
- rez=max(rez,x);
- else
- rez=max(rez,l-x);
- }
- fout<<rez;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement