Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files.associations": {
"*.embeddedhtml": "html",
"iostream": "cpp",
"ostream": "cpp",
"span": "cpp",
"deque": "cpp",
"string": "cpp",
"vector": "cpp"
}
}
42 changes: 42 additions & 0 deletions calculaResposta.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>
using namespace std;

int main() {
vector<float> list;
vector<float> aux;
float n;
float sum = 0.0;
float result = 0.0;

while(cin >> n and n != 0) {
list.push_back(n);
}

for(int i = 0; i < list.size(); i++) {
if(list[i] != 4) {
aux.push_back((list[i]*2))
}
else {
sum += 4;
}
}

for(int j = 0; j < aux.size(); j++) {
result += aux[j];
}
result += sum;
cout << result << endl;
return 0;
}

// exemplo de entrada: 1 -> 14 pela linha azul
'''
10
8.5
6.3
4 (não multiplica por dois mas soma no fim)
12.8
5.1
0 (encerra)
89.4 (output)
'''
Binary file added output/planB
Binary file not shown.
Binary file added output/planB.exe
Binary file not shown.
Binary file added output/versaoPronta1_0
Binary file not shown.
110 changes: 110 additions & 0 deletions possibilities.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#include <bits/stdc++.h>
#include <cstdlib> // Para a função rand()
#include <ctime>
using namespace std;
typedef pair<int,float> Parint;
typedef vector<pair<Parint, string>> pstr;
//typedef pair<Parint, string> pstrfront;

// Cria o grafo do mapa do metrô
vector<pstr> subway() {
vector<pstr> realStations(15);
// Conexões Azuis
realStations[1].push_back({{2, 10.0}, "Azul"});
realStations[2].push_back({{1, 10.0}, "Azul"});

realStations[2].push_back({{3, 8.5}, "Azul"});
realStations[3].push_back({{2, 8.5}, "Azul"});

realStations[3].push_back({{4, 6.3}, "Azul"});
realStations[4].push_back({{3, 6.3}, "Azul"});

realStations[4].push_back({{5, 13.0}, "Azul"});
realStations[5].push_back({{4, 13.0}, "Azul"});

realStations[5].push_back({{6, 3.0}, "Azul"});
realStations[6].push_back({{5, 3.0}, "Azul"});

// Conexões Amarelas
realStations[2].push_back({{9, 10.0}, "Amarela"});
realStations[9].push_back({{2, 10.0}, "Amarela"});

realStations[2].push_back({{10, 3.5}, "Amarela"});
realStations[10].push_back({{2, 3.5}, "Amarela"});

realStations[5].push_back({{7, 2.4}, "Amarela"});
realStations[7].push_back({{5, 2.4}, "Amarela"});

realStations[5].push_back({{8, 30.0}, "Amarela"});
realStations[8].push_back({{5, 30.0}, "Amarela"});

realStations[8].push_back({{9, 9.6}, "Amarela"});
realStations[9].push_back({{8, 9.6}, "Amarela"});

// Conexões Verdes
realStations[4].push_back({{8, 15.4}, "Verde"});
realStations[8].push_back({{4, 15.4}, "Verde"});

realStations[4].push_back({{13, 12.8}, "Verde"});
realStations[13].push_back({{4, 12.8}, "Verde"});

realStations[8].push_back({{12, 6.4}, "Verde"});
realStations[12].push_back({{8, 6.4}, "Verde"});

realStations[13].push_back({{14, 5.1}, "Verde"});
realStations[14].push_back({{13, 5.1}, "Verde"});

// Conexões Vermelhas
realStations[3].push_back({{9, 9.4}, "Vermelha"});
realStations[9].push_back({{3, 9.4}, "Vermelha"});

realStations[9].push_back({{11, 12.2}, "Vermelha"});
realStations[11].push_back({{9, 12.2}, "Vermelha"});

realStations[3].push_back({{13, 18.7}, "Vermelha"});
realStations[13].push_back({{3, 18.7}, "Vermelha"});

return realStations;
}

pair<int, int> pairTest() {
vector <int> v = {1,2,3,4,5,6, 7, 8, 9, 10,11, 12, 13, 14};
srand(static_cast<unsigned int>(time(nullptr)));

int indiceAleatorio = rand() % v.size();
int indiceAleatorio2 = rand() % v.size();
int numeroAleatorio = v[indiceAleatorio];
int numeroAleatorio2 = v[indiceAleatorio2];

return {numeroAleatorio2, numeroAleatorio};
}


vector<string> colorTest(int start,vector<pstr> realStations) {
vector <string> vtest;
bool stringRepetida = false; // iterar para ver se ja existe e evitar repeticao
for (auto it = realStations[start].begin(); it != realStations[start].end(); it++){
if(it-> second )
vtest.push_back(it->second);
}
vector <string> v = {"Azul", "Amarela", "Verde", "Vermelha"};
srand(static_cast<unsigned int>(time(nullptr)));

int indiceAleatorio = rand() % v.size();
string corAleatoria = v[indiceAleatorio];

return vtest;
}

int main() {
int t = pairTest().first;
int t2 = pairTest().second;
cout << t << " " << t2<< endl;
vector <pstr> realStations = subway();
vector<string> color = colorTest(2, realStations);
//cout << color << endl;
for(int i = 0; i < color.size(); i++) {
cout << color[i] << endl;
}
return 0;
}
Loading