2021-06-15 00:49:18 -07:00
---
id: 5900f4d41000cf542c50ffe7
2022-03-02 20:56:06 +05:30
title: 'Problema 360: Sfera Spaventosa'
2021-06-15 00:49:18 -07:00
challengeType: 5
forumTopicId: 302021
dashedName: problem-360-scary-sphere
---
# --description--
2022-03-02 20:56:06 +05:30
Dati due punti ($x_1$, $y_1$, $z_1$) e ($x_2$, $y_2$, $z_2$) nello spazio tridimensionale, la distanza di Manhattan tra questi punti è definita come $|x_1 - x_2| + |y_1 - y_2| + |z_1 - z_2|$.
2021-06-15 00:49:18 -07:00
2022-03-02 20:56:06 +05:30
Sia $C(r)$ una sfera con raggio $r$ e centro nell'origine $O(0, 0, 0)$.
2021-06-15 00:49:18 -07:00
2022-03-02 20:56:06 +05:30
Sia $I(r)$ l'insieme di tutti i punti con coordinate intere sulla superficie di $C(r)$.
2021-06-15 00:49:18 -07:00
2022-03-02 20:56:06 +05:30
Sia $S(r)$ la somma delle distanze di Manhattan di tutti gli elementi di $I(r)$ dall'origine $O$.
Ad es. $S(45)=34518$.
Trova $S({10}^{10})$.
2021-06-15 00:49:18 -07:00
# --hints--
2022-03-02 20:56:06 +05:30
`scarySphere()` dovrebbe restituire `878825614395267100` .
2021-06-15 00:49:18 -07:00
```js
2022-03-02 20:56:06 +05:30
assert.strictEqual(scarySphere(), 878825614395267100);
2021-06-15 00:49:18 -07:00
```
# --seed--
## --seed-contents--
```js
2022-03-02 20:56:06 +05:30
function scarySphere() {
2021-06-15 00:49:18 -07:00
return true;
}
2022-03-02 20:56:06 +05:30
scarySphere();
2021-06-15 00:49:18 -07:00
```
# --solutions--
```js
// solution required
```