-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAll_Different_Directions.cpp
More file actions
61 lines (39 loc) · 1.03 KB
/
All_Different_Directions.cpp
File metadata and controls
61 lines (39 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
#include<vector>
#include<string>
#include<typeinfo>
#include<sstream>
#include<cmath>
using namespace std;
int main(){
// do{
// int people_meat;
// cin>> people_meat;
// }while();
string line;
getline(cin,line);
string s;
stringstream ss(line);
vector<string>arr;
while(getline(ss,s,' ')){
arr.push_back(s);
}
double x=stod(arr[0]);
double y=stod(arr[1]);
double walk=stod(arr[5]);
double initial_direction=stod(arr[3]);
double new_x,new_y;
new_x=x+(walk*cos((22*initial_direction)/1260));
new_y=y+(walk*sin((22*initial_direction)/1260));
int i=5;
while(i!=arr.size()-1){
double trun=stod(arr[i+2]);
double walkfurther=stod(arr[i+4]);
new_x=new_x+(walkfurther*cos((22*trun)/1260));
new_y=new_y+(walkfurther*sin((22*trun)/1260));
i=i+4;
}
//kalin angle eketh ekke check karannath oni
cout<< new_x<< " "<<new_y<<endl;
return 0;
}