The problem is:
exploit = input('? ')
if eval(b64encode(exploit.encode('UTF-8'))) == math.pi:
print(open('flag.txt').read())| /login.html /login.html 200! | |
| /* 200! Role=admin | |
| /* /login.html?redirect=/:splat 302! |
| // main関数内以外は全てサンプルコードのままです | |
| #include <iostream> | |
| #include <vector> | |
| #include <string> | |
| #include <random> | |
| #include <thread> | |
| #include <chrono> | |
| using namespace std; |
This is PPC problem.
For any i, v, x, we define cnt(i,v,x) as the number of P such that GCD(P)=v and P[i]=x.
Then, the answer will be \sum_{i,v,x} cnt(i,v,x) * v * c[x] * i.
Because cnt(i,v,x) = cnt(i',v,x), the answer can be written as \sum_{v,x} cnt(0,v,x) * v * c[x] * N*(N-1)/2.
To count cnt(0,v,x), we fix x. Then we check v from N-1 to 1 such that x % v = 0.
The output is output = sin(flag % pi()).
We can get flag % pi() = arcsin(output) using a binary search. Note that there are 2 possible answers.
So, we want to calculate k such that flag - k * pi() = arcsin(output).
Due to the Decimal, these values are calculated in 300-digits precision. That means,
| #include <stdio.h> | |
| #include <algorithm> | |
| namespace sudoku { | |
| const char UNKNOWN = '_'; | |
| char board[90]; | |
| void input(){ | |
| for(int row=0; row<9; row++){ | |
| scanf("%s",board + 9*row); | |
| } |