Skip to content

Instantly share code, notes, and snippets.

View m4scosta's full-sized avatar

Marcos Costa Pinto m4scosta

  • São José dos Campos, São Paulo
  • 11:23 (UTC -03:00)
View GitHub Profile
@m4scosta
m4scosta / 1514
Created April 3, 2015 00:17
10% de WA!! ajuda aee!
#include <iostream>
#include <cstring>
#define MAX 101
using namespace std;
int main()
{
int n, m, x;
@m4scosta
m4scosta / 1728.cpp
Created April 3, 2015 14:56
Como otimizar este código?
#include <iostream>
#include <algorithm>
#include <sstream>
using namespace std;
int main()
{
string exp;
int a, b, c;
@m4scosta
m4scosta / 1495.cpp
Created May 5, 2015 01:26
Ta dando Time Limit Exceeded
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef pair<int, int> jogo;
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef pair<int, int> jogo;
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main()
{
int n, qt, s, ganhador, x;
@m4scosta
m4scosta / 1148.cpp
Created September 15, 2015 00:05
Ta dando 30% de WA, sabe pq??
#include <iostream>
#include <queue>
#include <vector>
#include <climits>
#include <cstring>
#define MAX_V 550
#define ii pair<int, int>
using namespace std;
enum Jogada {
case PEDRA
case PAPEL
case TESOURA
func ganhaDe(outra: Jogada) -> Bool? {
if self == outra {
return nil
}
infix operator ** {}
func ** (n: Int, p: Int) -> Int {
return Int(pow(Double(n), Double(p)))
}
func splitInt(n: Int) -> [Int] {
if n < 10 {
return [n]
// String operations
var test = "Marcos Pinto"
test.insert(" ", atIndex: test.startIndex.advancedBy(6))
test.insertContentsOf("Costa".characters, at: test.startIndex.advancedBy(7))
print(test)
test.removeAtIndex(test.startIndex)
var a = [1, 4, 6, -1, -7, 8]
let ordered = a.sort({(b: Int, c: Int) -> Bool in return b > c })
let reversed = a.sort({b, c in return b > c})
let shortReversed = a.sort({ $0 > $1 })
let veryShortReversed = a.sort(>)