AOJ2502: B: VOCAL ANDROID

問題 https://onlinejudge.u-aizu.ac.jp/problems/2502 解答例 解説 重さが可変 () の品物から重さがちょうど になるときの価値の総和の最大値を求めると考えれば, 個数制限なしナップザック問題とほとんど同じ問題とみなすことができる. ここでナップザック…

ångstromCTF 2021: Sea of Quills

問題 問題文 Come check out our finest selection of quills! app.rb Author: JoshDaBosh 問題概要 Ruby 製の Web アプリケーションフレームワークである sinatra を用いた Web アプリケーションのソースコード (app.rb) と 実際に動作する Web アプリケー…

AtCoder Beginner Contest 049: D - 連結

問題 問題文 https://atcoder.jp/contests/abc049/tasks/arc065_b 問題概要 頂点数が n の無向グラフが与えられる. 2つの種類の辺があり, それぞれ M本の辺, L本の辺がある. 1種類のみの辺を使ったとき, 各頂点からいずれの種類の辺のみを使ってもたどり着け…

picoCTF 2018: keygen-me-1

問題 問題文 Can you generate a valid product key for the validation program in /problems/keygen-me-1_1_8eb35cc7858ff1d2f55d30e5428f30a7 問題概要 x86のELFファイルが与えられる. 解答例 指針 Cutter で解析 解説 wget コマンドで問題ファイルを取っ…

Educational Codeforces Round 83: E. Array Shrinking

問題 問題文 https://codeforces.com/contest/1312/problem/E 問題概要 項数 の数列 が与えられる. を満たす組を選び, に置き換えるという操作をできるだけした際, 最終的な数列の長さとして考えられるもののうち最小のものを答えよ. 例 4 3 2 2 3 -> 4 3 3 …

picoCTF2018: quackme up

問題 問題文 The duck puns continue. Can you crack, I mean quack this program as well? You can find the program in /problems/quackme-up_2_bf9649c854a2615a35ccdc3660a31602 on the shell server. 問題概要 x86のELFファイルが与えられる. 解答例 指…

Educational Codeforces Round 83: D. Count the Arrays

問題 問題文 https://codeforces.com/contest/1312/problem/D 問題概要 要素数 の数列 を考える. 各要素は を満たす. 各数列について, 等しい値をもつ要素が, ちょうど1組存在する. 各数列 について, 以下を満たす インデックス が存在する. i番目の前の数列…

picoCTF2018: be-quick-or-be-dead-1

問題 問題文 You find this when searching for some music, which leads you to be-quick-or-be-dead-1. Can you run it fast enough? You can also find the executable in /problems/be-quick-or-be-dead-1_3_aeb48854203a88fb1da963f41ae06a1c. 問題概要…

AOJ 1180: 繰り返す10進数 / Recurring Decimals

問題 問題文 https://onlinejudge.u-aizu.ac.jp/problems/1180 問題概要 非負の整数 と桁数 が与えられる. 以下の規則を適用し, から をつくる. 整数 を 10進表記し, 桁が足りない場合は上位の桁を0埋めする. 各桁の数字を並び替えてできる数字のうち, 最大…

picoCTF 2019: Java Script Kiddie

問題 問題文 The image link appears broken... https://2019shell1.picoctf.com/problem/59857 or http://2019shell1.picoctf.com:59857 解答例 指針 頑張って JavaScript のコードを読む pngファイルの signature の値からkeyの候補を狭める 解説 与えられ…

AOJ 1166: 迷図と命ず / Amazing Mazes

問題 https://onlinejudge.u-aizu.ac.jp/problems/1166 問題文 問題概要 迷路を表すデータが与えられる. 入口から出口までの最短経路の長さを求めよ. 制約 データセット数 : 解答例 指針 BFS 解説 二次元グリッド上の最短経路問題なので幅優先探索(Breadth F…

picoCTF 2019: asm3

問題 問題文 What does asm3(0xd46c9935,0xdfe28722,0xb335450f) return? Submit the flag as a hexadecimal value (starting with '0x'). NOTE: Your submission for this question will NOT be in the normal flag format. Source located in the director…

AOJ 1173: 世界の天秤 / The Balance of the World

問題 問題文 https://onlinejudge.u-aizu.ac.jp/problems/1173 問題概要 丸括弧と角括弧の二種類の括弧を含む文字列が与えられる. 括弧列が整合しているか判定せよ. ただしここで, 括弧列が整合しているとは以下を満たしていることを言う. すべての左丸括弧…

picoCTF 2019: Empire1

問題 問題文 Psst, Agent 513, now that you're an employee of Evil Empire Co., try to get their secrets off the company website. https://2019shell1.picoctf.com/problem/45012/ (link) Can you first find the secret code they assigned to you? or…

ABC052/ARC067: C - Factors of Factorial

問題 問題文 https://atcoder.jp/contests/abc052/tasks/arc067_a https://atcoder.jp/contests/arc067/tasks/arc067_a 問題概要 整数 N が与えらる. の正の約数の個数を 割った余りを求めよ. 制約 解答例 指針 とすると, 解説 と素因数分解すると, となる. …

picoCTF2019: Client-side-again

問題 問題文 Can you break into this super secure portal? https://2019shell1.picoctf.com/problem/32255/ (link) or http://2019shell1.picoctf.com:32255 Hints: What is obfuscation? 解答例 指針 js-beautify Chrome DevTools 解説 問題文で与えられ…

AtCoder Beginner Contest 051: Candidates of No Shortest Paths

問題 問題文 https://atcoder.jp/contests/abc051/tasks/abc051_d 問題概要 頂点数 N, 辺の数 M の重み付き無向グラフが与えられる. ただし, このグラフは自己ループと二重辺をもたず, 連結であるものとする. 任意の 2頂点間のどの最短経路にも含まれない辺…

picoCTF 2018: echooo

問題 問題文 This program prints any input you give it. Can you leak the flag? Connect with nc 2018shell.picoctf.com 3981. Source. Hints: If only the program used puts... 解答例 指針 format string attack による stack の読み込み 解説 与えら…

AtCoder Beginner Contest 098: D - Xor Sum 2

問題 問題文 https://atcoder.jp/contests/abc098/tasks/arc098_b 問題概要 長さ N の整数列 A が与えられる. 次の条件を満たす整数 l, r (1 <= l <= r <= N) の組の個数を求めよ. 制約 入力は整数 解答例 指針 尺取法 解説 条件を満たすのはどのようなとき…

picoCTF 2018: SpyFi

問題 問題文 James Brahm, James Bond's less-franchised cousin, has left his secure communication with HQ running, but we couldn't find a way to steal his agent identification code. Can you? Conect with nc 2018shell2.picoctf.com 37131. Sourc…

AtCoder Grand Contest 023: A - Zero-Sum Ranges

問題 問題文 https://atcoder.jp/contests/agc023/tasks/agc023_a 問題概要 長さ N の整数列 A が与えられる. A の空でない連続する部分列のうち, 総和が 0 となるものの個数を求めよ. 制約 解答例 指針 連続する部分列の総和 => 累積和 解説 初項を 0 とし,…

picoCTF 2018: be-quick-or-be-dead-2

問題 問題文 As you enjoy this music even more, another executable be-quick-or-be-dead-2 shows up. Can you run this fast enough too? You can also find the executable in /problems/be-quick-or-be-dead-2_2_7e92e9cc48bad623da1c215c192bc919. Hin…

AtCoder Beginner Contest 107: D - Median of Medians

問題 問題文 https://atcoder.jp/contests/abc107/tasks/arc101_b 問題概要 長さ N の数列 a が与えられる. 区間 [l, r] (1≤l≤r≤N) について, a のすべての連続部分列の中央値を各々求め, その中央値を並べ新たに数列 m を作る. このとき m の中央値を求めよ…

picoCTF 2018: got-2-learn-libc

問題 問題文 This program gives you the address of some system calls. Can you get a shell? You can find the program in /problems/got-2-learn-libc_3_6e9881e9ff61c814aafaf92921e88e33 on the shell server. Source. Hints try returning to systems…

AtCoder Beginner Contest 108: D - All Your Paths are Different Lengths

問題 問題文 https://atcoder.jp/contests/abc108/tasks/arc102_b 問題概要 整数 が与えられる. 以下の条件を満たす有向グラフをひとつ構成せよ. グラフは多重辺を含んでもよい. 条件を満たす有向グラフの存在は保証されている. 頂点数 が 20 以下で全ての頂…

picoCTF 2018: buffer overflow 2

問題 問題文 Alright, this time you'll need to control some arguments. Can you get the flag from this program? You can find it in /problems/buffer-overflow-2_4_ca1cb0da49310dd45c811348a235d257 on the shell server. Source. Hints Try using gd…

AtCoder Beginner Contest 109: D - Make Them Even

問題 問題文 https://atcoder.jp/contests/abc109/tasks/abc109_d 問題概要 縦 H, 横 W のマス目がある. マス (i, j) には 枚のコインがある. コイン 1 枚を上下左右のいずれかに移動するという操作を各マスについて 1 回以下行って偶数枚のコインが置かれて…

35C3 Junior CTF: 1996

問題 問題文 It's 1996 all over again! nc 35.207.132.47 22227 Difficulty estimate: very easy 問題概要 x86_64 の ELF ファイルとそのソースコードおよびそのプログラムが動いている接続先が与えられる. 解答例 指針 buffer overflow による return addr…

AtCoder Beginner Contest 110: D - Factorizatiom

問題 問題文 https://atcoder.jp/contests/abc110/tasks/abc110_d 問題概要 正整数 N, M が与えられる. となるような正整数からなる長さ N の数列 a が何通りあるかを 109+7 で割った剰余の形で答えよ. 制約 解答例 指針 重複組合せ 解説 まず M がある素数 …

35C3 Junior CTF: flags

問題 問題文 Fun with flags: http://35.207.169.47 Flag is at /flag Difficulty estimate: Easy 問題概要 脆弱性のあるWebサービスの URL が与えられる. 解答例 指針 ディレクトリトラバーサル 解説 HTTP_ACCEPT_LANGUAGE の値に応じた国旗を表示するサー…