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 <iostream> | |
#include <cstring> | |
#define MAX 101 | |
using namespace std; | |
int main() | |
{ | |
int n, m, x; |
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 <iostream> | |
#include <algorithm> | |
#include <sstream> | |
using namespace std; | |
int main() | |
{ | |
string exp; | |
int a, b, c; |
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 <iostream> | |
#include <vector> | |
#include <map> | |
#include <cstring> | |
#include <cstdlib> | |
using namespace std; | |
typedef pair<int, int> jogo; | |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cstdlib> | |
using namespace std; | |
typedef pair<int, int> jogo; |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cstdlib> | |
using namespace std; | |
int main() | |
{ | |
int n, qt, s, ganhador, x; |
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 <iostream> | |
#include <queue> | |
#include <vector> | |
#include <climits> | |
#include <cstring> | |
#define MAX_V 550 | |
#define ii pair<int, int> | |
using namespace std; |
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
enum Jogada { | |
case PEDRA | |
case PAPEL | |
case TESOURA | |
func ganhaDe(outra: Jogada) -> Bool? { | |
if self == outra { | |
return nil | |
} |
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
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] |
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
// 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) |
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
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(>) |
OlderNewer