diff --git a/20xx/description.md b/20xx/description.md index 198ef3b..adb449e 100644 --- a/20xx/description.md +++ b/20xx/description.md @@ -1 +1 @@ -What is this file saying? Help me. +My friend sent me this file and told me to git gud. diff --git a/doubly-dangerous/doubly_dangerous.c b/doubly-dangerous/doubly_dangerous.c new file mode 100644 index 0000000..fdf733d --- /dev/null +++ b/doubly-dangerous/doubly_dangerous.c @@ -0,0 +1,39 @@ +//compile with: +//gcc -m32 -std=c99 -Wall -fno-stack-protector doubly_dangerous.c -o doubly_dangerous + +#include +#include +#include +#include + +void give_flag() { + FILE *f = fopen("flag.txt", "r"); + if (f != NULL) { + char c; + + while ((c = fgetc(f)) != EOF) { + putchar(c); + } + fclose(f); + } + else { + printf("Failed to open flag file!\n"); + } +} + +int main(int argc, char **argv){ + volatile float modified; + char buffer[64]; + + modified = 0; + printf("Give me a string: \n"); + gets(buffer); + + if (modified == 11.28125) { + printf("Success! Here is your flag:\n"); + give_flag(); + } + else { + printf("nope!\n"); + } +} diff --git a/library/grader.py b/library/grader.py index b98e56c..2d88fe4 100644 --- a/library/grader.py +++ b/library/grader.py @@ -1,3 +1,9 @@ +# Very easy problem. Compute a few values w/ brute force or something, then check OEIS. +# Part of: https://oeis.org/A001333 +# Tells us: f(n) = (1/4) * Trace( [[0,0,1,0],[0,1,0,1],[1,0,2,0],[0,2,0,1]] ) +# just write a program to compute this quickly +# this sol takes something like ~O(log n) i think? + x = input() + 1 mat = [[0,0,1,0],[0,1,0,1],[1,0,2,0],[0,2,0,1]] diff --git a/library/problem.yml b/library/problem.yml index 4d77da8..b093837 100644 --- a/library/problem.yml +++ b/library/problem.yml @@ -3,7 +3,7 @@ title: library category: Programming autogen: false programming: true -value: 75 +value: 175 test_cases: 10 time_limit: 1000