Skip to content

Instantly share code, notes, and snippets.

View chengluyu's full-sized avatar

Luyu Cheng chengluyu

View GitHub Profile
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
const int N = 100000;
inline double square(double x) {
@chengluyu
chengluyu / tyvj1124.cpp
Created August 1, 2014 09:34
tyvj1124
/*
Problem: Tyvj 1124
Author: Cheng Luyu
Date: 2014/8/1 pm
*/
#include <cstdio>
#include <cstdlib>
const int N = 100, M = 100;
@chengluyu
chengluyu / main.md
Last active August 29, 2015 14:05
Problems to solve.
@chengluyu
chengluyu / problem_to_solve.md
Last active August 29, 2015 14:05
Problem to solve.
@chengluyu
chengluyu / prime_number_generator.cpp
Created September 9, 2014 13:04
Prime Numbers Generator in Liner Time
#include <iostream>
#include <vector>
const int MAX = 2000000;
bool is_prime[MAX + 1] = { 0 };
std::vector<int> primes;
int main() {
is_prime[2] = true;
@chengluyu
chengluyu / cf_406d.cpp
Created September 10, 2014 07:59
CodeForces 406D
#include <cstdio>
#include <cstdlib>
#include <vector>
const int N = 100000, TREE_HEIGHT = 17;
struct point {
long long x, y;
int multi(const point &a, const point &b) {
// printf("Multiply a(%d, %d) with b(%d, %d)",
@chengluyu
chengluyu / zoj_3816.cpp
Created September 10, 2014 09:52
ZOJ 3816 by Chen Rui
#include "cstdio"
#include "iostream"
#include "algorithm"
#include "cmath"
#include "cstring"
#include "ctime"
#include "cstdlib"
#include "vector"
#include "queue"
#include "set"
@chengluyu
chengluyu / guidance.md
Created September 21, 2014 09:43
Guidance to You

A Brief OI Practical Guidance


自由定义数组下标

比如我们要定义一个下标从 -1000 到 1000 (闭区间)的 int 类型数组,我们可以这样写:

int *a = new int[2001] + 1000;
#include <iostream>
#include <cstdio>
using namespace std;
#define CONCAT(a, b) a##b
#define file_type CONCAT(FI, LE)
#define file_open CONCAT(fo, pen)
#define file_scanf CONCAT(fs, canf)