Lightoj 1096 – nth term

Problem Link Solution :- nth term C++ /****************************************************************** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** Problem : lightoj 1096 - nth term *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** My Blog : http://shipuahamed.blogspot.com *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <list> #include <set> #include <map> #include <ctime> #include <stack> #include <queue> #include <cmath> #include <deque> #include <limits> #include <string> #include <cctype> #include <cstdio> #include <vector> #include <bitset> #include <numeric> #include <cassert> #include <sstream> #include <fstream> #include <cstdlib> #include <cstring> #include <utility> #include <complex> #include <iomanip> #include <iostream> #include <iterator> #include <algorithm> using namespace std; #define sc scanf #define pf printf #define ll long long #define pi 2*acos(0.0) #define ull unsigned long long #define all(v) v.begin(),v.end() #define sii(t) scanf("%d",&t) #define sll(t) scanf("%lld",&t) #define ssii(a,b) scanf("%d%d",&a,&b) #define ssll(a,b) scanf("%lld%lld",&a,&b) #define Case(no) printf("Case %d: ",++no) #define NL puts("") #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%lld ",a) #define ff first #define se second #define pb push_back #define ST(v) sort(all(v)) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define input freopen("in.txt","r",stdin) #define output freopen("out.txt","w",stdout) #define un(v) ST(v), (v).earse(unique(all(v)),v.end()) #define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end()) #define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end()) ////============ CONSTANT ===============//// #define mx (1000000) #define inf (1<<30) //infinity value #define eps 1e-9 #define mod 10007 ////====================================//// struct Matrix { ll mat[10][10]; }; Matrix Mul(Matrix aa, Matrix bb) { Matrix ret; cover(ret.mat,0); for(int i = 0; i < 4; i ++) for(int j = 0; j <...

Uva 1062 – Containers

Problem Link Solution :- Containers C++ /****************************************************************** *** Problewm : Uva 1062 - Containers *** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** My Blog : http://shipuahamed.blogspot.com *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <list> #include <set> #include <map> #include <ctime> #include <stack> #include <queue> #include <cmath> #include <deque> #include <limits> #include <string> #include <cctype> #include <cstdio> #include <vector> #include <bitset> #include <numeric> #include <cassert> #include <sstream> #include <fstream> #include <cstdlib> #include <cstring> #include <utility> #include <complex> #include <iomanip> #include <iostream> #include <iterator> #include <algorithm> using namespace std; #define sc scanf #define pf printf #define ll long long #define pi 2*acos(0.0) #define ull unsigned long long #define all(v) v.begin(),v.end() #define sii(t) scanf("%d",&t) #define sll(t) scanf("%lld",&t) #define ssii(a,b) scanf("%d%d",&a,&b) #define ssll(a,b) scanf("%lld%lld",&a,&b) #define Case(no) printf("Case %d: ",++no) #define nl puts("") #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%lld ",a) #define CP(a) cout<<a<<endl; #define CPN(a) cout<<a; #define ff first #define se second #define pb push_back #define ST(v) sort(all(v)) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define input freopen("in.txt","r",stdin) #define output freopen("out.txt","w",stdout) #define un(v) ST(v), (v).earse(unique(all(v)),v.end()) #define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end()) #define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end()) ////============ CONSTANT ===============//// #define mx (1000010) #define Max 1000000 //infinity value #define eps 1e-9 #define mod 10007 ////=====================================//// int main() { string s; int no=0; while(cin>>s) { if(s=="end") break; int len=s.size(); int a[10010]; for(int i=0;i<len;i++) { a[i]=s[i]-64; } int dp[10010]; for(int i=0;i<len;i++) { dp[i]=1;...

Uva 11057 – Exact Sum

Problem Link Solution :- Exact Sum C++ /****************************************************************** *** Problem : 11057 - Exact Sum *** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** My Blog : http://shipuahamed.blogspot.com *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <list> #include <set> #include <map> #include <ctime> #include <stack> #include <queue> #include <cmath> #include <deque> #include <limits> #include <string> #include <cctype> #include <cstdio> #include <vector> #include <bitset> #include <numeric> #include <cassert> #include <sstream> #include <fstream> #include <cstdlib> #include <cstring> #include <utility> #include <complex> #include <iomanip> #include <iostream> #include <iterator> #include <algorithm> using namespace std; #define sc scanf #define pf printf #define ll long long #define pi 2*acos(0.0) #define ull unsigned long long #define all(v) v.begin(),v.end() #define sii(t) scanf("%d",&t) #define sll(t) scanf("%lld",&t) #define ssii(a,b) scanf("%d%d",&a,&b) #define ssll(a,b) scanf("%lld%lld",&a,&b) #define Case(no) printf("Case %d: ",++no) #define nl puts("") #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%lld ",a) #define CP(a) cout<<a<<endl; #define CPN(a) cout<<a<<" "; #define ff first #define se second #define pb push_back #define ST(v) sort(all(v)) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define parity(i) __builtin_parity(i) //evenparity 0 and odd parity 1 #define input freopen("in.txt","r",stdin) #define output freopen("out.txt","w",stdout) #define un(v) ST(v), (v).earse(unique(all(v)),v.end()) #define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end()) #define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end()) ////============ CONSTANT ===============//// #define mx (1000010) #define inf 1<<30 //infinity value #define eps 1e-9 #define mod 10007 ////=====================================//// int main() { int n; while(sii(n)==1) { int a[10010]; for(int i=0;i<n;i++) { sii(a[i]); } int...

Uva 11790 – Murcia’s Skyline

Problem Link Solution :- Murcia's Skyline C++ /****************************************************************** *** Problem : Murcia's Skyline *** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** My Blog : http://shipuahamed.blogspot.com *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <list> #include <set> #include <map> #include <ctime> #include <stack> #include <queue> #include <cmath> #include <deque> #include <limits> #include <string> #include <cctype> #include <cstdio> #include <vector> #include <bitset> #include <numeric> #include <cassert> #include <sstream> #include <fstream> #include <cstdlib> #include <cstring> #include <utility> #include <complex> #include <iomanip> #include <iostream> #include <iterator> #include <algorithm> using namespace std; #define sc scanf #define pf printf #define ll long long #define pi 2*acos(0.0) #define ull unsigned long long #define all(v) v.begin(),v.end() #define sii(t) scanf("%d",&t) #define sll(t) scanf("%lld",&t) #define ssii(a,b) scanf("%d%d",&a,&b) #define ssll(a,b) scanf("%lld%lld",&a,&b) #define Case(no) printf("Case %d. ",++no) #define nl puts("") #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%lld ",a) #define CP(a) cout<<a<<endl; #define CPN(a) cout<<a<<" "; #define ff first #define se second #define pb push_back #define ST(v) sort(all(v)) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define parity(i) __builtin_parity(i) //evenparity 0 and odd parity 1 #define input freopen("in.txt","r",stdin) #define output freopen("out.txt","w",stdout) #define un(v) ST(v), (v).earse(unique(all(v)),v.end()) #define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end()) #define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end()) ////============ CONSTANT ===============//// #define mx (10010) #define inf 1<<30 //infinity value #define eps 1e-9 #define mod 10007 ////=====================================//// struct house { int h[mx],w[mx]; }; int lis(house a,int n) { int dp[mx]; for(int i=0;i<n;i++) { dp[i]=a.w[i];...