-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path485_Senda_pirenaica.cpp
57 lines (42 loc) · 960 Bytes
/
485_Senda_pirenaica.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Usuario de Acepta el reto: jjjjjjjp022
#include <iostream>
#include <string>
using namespace std;
typedef long int tRecorrido[100];
typedef struct
{
tRecorrido etapa;
long int dias;
long int max;
}tRuta;
typedef tRuta tRutas[1000];
int main()
{
tRutas ruta;
long int c = -1;
do
{
c++;
ruta[c].max = 0;
cin >> ruta[c].dias;
for (int i = 0; i < ruta[c].dias; i++)
{
cin >> ruta[c].etapa[i];
ruta[c].max = ruta[c].max + ruta[c].etapa[i];
}
} while (ruta[c].dias != 0);
for (int d = 0; d < c; d++)
{
for (int i = 0; i < ruta[d].dias; i++)
{
cout << ruta[d].max;
if (i != ruta[d].dias - 1)
{
cout << " ";
}
ruta[d].max = ruta[d].max - ruta[d].etapa[i];
}
cout << "\n";
}
return 0;
}