Skip to content

Instantly share code, notes, and snippets.

@McSinyx
McSinyx / bai3.py
Created April 12, 2016 10:41
Bài 3 Tin học trẻ Ba Đình 2015-2016 viết trên Python 3.5
#!/usr/bin/env python3
d = dict()
with open('bai3.inp') as f:
for i in f.readlines():
for j in '.,;!?':
i = i.replace(j, ' ')
for j in i.split():
d[j] = d.get(j, 0) + 1
l = [(value, key) for (key, value) in d.items()]
l.sort(reverse=True)
@McSinyx
McSinyx / buy.pas
Last active May 3, 2016 14:11
Bài thi giải ba bảng C Tin học trẻ Thành phố Hà Nội năm học 2015 - 2016
(* File name are supposed to be in upper case, but lower case names look more *mordern*.
* `buy.pas' run first, read input from `buy.inp', write to `buy.out'
* `set.pas' run next, read from `set.inp', write to `set.out'
* `play.pas' run last, read from `map.inp', write to `decision.out'
* (LMAO dunno how to sort files in Gist)
*)
var
f : text;
a : array[1..10] of qword;
@McSinyx
McSinyx / Card.py
Last active July 2, 2016 07:32
Probabilities of Poker hands
#!/usr/bin/env python3
"""
This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com/code/Card.py
Copyright 2016 Raphael McSinyx
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
@McSinyx
McSinyx / findtext.c
Last active July 24, 2016 03:07
FINDTEXT - NTUcoder problem 5548
/*
* Trò chơi tìm chữ 3 <http://laptrinh.ntu.edu.vn/Problem/Details/5548>
*
* Copyright (C) 2016 Raphael McSinyx
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@McSinyx
McSinyx / circlenum.c
Created July 29, 2016 02:13
CIRCENUM - Số vòng
/*
* CIRCENUM - Số vòng <http://laptrinh.ntu.edu.vn/Problem/Details/5548>
*
* Copyright (C) 2016 Raphael McSinyx
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@McSinyx
McSinyx / performance_test.py
Last active August 31, 2016 10:09
XOR query
#!/usr/bin/env python3
# Test the performance of XOR query
# Copyright (C) 2016 Raphael McSinyx
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@McSinyx
McSinyx / vle.py
Last active February 24, 2017 04:41
VLE Broadcast Downloader
#!/usr/bin/env python3
# VOA Learning English Broadcast Downloader
# Copyright (C) 2016,2017 Raphael McSinyx
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@McSinyx
McSinyx / ui.py
Last active March 20, 2017 04:19
comp - console/curses online media player
#!/usr/bin/env python3
import curses
import json
import python_mpv_zws as mpv
with open('yt.json') as f:
DATA = json.load(f)
for i in DATA:
@McSinyx
McSinyx / đcôthkIImth11.md
Created April 14, 2017 14:00
Đề cương ôn tập học kì II môn tin học lớp 11

I. Lí thuyết

Câu 1

Tệp được phân loại theo cách tổ chức dữ liệu vì mỗi loại dữ liệu (văn bản, hình ảnh, âm thanh, ...) cần được đọc, ghi, xử lí khác nhau mới nhanh và sử dụng tài nguyên máy hiệu quả nhất.

Câu 2

nhtravel

NH airline mới mở N chặng bay mới kết nối N+1 địa điểm du lịch với nhau, sao cho giữa 2 địa điểm bất kỳ luôn có một đường bay, các địa điểm du lịch được đánh số từ 1 đến N+1. Do được giải nhất kỳ thi tin học Quốc gia năm ngoái, Tèo đã được tặng một vé vip miễn phí trên toàn bộ N chặng bay này. Tèo đang lên lịch trình du lịch để tham quan hết tất cả các địa điểm. Trong lúc lập lịch, Tèo sẽ phải tính xem, liệu có nên đi từ địa điểm A đến địa điểm B không, nếu có thì phải bay mấy chặng bay. Em hãy giúp Tèo để cậu sớm có thể đi du lịch.