View funcaoretangulo.cpp
This file contains 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
retangulo interseccao(retangulo r1, retangulo r2){ | |
int x1 = max(r1.x1, r2.x1); | |
int x2 = min(r1.x2, r2.x2); | |
int y1 = max(r1.y1, r2.y1); | |
int y2 = min(r1.y2, r2.y2); | |
retangulo resp; | |
resp.x1 = x1; | |
resp.x2 = x2; | |
resp.y1 = y1; |
View Rectangle.cpp
This file contains 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 = 132694; | |
int n; | |
struct retangulo{ // criamos uma struct para representar os retangulos | |
long long int x1, x2, y1, y2; | |
bool operator == (retangulo r) const{ |
View volcanoeruption.cpp
This file contains 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 = 1123; | |
struct circulo{ //essa struct representara os buracos | |
double raio, x, y; | |
View floresdefogo.cpp
This file contains 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> //biblioteca utilizada | |
#include <cmath> //biblioteca utilizada | |
using namespace std; | |
int main() | |
{ | |
int R1, X1, Y1, R2, X2, Y2; //declaração das variáveis que compõem | |
float XY; //declaração da variável utilizada na lógica | |
while(cin >> R1 >> X1 >> Y1 >> R2 >> X2 >> Y2) //loop para ler todas as variáveis de entrada | |
{ | |
XY = sqrt(((X2 - X1) * (X2 - X1)) + ((Y2 - Y1) * (Y2 - Y1))); //cálculo 1 |
View quasemen.cpp
This file contains 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 = 512; | |
struct edge{ | |
//representaremos as arestas como uma struct | |
int de, para, peso; | |
}; |
View upas.cpp
This file contains 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 = 112345; | |
vector<int> upanaocomb[MAXN]; //guardaremos as relacoes entre upas em um vetor de vectors, | |
// muito como em um grafo. | |
bool marc[MAXN]; //vetor de marcacao, descrito na explicacao | |
int n, m, totaldeupas = 0; |
View linhasdeonibus.cpp
This file contains 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 = 512; | |
vector<pair<int, int> > grafo[maxn]; //guardaremos no grafo a vértice | |
//em que cada aresta liga, e sua linha | |
int t, l, o, d, dist[maxn]; | |
void bfs(int x) { | |
memset(dist, 0x3f3f3f3f, sizeof dist); //Inicializando distancia como "infinito" |
View parcelamento.cpp
This file contains 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 v, p; | |
int main(){ | |
scanf("%d", &v); | |
scanf("%d", &p); | |
for(int i = 1; i <= p; i++){ |
View mancha.cpp
This file contains 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 = 1123, MAXM = 1123; | |
//vetores auxiliares | |
int dx[5] = {1, 0, -1, 0}; | |
int dy[5] = {0, 1, 0, -1}; | |
bool marc[MAXN][MAXM]; |
View testededobra.cpp
This file contains 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 maxp = 55, maxm = 1010; | |
const int INF = 1e9 + 7; | |
int dp[maxm][maxp]; //Matriz que irá guardar os valores da programação dinâmica | |
int main(){ |
OlderNewer