/ SB域 /

记录详情

Accepted


  
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Accepted 1ms 384.0 KiB
#2 Accepted 2ms 400.0 KiB
#3 Accepted 1ms 396.0 KiB
#4 Accepted 1ms 404.0 KiB
#5 Accepted 1ms 384.0 KiB
#6 Accepted 2ms 408.0 KiB
#7 Accepted 1ms 384.0 KiB
#8 Accepted 2ms 404.0 KiB
#9 Accepted 1ms 400.0 KiB
#10 Accepted 1ms 384.0 KiB
#11 Accepted 1ms 384.0 KiB
#12 Accepted 1ms 384.0 KiB
#13 Accepted 1ms 400.0 KiB
#14 Accepted 1ms 384.0 KiB
#15 Accepted 1ms 384.0 KiB
#16 Accepted 1ms 404.0 KiB
#17 Accepted 1ms 404.0 KiB
#18 Accepted 1ms 384.0 KiB
#19 Accepted 2ms 408.0 KiB
#20 Accepted 2ms 384.0 KiB

代码

#include<iostream>
#include<algorithm>
using namespace std;
int f(int x,int y)
{
int summ=0;
for(int i=0;i<y;i++)
{
summ+=x;
x++;
}
return summ;
}
int main()
{
int a[3];
int sum=0;
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3);
if(a[0]==a[1]&&a[1]==a[2])
{
    sum=f(a[0],a[0])*2;
    sum=sum-(a[0]+a[0]-1);
}
else{
    sum=f(a[1],a[2])*2;
    sum+=(a[0]-a[2]-1)*(a[1]+a[2]-1);
}

cout<<sum;
}

信息

递交者
类型
递交
题目
六边形问题
题目数据
下载
语言
C++
递交时间
2021-09-28 20:32:38
评测时间
2021-09-28 20:32:38
评测机
分数
100
总耗时
38ms
峰值内存
408.0 KiB