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 <iostream> | |
using namespace std; | |
int n, m; | |
bool vector[100][100]; | |
bool visited[100]; | |
void dfs(int point){ | |
cout << (point + 1); |
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
int power(int n, int k) { | |
if (k == 0) return 1; | |
if (k == 1) return n; | |
int ret = power(n, k >> 1); | |
return (k & 1) | |
? ret * ret * n //odd | |
: ret * ret; //even | |
} |
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
int pow(int n, int k) { | |
if (k == 0) return 1; | |
if (k == 1) return n; | |
return n * pow(n, k - 1); | |
} |
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
int search(int array[], int n, int value) { | |
int left = 0; | |
int right = n - 1; | |
while (left <= right) { | |
int mid = left + ((right - left) >> 1); | |
if (array[mid] > value) { | |
right = mid - 1; | |
} else if (array[mid] < value) { | |
left = mid + 1; | |
} else { |
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 <iostream> | |
#include <cstring> | |
using namespace std; | |
char pre[100] = "zWbTghHV3oPp8LFGuAfn01rmwxJ7eiQYZ25vKqk9yCBNDU4lcMIEaOj6SRXsdt"; //前序序列 | |
char mid[100] = "TbHVh3ogPWFLuAfGrm1xJ7we0iQYnZ8Kvqk9y5CNBD24UlcpIEMaj6SROXsdzt"; //中序序列 | |
char post[100] = "TVHo3hPgbFfAumr7Jxew1YQi0ZnGLKy9kqvNDBC54clU28EIRS6jdsXOaMpWtz"; //后序序列 | |
typedef struct _Node | |
{ |
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
from itertools import permutations | |
import hashlib | |
n = 9 | |
cols = range(n) | |
for vec in permutations(cols): | |
if (n == len(set(vec[i] + i for i in cols)) | |
== len(set(vec[i] - i for i in cols))): | |
s = "zWp8LGn01wxJ7" | |
for x in vec: |
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
void test() { | |
volatile unsigned long long val; | |
volatile unsigned long long local = 0xdeadbeef; | |
char* variable_length; | |
entry_check(3); /* Make sure entered this function properly */ | |
val = getbuf(); | |
if (val <= 40) { | |
variable_length = alloca(val); | |
} | |
entry_check(3); |
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
0000000000401020 <bang>: | |
401020: 48 83 ec 08 sub $0x8,%rsp | |
401024: 48 8b 35 dd 12 20 00 mov 0x2012dd(%rip),%rsi # 602308 <global_value> | |
40102b: 48 3b 35 ee 12 20 00 cmp 0x2012ee(%rip),%rsi # 602320 <cookie> | |
401032: c7 05 74 12 20 00 02 movl $0x2,0x201274(%rip) # 6022b0 <check_level> | |
401039: 00 00 00 | |
40103c: 74 13 je 401051 <bang+0x31> | |
40103e: bf 70 15 40 00 mov $0x401570,%edi | |
401043: 31 c0 xor %eax,%eax | |
401045: e8 a6 f7 ff ff callq 4007f0 <printf@plt> |
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
unsigned long long global_value = 0; | |
void bang(unsigned long long val) | |
{ | |
entry_check(2); /* Make sure entered this function properly */ | |
if (global_value == cookie) | |
{ | |
printf("Bang!: You set global_value to 0x%llx\n", global_value); | |
validate(2); | |
} else { | |
printf("Misfire: global_value = 0x%llx\n", global_value); |
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
void fizz(int arg1, char arg2, long arg3, | |
char* arg4, short arg5, short arg6, unsigned long long val) | |
{ | |
entry_check(1); /* Make sure entered this function properly */ | |
if (val == cookie) | |
{ | |
printf("Fizz!: You called fizz(0x%llx)\n", val); | |
validate(1); | |
} | |
else { |