codeforces beta round 1

A

Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city’s anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.
What is the least number of flagstones needed to pave the Square? It’s allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It’s not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

Input

The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).

Output

Write the needed number of flagstones.

Examples

input

6 6 6 4

output

4

题意:n * m大的剧场,a*a大的砖块,允许超过覆盖面积,不允许打破砖块,输出所需的砖块数量

#include<bits/stdc++.h>
using namespace std;typedef long long ll;int main()
{ll n, m, x;cin >> n >> m >> x;ll ax = 0, ay = 0;ax = n/x + (n%x != 0);ay = m/x + (m%x != 0);cout << ax*ay << endl;return 0;
}

B

In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow three-letter numbers, etc.
The rows are marked by integer numbers starting with 1. The cell name is the concatenation of the column and the row numbers. For example, BC23 is the name for the cell that is in column 55, row 23.
Sometimes another numeration system is used: RXCY, where X and Y are integer numbers, showing the column and the row numbers respectfully. For instance, R23C55 is the cell from the previous example.
Your task is to write a program that reads the given sequence of cell coordinates and produce each item written according to the rules of another numeration system.

Input

The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .

Output

Write n lines, each line should contain a cell coordinates in the other numeration system.

Examples

input

2
R23C55
BC23

output

BC23
R23C55

题意:在流行的电子表格系统中(例如,在Excel中),使用了以下的列数编号。第一列是数字A,第二列是数字B,等等,直到第26列被标记为Z,然后是两个字母的数字:第27列有数字AA,28-AB,第52列被标记为AZ。ZZ之后是三个字母的数字,等等。
单元格的名称是列号和行号的连接。例如,BC23是位于第55列、第23行的单元格的名称。
有时也会使用另一种数字系统。RXCY,其中X和Y是整数,分别表示列和行的数字。例如,R23C55是前面例子中的单元格。
你的任务是编写一个程序,读取给定的单元格坐标序列,并根据另一种计数系统的规则生成每个项目。

#include<bits/stdc++.h>
using namespace std;
//代码渣,体谅一下
void atb(string s)                        //BC23 => R23C55的过程
{int l = 0, h = 0;for(int i = 0; i < s.size(); i++){if(s[i] >= '0' && s[i] <= '9'){h *= 10;h += s[i] - '0';}else{l *= 26;l += s[i] - 'A' + 1;}}cout << 'R' << h << 'C' << l << endl;
}void bta(string s)                  //R23C55 => BC23的过程
{int l = 0, h = 0;int n = s.size();for(int i = 0; i < n; i++){if(s[i] == 'R'){for(int j = i+1; j < n; j++){if(s[j] == 'C'){i = j;break;}h *= 10;h += s[j] - '0';}for(int j = i+1; j < n; j++){l *= 10;l += s[j] - '0';}}}int cnt = 0;char str[1000] = {0};while(l){int k = l%26;if(k == 0){str[cnt++] = 'Z';l -= 26;}else{str[cnt++] = 'A'-1+k;}l /= 26;}for(int i = cnt - 1; i >= 0; i--){cout << str[i];}cout << h << endl;
}int main()
{int t;cin >> t;while(t--){string s;cin >> s;int b = 0;for(int i = 0; i < s.size() - 1; i++){if(s[i] >= '0' && s[i] <= '9' && s[i+1] == 'C'){b = 1;break;}}if(b){bta(s);} else{atb(s);}}
}

C3

Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.
In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary from one circus to another. In each corner of the arena there was a special pillar, and the rope strung between the pillars marked the arena edges.
Recently the scientists from Berland have discovered the remains of the ancient circus arena. They found only three pillars, the others were destroyed by the time.
You are given the coordinates of these three pillars. Find out what is the smallest area that the arena could have.

Input

The input file consists of three lines, each of them contains a pair of numbers –– coordinates of the pillar. Any coordinate doesn’t exceed 1000 by absolute value, and is given with at most six digits after decimal point.

Output

Output the smallest possible area of the ancient arena. This number should be accurate to at least 6 digits after the decimal point. It’s guaranteed that the number of angles in the optimal polygon is not larger than 100.

Examples

input

0.000000 0.000000
1.000000 1.000000
0.000000 1.000000

output

1.00000000

题意:现在,伯尔尼的所有马戏团都有一个直径为13米的圆形竞技场,但在过去情况有所不同。
在古代贝兰,马戏团的竞技场是一个规则的(等边)多边形,其大小和角度的数量可能因马戏团而异。竞技场的每个角落都有一个特殊的柱子,柱子之间的绳子标志着竞技场的边缘。
最近,来自Berland的科学家发现了古代马戏团竞技场的遗迹。他们只发现了三根柱子,其他的都被时间摧毁了。
你会得到这三根柱子的坐标。找出竞技场最小的面积是多少。

#include<bits/stdc++.h>
using namespace std;//通过三点坐标求剧场面积
//已知所有的点都在正多边形的外接圆上
//找出圆心,求角度的最大公因数const double emp = 1e-4;
const double pi = acos(-1);double fgcd(double a, double b)
{return a <= emp ? b : fgcd(fmod(b, a), a);
}int main()
{double x1, y1, x2, y2, x3, y3;//坐标double a, b, c, p, s, r, k;//边长,半径,面积,斜率等double da, db, dc;//角度cin >> x1 >> y1;cin >> x2 >> y2;cin >> x3 >> y3;a = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));b = sqrt((x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3));c = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3));p = (a + b + c)/2.0;s = sqrt(p*(p - a)*(p - b)*(p - c));r = a*b*c/(4*s);//三角形外接圆半径公式da = 2*acos((b*b+c*c-a*a)/(2*b*c));//余弦定理求角度,圆心角是圆周角的二倍db = 2*acos((a*a+c*c-b*b)/(2*a*c));dc = 2*pi - da - db;p = fgcd(da, db);p = fgcd(p, dc);printf("%.7lf\n", pi*r*r*sin(p)/p);return 0;
}

codeforces beta round 1相关推荐

  1. Codeforces Beta Round #17 D. Notepad (数论 + 广义欧拉定理降幂)

    Codeforces Beta Round #17 题目链接:点击我打开题目链接 大概题意: 给你 \(b\),\(n\),\(c\). 让你求:\((b)^{n-1}*(b-1)\%c\). \(2 ...

  2. Codeforces Beta Round #5 B. Center Alignment 模拟题

    B. Center Alignment 题目连接: http://www.codeforces.com/contest/5/problem/B Description Almost every tex ...

  3. Codeforces Beta Round #75 (Div. 1 Only) B. Queue 线段树。单点更新

    http://codeforces.com/problemset/problem/91/B 题意: 给你n个数,求得i 到n中小于a[i]的最右边的a[j],然后求a[i]到a[j]之间包含了多少个数 ...

  4. Codeforces Beta Round #51 D. Beautiful numbers 数位dp + 状态优化

    传送门 文章目录 题意: 思路: 题意: 思路: 数位dpdpdp挺经典的一个题辣,有一个很明显的状态就是f[pos][num][lcm]f[pos][num][lcm]f[pos][num][lcm ...

  5. Codeforces Beta Round #22 (Div. 2 Only) E. Scheme(DFS+强连通)

    题目大意 给了 n(2<=n<=105) 个点,从每个点 u 出发连向了一个点 v(共 n 条边) 现在要求添加最少的边使得整个图是一个强连通图 做法分析 这道题千万不要一般化:先求强连通 ...

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

    Codeforces Beta Round #4 (Div. 2 Only) A 水题 1 #include<bits/stdc++.h> 2 using namespace std; 3 ...

  7. Codeforces Beta Round #7

    Codeforces Beta Round #7 http://codeforces.com/contest/7 A 水题 1 #include<bits/stdc++.h> 2 usin ...

  8. Codeforces Beta Round #1 A,B,C

    A. Theatre Square time limit per test:1 second memory limit per test:256 megabytes input:standard in ...

  9. Codeforces Beta Round #2-A. Winner——算法笔记

    题目链接:http://codeforces.com/problemset/problem/2/A 题目描述: The winner of the card game popular in Berla ...

最新文章

  1. 使用Kubespray部署Kubernetes集群
  2. 天翼云从业认证(2.2)云计算的模式、应用和行业生态
  3. Spork: Pig on Spark实现分析
  4. 愿你白天有说有笑,晚上睡个好觉
  5. 计算机分数的简便运算,分数的简便运算和分数的解方程
  6. python3 批量修改文件扩展名——递归
  7. 746. Min Cost Climbing Stairs
  8. 递归算法经典实例python-递归案例python
  9. vue 倒计时插件_Vue的高性能和高精度倒计时插件
  10. 构造体中变量后面的冒号_flow中问号在参数后面和在冒号有什么区别?declare type的作用是?看英文文档有点一知半解...
  11. 万娟 白话大数据和机械学习_白话大数据与机器学习
  12. sir模型初始值_SIR模型简单了解(Susceptible Infected Recovered Model)
  13. Sourcetree和Bitbucket的使用
  14. 元器件 - TVS二极管
  15. 利用ffmpeg 把.mp4转换为.flv
  16. 微信的野心到底有多可怕
  17. Linux应用开发【第十二章】I2C编程应用开发
  18. vcf无法导入iCloud 通讯录
  19. 看这里,全网最详细的Sonar代码扫描平台搭建教程
  20. 空间统计之八:平均中心和中位数中心

热门文章

  1. java 中long和Long的区别
  2. 机器人图形变变变_幼儿园全景数学特色课程
  3. 灯饰展厅装修设计需要注意什么问题
  4. 据说深圳电子烟工厂生产了全球产量的90%,为了了解一下这个行业,我做了以下分析
  5. 推荐2个适合程序员使用的显示器
  6. 机器学习常用的六种分类方法,Python代码详细都在这里!
  7. HDMI EDID timing详细解析
  8. 遥控视频小车实际应用效果以及功能实现
  9. layui单据打印_layui打印表格自定义函数
  10. 使用 EasyExcel 操作exsel文件