Codeforces Beta Round #1
A题,水题。
B题也是水题,弄的比较麻烦,前几天队内赛见过,水题怎么水都能过。
C题
题意:给出正n边形上的三个点,求最小的正n边形的面积。
以前貌似见过此题。思路也没什么进展,就是枚举n,通过旋转a,判断b c是否在多边形上。感觉是水过的,改了改eps就过了,看别人代码,还有神奇的gcd的做法。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int s[];
int que[];
void judge(int x)
{
int num,n,i;
for(i = ;i <= ;i ++)
{
if(s[i] >= x)
break;
x -= s[i];
}
memset(que,,sizeof(que));
n = i;
num = ;
x--;
while(x)
{
que[num++] = x%;
x /= ;
}
for(i = n-;i >= ;i --)
{
printf("%c",que[i]+'A');
}
return ;
}
void fun1(char *str)
{
int a,b,i;
a = b = ;
int len;
len = strlen(str);
for(i = ;i < len;i ++)
{
if(str[i] == 'C') break;
a = a* + (str[i]-'');
}
for(i = i+;i < len;i ++)
b = b* + (str[i]-'');
judge(b);
printf("%d\n",a);
}
void fun2(char *str)
{
int a = ,i,j;
int len;
len = strlen(str);
for(i = ;i < len;i ++)
{
if(str[i] <= ''&&str[i] >= '')
break;
}
int num = ;
for(j = i-;j >= ;j --)
a += s[num++]*(str[j] - 'A' + );
printf("R");
for(;i < len;i ++)
printf("%c",str[i]);
printf("C%d\n",a);
}
int main()
{
int t,len,i;
char str[];
scanf("%d",&t);
s[] = ;
for(i = ;i <= ;i ++)
s[i] = s[i-]*;
while(t--)
{
scanf("%s",str);
len = strlen(str);
if(str[] == 'R')
{
int flag = ,z = ;
for(i = ;i < len;i ++)
{
if(str[i] == 'C'&&i >= )
flag ++;
else if(str[i] <= 'Z'&&str[i] >= 'A')
z = ;
}
if(flag == &&z == )
fun1(str);
else
fun2(str);
}
else
fun2(str);
}
return ;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
#define PI 3.1415926
#define eps 1e-3
struct point
{
double x,y;
};
struct line
{
point a,b;
}; point intersection(line u,line v)
{
point ret = u.a;
double t = ((u.a.x-v.a.x)*(v.a.y-v.b.y) - (u.a.y-v.a.y)*(v.a.x-v.b.x))
/((u.a.x-u.b.x)*(v.a.y-v.b.y)-(u.a.y-u.b.y)*(v.a.x-v.b.x));
ret.x += (u.b.x-u.a.x)*t;
ret.y += (u.b.y-u.a.y)*t;
return ret;
}
point circumcenter(point a,point b,point c)
{
line u,v;
u.a.x = (a.x+b.x)/;
u.a.y = (a.y+b.y)/;
u.b.x = u.a.x-a.y+b.y;
u.b.y = u.a.y+a.x-b.x;
v.a.x = (a.x + c.x)/;
v.a.y = (a.y + c.y)/;
v.b.x = v.a.x - a.y + c.y;
v.b.y = v.a.y + a.x - c.x;
return intersection(u,v);
}
point Rotate(point p,double angle)
{
point res;
res.x = p.x * cos(angle) - p.y*sin(angle);
res.y = p.x * sin(angle) + p.y*cos(angle);
return res;
}
int judge(point a,point b)
{
double t;
t = a.x - b.x;
if(t < )
t = -t;
if(t > eps) return ;
t = a.y - b.y;
if(t < )
t = -t;
if(t > eps) return ;
return ;
}
int main()
{
int i,j,n;
point a,b,c,r,d;
point p[];
scanf("%lf%lf",&a.x,&a.y);
scanf("%lf%lf",&b.x,&b.y);
scanf("%lf%lf",&c.x,&c.y);
r = circumcenter(a,b,c);
d.x = a.x - r.x;
d.y = a.y - r.y;
for(i = ;i <= ;i ++)
{
int num = ;
p[] = a;
for(j = ;j < i;j ++)
{
p[j] = Rotate(d,*PI*j/i);
p[j].x += r.x;
p[j].y += r.y;
if(judge(p[j],b))
num ++;
if(judge(p[j],c))
num ++;
}
if(num == ) break;
}
n = i;
double s1,s2;
s1 = s2 = ;
for(i = ;i < n;i ++)
{
s1 += p[(i+)%n].y*p[i].x;
s2 += p[(i+)%n].y*p[(i+)%n].x;
}
printf("%.7lf",fabs(s1-s2)/);
return ;
}
Codeforces Beta Round #1的更多相关文章
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #62 题解【ABCD】
Codeforces Beta Round #62 A Irrational problem 题意 f(x) = x mod p1 mod p2 mod p3 mod p4 问你[a,b]中有多少个数 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #13 C. Sequence (DP)
题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
- Codeforces Beta Round #76 (Div. 2 Only)
Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...
- Codeforces Beta Round #75 (Div. 2 Only)
Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...
- Codeforces Beta Round #74 (Div. 2 Only)
Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...
- Codeforces Beta Round #73 (Div. 2 Only)
Codeforces Beta Round #73 (Div. 2 Only) http://codeforces.com/contest/88 A 模拟 #include<bits/stdc+ ...
随机推荐
- 设计模式学习之命令模式(Command,行为型模式)(12)
一.命令模式的定义 命令模式属于对象的行为型模式.命令模式是把一个操作或者行为抽象为一个对象中,通过对命令的抽象化来使得发出命令的责任和执行命令的责任分隔开.命令模式的实现可以提供命令的撤销和恢复功能 ...
- 无废话ExtJs 入门教程二[Hello World]
无废话ExtJs 入门教程二[Hello World] extjs技术交流,欢迎加群(201926085) 我们在学校里学习任何一门语言都是从"Hello World"开始,这里我 ...
- LINQ To DataSet 示例
如果在项目遇到这样的问题如:DataTable1和DataTable2需要根据一定的规则进行合并成一个DataTable3. 问题1:DataTable1不是读数据库表的结果,而是合成的数据集,因此无 ...
- ASP.NET多线程下使用HttpContext.Current为null解决方案 2015-01-22 15:23 349人阅读 评论(0) 收藏
问题一:多线程下获取文件绝对路径 当我们使用HttpContext.Current.Server.MapPath(strPath)获取绝对路径时HttpContext.Current为null,解决办 ...
- ASP.NET 5探险(4):如何把ASP.NET 5从beta4升级到beta5
(此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:上一篇文章讲述了ASP.NET 5 Beta带来的一些变化,虽然原文最后给出了从bet ...
- HR外包系统 - 员工项目 薪资项目 考勤项目 -管理
项目管理-包括员工项目 薪资项目 考勤项目 一 后台总公司定义项目-前台分公司选择项目,定义别名-分公司客户选择员工项目,定义别名 分公司下面-新建薪资类别-薪资类别下面选择要的薪资和考勤项目. 二 ...
- hpunix下11gRac的安装
一.检查环境 1.操作系统版本# uname -a 2.补丁包三大补丁包#swlist -l bundle|grep QPKAPPS#swlist -l bundle|grep QPKBASE#swl ...
- 第十篇:扩展SOUI的控件及绘图对象(ISkinObj)
尽管SOUI已经内置了大部分常用的控件,很显然内置控件很难满足各种应用的形式各异的需求. 因此只有提供足够的扩展性才能满足真实应用场景. 除了将系统尽可能的组件化外,SOUI在控件自绘(SWindow ...
- HDU 2242 考研路茫茫——空调教室 无向图缩环+树形DP
考研路茫茫——空调教室 Problem Description 众所周知,HDU的考研教室是没有空调的,于是就苦了不少不去图书馆的考研仔们.Lele也是其中一个.而某教室旁边又摆着两个未装上的空调,更 ...
- MATLAB中stem函数用法
stem(Y) 将数据序列Y从x轴到数据值按照茎状形式画出,以圆圈终止.如果Y是一个矩阵,则将其每一列按照分隔方式画出. stem(X,Y)在X的指定点处画出数据序列Y. stem(...,'fil ...