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的更多相关文章

  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 现在你已经有一 ...

  2. 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]中有多少个数 ...

  3. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  4. Codeforces Beta Round #13 C. Sequence (DP)

    题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...

  5. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  6. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

  7. Codeforces Beta Round #76 (Div. 2 Only)

    Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...

  8. Codeforces Beta Round #75 (Div. 2 Only)

    Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...

  9. Codeforces Beta Round #74 (Div. 2 Only)

    Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...

  10. Codeforces Beta Round #73 (Div. 2 Only)

    Codeforces Beta Round #73 (Div. 2 Only) http://codeforces.com/contest/88 A 模拟 #include<bits/stdc+ ...

随机推荐

  1. [LeetCode] Happy Number

    Happy Number Total Accepted: 35195 Total Submissions: 106936 Difficulty: Easy Write an algorithm to ...

  2. JavaScript - 引用类型

    对象在JavaScript中被称为引用类型的值. 引用类型和传统面向对象设计中的类相似,但实现不同. Object是一个基础类型,其他所有类型都从Object继承了基本的行为. Array类型,Dat ...

  3. Win10 VS2015 社区版切换到VS2013社区版 进行维护之前的项目

    前提:当先在Win10 OS 安装了vs2015之后开发Win UAP,之后要维护之前的WP8 版本,安装了VS2013社区版 打开后 1问.Exception from HRESULT: 0x897 ...

  4. hdu 4038 2011成都赛区网络赛H 贪心 ***

    贪心策略 1.使负数为偶数个,然后负数就不用管了 2.0变为1 3.1变为2 4.2变为3 5.若此时操作数剩1,则3+1,否则填个1+1,然后回到5

  5. 2015最新移动App设计尺寸视觉规范【图文版】(转)

    如今手机app的屏幕设计尺寸参差不齐,仿佛来到了移动界面尺寸战国时代,每家移动设备制造公司都为了迎合大众的口味,各家都在2014年大放光彩.2015年也将会是我们移动APP设计界快速发展的一年. 因为 ...

  6. Android LayoutInflater详解 (转)

    在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById().不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例 ...

  7. 湖南省第十二届大学生计算机程序设计竞赛 F 地铁 多源多汇最短路

    1808: 地铁 Description Bobo 居住在大城市 ICPCCamp. ICPCCamp 有 n 个地铁站,用 1,2,…,n 编号. m 段双向的地铁线路连接 n 个地铁站,其中第 i ...

  8. cocos2dx游戏开发——微信打飞机学习笔记(一)——开发准备

    一.环境的搭建 1.Windows开发准备: (1)软件下载及安装 •下载Cocos2d-x 最新版本:http://www.cocos2d-x.org/download 或者从Cocos2d-x G ...

  9. Released Mocked Streams for Apache Kafka

    Kafka Streams is a de­ploy­ment-ag­nos­tic stream pro­cess­ing li­brary writ­ten in Java. Even thoug ...

  10. lr中switch的应用

    Action() { char *time; int i,j,length; time=lr_eval_string("{testtime}"); lr_error_message ...