# A Theatre Square（数学）

## 公式

ans=ceil(n/a)+ceil(m/a)

## 代码

#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n,m,a;
cin>>n>>m>>a;
cout<<(n/a+(n%a!=0))*(m/a+(m%a!=0));
}


## 代码

#include <bits/stdc++.h>
char s[666666],ss[666666];
void print(int x)
{
if(!x)
return;
print((x-1)/26);
putchar('A'+(x-1)%26);
}
int main()
{
int t,n,m;
scanf("%d",&t);
while(t--)
{
double sum=0;
scanf("%s",s);
if(sscanf(s,"R%dC%d",&n,&m)==2)
print(m),printf("%d\n",n);
else
{
sscanf(s,"%[A-Z]%d",ss,&n);
int len=strlen(ss);
for(int i=0;i<len;i++)
sum+=(ss[i]-'A'+1)*pow(26,len-i-1);
printf("R%dC%.0f\n",n,sum);
}
}
}


# C Ancient Berland Circus（数学）

## 代码

#include <bits/stdc++.h>
using namespace std;
double gcd(double a,double b)
{
return a<0.01?b:gcd(fmod(b,a),a);
}
double pi=acos(-1);
int main()
{
/*ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);*/
double x1,y1,x2,y2,x3,y3;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
double b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
double c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
double p=(a+b+c)/2;
double s=sqrt(p*(p-a)*(p-b)*(p-c));
double r=(a*b*c)/(4*s);
double A=acos((b*b+c*c-a*a)/(2*b*c));
double B=acos((a*a+c*c-b*b)/(2*a*c));
double C=acos((a*a+b*b-c*c)/(2*b*a));
double ang=gcd(gcd(A,B),C);
double n=pi/ang;
printf("%.6f",n/2.0*r*r*sin(2*pi/n));
}

posted @ 2019-01-18 11:57  baccano!  阅读(71)  评论(0编辑  收藏