Codeforces Round #313 (Div. 2) C. Gerald's Hexagon(补大三角形)

告别“盲开”:手把手教你用MCU内置比较器搞定BLDC无感方波启动(附代码片段) 本文详细介绍了如何利用MCU内置比较器实现BLDC无感方波启动,解决传统无传感器控制中的'盲开'问题。通过虚拟中性点电路设计和三段式启动流程,结合反电动势检测和过零检测技术,提供了一套经济高效的解决方案,并附有可直接移植的代码片段,助力工程师快速实现可靠的无感控制。 阅读详情

C. Gerald's Hexagon
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.

He painted a few lines, parallel to the sides of the hexagon. The lines split the hexagon into regular triangles with sides of 1 centimeter. Now Gerald wonders how many triangles he has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.

Input

The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists.

Output

Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.

Sample test(s)
Input
1 1 1 1 1 1
Output
6
Input
1 2 1 2 1 2
Output
13
Note

This is what Gerald's hexagon looks like in the first sample:

And that's what it looks like in the second sample:


题目链接:http://codeforces.com/contest/560/problem/C


题目大意:已知六边形的六条边长,求由多少个单位三等边角形拼成。边长按顺时针顺序给出,以单位三角形边长为单位。


解题思路:把六边形补成大等边三角形。因为边长为n的大三角形由n*n个小单位角形拼成,更容易计算。大三角形减去三个角变成六边形,减去的三个小三角形的这边长正好等于六边形中对应的的三条边长。因此,设大三角边长为s,三个小三角形边长分别为a,b,c,那个单位三角形个数为  s*s-(a*a+b*b+c*c).而 s 正好等于六边形相邻三条边之和,a,b,c 则分别等于六边形相隔的三条边,因此很容易得出答案,可以画图加深了解。


代码如下:


#include <cstdio>
#include <cstring>
int a[8];
int main()
{
    int s,ans;
    for(int i=0;i<6;i++)
    	scanf("%d",&a[i]);
    s=a[0]+a[1]+a[2];
   	ans=s*s-(a[0]*a[0]+a[2]*a[2]+a[4]*a[4]);
    printf("%d\n",ans);
    return 0;
}




科研绘图系列:R语言绘制宏基因组分析的可视化图形(network & barplot & heatmap) 科研绘图系列:R语言多图形组合(network & barplot & heatmap) 阅读详情

相关推荐

OLED的字模提取(保姆级)---基于PCtoLCD2013

做为一个刚刚开始接触编程不久的白菜,这个OLED想做一个信息显示,可是商家给我的例程里就是88,816两种字体的格式,我的屏幕是0.91寸的8*16的字体显示上感觉特别丢丢儿小,我就想整个大的,哎,只怪直接学习习惯不好,总是学一半,绕了好大一圈,才搞好,想写一篇博客,时刻提醒踏实学习,第一次写博客,小白一枚,勿喷。。 OLED屏幕驱动程序功能 我们对Markdown编辑器进行了一些功能拓展与语法支...

qq_44886611的博客 7791

【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald's Hexagon

题目链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standar

David_Jett 1532

告别Keil!用VSCode+PlatformIO玩转STC单片机(附自动下载配置)

本文详细介绍了如何从Keil迁移到VSCode+PlatformIO进行STC单片机开发,包括环境搭建、自动下载配置等实用技巧。通过对比传统IDE与现代工具链的差异,展示了VSCode+PlatformIO在代码编辑体验、跨平台支持和开发效率上的优势,帮助开发者实现更流畅的STC单片机开发流程。

weixin_27252001的博客 465

Codeforces Round #313 (Div. 2) 560C Gerald's Hexagon(脑洞)

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for h

GKHack's Blog 1219

利用ENVI处理TIF文件,把多个tif整合到一个完整的tif,例如2003-2011年的tif整合到一个tif上。

利用ENVI处理TIF文件,把多个tif整合到一个完整的tif,例如2003-2011年的tif整合到一个tif上。

unique_sir的博客 1万+

[deprecated]第四章:TTM分析: 4.2.1 存储分配ttm_bo_validate功能实现分析

ttm_bo_validate是TTM框架中负责验证和调整BufferObject物理内存分配的核心函数,主要用于显存管理。该函数通过placement参数判断BO是否需要迁移或重新分配资源,完成内存分配、迁移及缓存策略调整等操作。实现流程包括资源释放、兼容性检查、迁移保护、新资源分配、迁移实现等步骤,支持多跳迁移和临时缓冲区。典型应用于显存溢出迁移、缓存策略调整、驱动初始化等场景,确保BO始终处于预期状态。

图形/计算GPU的驱动与虚拟化技术分享园地 869

Codeforces Round #313 C. Gerald's Hexagon(放三角形)

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for h

叶孤心的专栏 817

Python DEAP 库深度解析:从基础架构到高级应用

DEAP 是一个基于 Python 的开源框架,专门用于实现和运行各种进化算法,旨在帮助用户轻松地构建和调整进化算法,用于解决各种优化和搜索问题。本节中,介绍了 DEAP 相较于其它进化计算框架的优势,以及 DEAP 中重要的工具 creator 和 Toolbox。

盼小辉丶的博客 5265

Codeforces Round #313 (Div. 2) C Gerald's Hexagon 计数

// Codeforces Round #313 (Div. 2) C Gerald's Hexagon // 计数 // 关键是平行于a1的长度为1的有多少条,中间的这些*2,再加上a1 // 和a4,就是三角形的总和 // 还是挺简单的,注意递增的初始值,和变化,就ac了 #include #include #include #include using namespace std

TIMELIMITE的专栏 693

CelebA-HQ数据集下载【详细明了版】分辨率包括【64,128,256,512,1024】

CelebA-HQ 是在ICLR2018上,nVidia发表了一篇名为Progressive Growing of GANs for Improved Quality, Stability, and Variation的论文,文中通过训练高分辨率GAN生成了一个新的人脸数据集CelebA-HQ.CelebA是港科大汤晓鸥组收集的人脸数据集(总共200k图片),包括了人脸特征点(landmark),人脸属性(attribute)等信息,详细介绍参考链接[1]和[2]

zik的博客 1万+

科研生产力革命:手把手教你打造基于大模型的Research Agent(文献调研+论文写作+思路激发)

本文介绍了如何利用Research Agent(科研智能体)提升科研效率。Research Agent能自主完成文献检索、信息整合和报告生成全流程,省去50%以上的基础工作时间。文章详细讲解了搭建运行环境的方法,包括工具准备和MetaGPT配置,并提供了两种实战方案:基础版Search-O1和专业版MetaGPT Research Agent。此外,还介绍了如何为垂直领域定制Agent,以及优化检索效果、改善报告逻辑等技巧。最后列举了学术研究、行业分析、内容创作和个人学习四大应用场景,帮助用户将AI从聊天工

LXY_LOVE36的博客 273

Codeforces Round #313 (Div. 2) C. Gerald's Hexagon

Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of the

wb129945130的博客 678

第十二天:Python字典(Dict)详解

字典(Dictionary)是Python中最强大的数据类型之一,它是一种可变的、无序的键值对(key-value)集合。字典中的元素是通过键(key)来存取的,而不是通过偏移量(如列表中的索引)。 字典的核心特性包括: 键值对结构:每个元素由一个键和一个值组成,中间用冒号(:)分隔 无序性:字典中的元素没有固定的顺序(Python 3.7+版本中字典会保持插入顺序,但不应依赖此特性进行顺序操作) 可变性:可以动态地添加、修改或删除键值对 键的唯一性:字典中的键必须是唯一的,如果重复,后面的键值对会覆盖

本博客聚焦 YOLOv11 全流程落地,涵盖架构优化、数据集处理、训练技巧与多场景部署,兼及国产数据库、Java 开发与 AI 模型应用,内容兼顾理论与工程实践,为开发者提供系统干货,助力高效提升技术能力。 1688

Codeforces Round 313- Gerald's Hexagon

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for h

AC之路 544

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Codeforces Round #313 (Div. 2)——C数学题——Gerald's Hexagon

Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to. Then he measured the length of its sides, and found that each of them is ...

dgjm4087的博客 162

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Codeforces Round #313 (Div. 2)C. Gerald's Hexagon

Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal t...

zero 289

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 几何

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for h

习惯与规则决定命运 1274

Codeforces Round #313 (Div. 2)--C. Gerald's Hexagon

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for h

aozil_yang的博客 522

Codeforces Round #313 (Div. 2) C. Gerald's Hexagon

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for his...

weixin_30292745的博客 153

Codeforces Round #313 Gerald's Hexagon (数论)

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for h

把复杂的事情简单描述 409

【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald&#39;s Hexagon

【CF简单介绍】 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

weixin_30532987的博客 109

Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学

C. Gerald's Hexagon Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/problem/A Description Gerald got a very curious hexagon for his birthday. The boy foun...

weixin_30410119的博客 184

codeforces 538 B.Quasi Binary(思维题)

B. Quasi Binary time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A number is called quasibinary if its decim

ysCover 1703

The 2014 ACM-ICPC Asia Regional Contest Xi'an Site K ast Defence

ProblemK. Last Defence Description Given two integersA and B. Sequence S is defined as follow: • S0 = A • S1 = B • Si = |Si−1 −Si−2| for i ≥ 2 Count the number ofdistinct numbe

ysCover 1131

CSU 1217 奇数个的那个数(异或)

1217: 奇数个的那个数 Time Limit: 2 Sec  Memory Limit: 1 MB Submit: 523  Solved: 120 [Submit][Status][Web Board] Description 给定些数字,这些数中只有一个数出现了奇数次,找出这个数。 Input 每组数据第一行n表示数字个数,1 接下来n行每行一个32位

ysCover 1111

Codeforces Beta Round #34 (Div. 2) C. Page Numbers

C. Page Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «Bersoft» company is working on a new version of its

ysCover 1048
上一篇: poj 1129 Channel Allocation (DFS 图的染色问题)
下一篇: Codeforces Round #313 (Div. 2) D. Equivalent Strings(简单搜索)
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值