Skip to content

Instantly share code, notes, and snippets.

View ititorit's full-sized avatar

Nguyễn Minh Tuấn ititorit

View GitHub Profile
@ititorit
ititorit / BCFRIEND.cpp
Created September 30, 2016 12:24
BCFRIEND SPOJ
// contest: http://www.spoj.com/PTIT/problems/BCFRIEND/
// OLP Tin học SV 2009 - Khối không chuyên
// author : Nguyen Minh Tuan(ititorit)
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
@ititorit
ititorit / PTIT135J.cpp
Created September 30, 2016 15:48
PTIT135J SPOJ
// contest: http://www.spoj.com/PTIT/problems/PTIT135J/
// author : Nguyen Minh Tuan (ititorit)
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
@ititorit
ititorit / PTIT135I.cpp
Last active September 30, 2016 16:02
PTIT135I SPOJ
// contest: http://www.spoj.com/PTIT/problems/PTIT135I/
// author : Nguyen Minh Tuan(ititorit)
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
@ititorit
ititorit / PTIT127G.cpp
Created October 3, 2016 10:25
PTIT127G SPOJ
// contest: http://www.spoj.com/PTIT/problems/PTIT127G/
// author : Nguyen Minh Tuan
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
@ititorit
ititorit / BCPERMU.cpp
Created October 7, 2016 06:54
BCPERMU SPOJ
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()
#define DEBUG(x) { cout << #x << " = " << x << endl; }
#define sqr(x) ((x)*(x))
@ititorit
ititorit / YOUNGCLA.cpp
Created October 8, 2016 02:05
YOUNGCLA - Birthdates spoj
// contest: http://www.spoj.com/PTIT/problems/YOUNGCLA/
// author : Nguyen Minh Tuan (ititorit)
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()
@ititorit
ititorit / SUMDIV.cpp
Created October 8, 2016 02:36
SUMDIV spoj
// contest: http://www.spoj.com/PTIT/problems/SUMDIV/
// author : Nguyen Minh Tuan
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
@ititorit
ititorit / SUMSQR1.cpp
Created October 8, 2016 02:44
SUMSQR1 - Tổng bình phương SPOJ
// contest: http://www.spoj.com/PTIT/problems/SUMSQR1/
// author : Nguyen Minh Tuan
// lang : C/C++
#include <bits/stdc++.h>
#define _for(i,a,b) for(int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = a; i >= b; i--)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()
@ititorit
ititorit / P153SUMC.cpp
Created October 11, 2016 06:05
P153SUMC spoj
// contest: http://www.spoj.com/PTIT/problems/P153SUMC
// author : Nguyen Minh Tuan
// lang : C/C++
// problem very very excited...
#include <algorithm>
#include <functional>
#include <iostream>
#include <stdlib.h>
#include <string.h>
@ititorit
ititorit / BCINCSEQ.cpp
Created October 11, 2016 07:26
BCINCSEQ SPOJ
// contest: http://www.spoj.com/PTIT/problems/BCINCSEQ/
// author : Nguyen Minh Tuan
// lang : C/C++
// algo : Dynamic Programming
#include <algorithm>
#include <functional>
#include <iostream>
#include <stdlib.h>
#include <string.h>