//\\__ hr1212 __//\\
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%lf",&a)
#define sii(a,b) scanf("%lf %lf",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%lf\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 100
#define MOD 1000000007
#define F first
#define S second
double n,m,x[MAX],y[MAX];
vector<pair<double,double> > v;
int main(){
double r,c=0,t,l,z,x1=0,y1=0,theta,rad,tm;
ll ans=0;string p;
int i,j,k;
while(sii(n,z)!=EOF){
v.clear();
v.pb(mp(0,0));
f(i,1,n+1){
sii(l,r);
v.pb(mp(l,r));
}
clr(x,0);clr(y,0);
f(i,0,n){
f(j,i+1,n+1){
tm=v[i+1].S;
r=v[i+1].F;
theta=z*(360)/tm;
while(theta>=360){
theta-=360;
}
rad=theta*M_PI/180;
x[j]+=r*cos(rad);y[j]+=r*sin(rad);
}
}
f(i,1,n+1){
l=sqrt(x[i]*x[i]+y[i]*y[i]);
if(i!=n)
printf("%.4lf ",l);
else
printf("%.4lf\n",l);
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%lf",&a)
#define sii(a,b) scanf("%lf %lf",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%lf\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 100
#define MOD 1000000007
#define F first
#define S second
double n,m,x[MAX],y[MAX];
vector<pair<double,double> > v;
int main(){
double r,c=0,t,l,z,x1=0,y1=0,theta,rad,tm;
ll ans=0;string p;
int i,j,k;
while(sii(n,z)!=EOF){
v.clear();
v.pb(mp(0,0));
f(i,1,n+1){
sii(l,r);
v.pb(mp(l,r));
}
clr(x,0);clr(y,0);
f(i,0,n){
f(j,i+1,n+1){
tm=v[i+1].S;
r=v[i+1].F;
theta=z*(360)/tm;
while(theta>=360){
theta-=360;
}
rad=theta*M_PI/180;
x[j]+=r*cos(rad);y[j]+=r*sin(rad);
}
}
f(i,1,n+1){
l=sqrt(x[i]*x[i]+y[i]*y[i]);
if(i!=n)
printf("%.4lf ",l);
else
printf("%.4lf\n",l);
}
}
return 0;
}
No comments:
Post a Comment