50223. Shortest Distance

難度:3/5

我想了30分鐘...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>

int main(){
int w, a, b, c, d, e, ans;
scanf("%d %d %d %d %d %d", &w, &a, &b, &c, &d, &e);
if(b != 0){
ans = w * w + (a + b + c + 2 * d + 2 * e + 2) * (a + b + c+ 2 * d + 2 * e + 2);
}
else{
int m = (d > e) ? d : e;
ans = w * w + (a + c + 2 * m + 2) * (a + c + 2 * m + 2);
}
printf("%d\n", ans);
}

50223. Shortest Distance
https://aaronlin1229.github.io/judgegirl_50223/
Author
Akizumi
Posted on
July 17, 2023
Licensed under