Skip to content

Instantly share code, notes, and snippets.

View brun0xff's full-sized avatar

brunoathaíde brun0xff

  • Software Engineer
  • Lisbon
View GitHub Profile
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <string.h> // memset
using namespace std;
class Aresta
{
int vertice1, vertice2, peso;
#include <iostream>
#include <cstdio>
#define maxV 10000
using namespace std;
int cnt, lbl[maxV], movimentos, cont=0, V, A,G;
int adj[100][100];
@brun0xff
brun0xff / OpenGL
Last active December 29, 2016 03:18
g++ -framework OpenGL -framework GLUT -o lookAtThis helloPeople.cpp ; ./lookAtThis
gcc main.c -framework OpenGL -framework GLUT <É necessário adicionar a biblioteca "#include <GLUT/glut.h>">
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
int partition( int a[], int l, int r) {
int pivot, i, j, t;
pivot = a[l];
i = l; j = r+1;
while(1){
do ++i; while( a[i] <= pivot && i <= r );
do --j; while( a[j] > pivot );
if( i >= j ) break;
t = a[i]; a[i] = a[j]; a[j] = t;
/* C implementation QuickSort */
#include<stdio.h>
// A utility function to swap two elements
void swap(int* a, int* b)
{
int t = *a;
*a = *b;
*b = t;
}
#include <bits/stdc++.h>
#define endl '\n'
#define DV(value) cout << "[" << value << "]";
#define DPI(p) cout << "[" << p.first << "," << p.second << "]";
#define MAX 10000
using namespace std;
typedef pair<int,int> pii;
// C implementation of search and insert operations
// on Trie
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define ARRAY_SIZE(a) sizeof(a)/sizeof(a[0])
// Alphabet size (# of symbols)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
ll N;
Star (URI1233): [ Intermediario / Matematica ] É possivel ver que se um numero K tem algum fator comum com N, entao ele ira voltar para a posicao inicial em alguma rodada. Alem disso, para cada coprimo X de N, as estrelas formadas por X e N - X sao iguais. Dessa forma, o resultado final é phi(N) / 2.