Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define boAshraf ios_base::sync_with_stdio(false); cin.tie(NULL);
- #define ll long long
- #define sz(s) (int)(s).size()
- #define all(s) (s).begin(),(s).end()
- using namespace std;
- void File();
- void sol();
- typedef long double ld;
- typedef complex<double> point;
- template<class T>
- istream& operator>>(istream& is, complex<T>& p) {
- T value;
- is >> value;
- p.real(value);
- is >> value;
- p.imag(value);
- return is;
- }
- #define PI acos(-1.0)
- #define EPS 1e-8
- #define X real()
- #define Y imag()
- #define angle(a) (atan2((a).imag(), (a).real()))
- #define length(a) (hypot((a).imag(), (a).real()))
- #define vec(a,b) ((b)-(a))
- #define dp(a,b) ( (conj(a)*(b)).real() )
- #define cp(a,b) ( (conj(a)*(b)).imag() )
- #define normalize(a)(a)/length(a)
- bool same(point p1, point p2) {
- return dp(vec(p1, p2), vec(p1, p2)) < EPS;
- }
- point rotate(point p, double angle, point around = point(0, 0)) {
- p -= around;
- return (p * exp(point(0, angle))) + around;
- }
- int main() {
- boAshraf
- File();
- int t = 1;
- // cin >> t;
- while (t--) {
- sol();
- }
- return 0;
- }
- void sol() {
- point p(0,0);
- int n;
- cin>>n;
- while(n--){
- double ang;
- int d;
- cin>>ang>>d;
- ang*=PI/180;
- point p2(d*cos(ang),d*sin(ang));
- p+=p2;
- }
- cout<<fixed<<setprecision(8)<<length(p)<<'\n';
- }
- void File() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment