This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| int main() { | |
| int n; | |
| cin >> n; | |
| int fat = 1; // 1 * x = x, serve como número padrao | |
| for(int i = 1; i <= n; i++) { | |
| fat = fat * i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ideias 07 - BFS 0-1 | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| typedef pair<int, int> pii; | |
| const int maxn = 1e5 + 10; | |
| vector<pii> grafo[maxn]; | |
| int n, m, dist[maxn]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ideias 07 - BFS 0-1 | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| typedef pair<int, int> pii; | |
| const int maxn = 1e5 + 10; | |
| vector<pii> grafo[maxn]; | |
| int n, m, dist[maxn]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int maxn = 110; | |
| vector<int> grafo[maxn]; | |
| int cor[maxn]; | |
| void bfs(int l){ | |
| cor[l] = 0; | |
| queue<int> fila; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| int main() { | |
| int n, a, b, c, d; | |
| int resp = 0; | |
| cin >> n >> a >> b >> c >> d; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ideias 06 - Soma de Prefixos | |
| // Thiago Mota | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int maxn = 100010; | |
| int n, q, v[maxn], pref[maxn]; | |
| int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ideias 06 - Soma de Prefixos | |
| // Thiago Mota | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int maxn = 100010; | |
| int n, q, v[maxn]; | |
| int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Noic - Ideia 5 | |
| // Exemplo 3 | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int maxn = 100010; | |
| int pai[maxn], h[maxn]; // Declaro o pai e a altura do Union Find |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <queue> // Biblioteca da fila | |
| using namespace std; | |
| int main() { | |
| queue<int> fila; // Declara uma queue do tipo int | |
| fila.push(1); // Insere o elemento 1 atrás na fila | |
| fila.push(3); // Insere o elemento 3 atrás na fila | |
| fila.push(4); // Insere o elemento 4 atrás na fila |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <queue> // Biblioteca da fila | |
| using namespace std; | |
| int main() { | |
| queue<int> fila; // Declara uma queue do tipo int | |
| fila.push(1); // Insere o elemento 1 atrás na fila | |
| fila.push(3); // Insere o elemento 3 atrás na fila | |
| fila.push(4); // Insere o elemento 4 atrás na fila |