Skip to content

Instantly share code, notes, and snippets.

View OmarJH's full-sized avatar

Omar alJubbah OmarJH

View GitHub Profile
@OmarJH
OmarJH / F. Door Lock
Created September 26, 2015 12:50
Syrian Collegiate Programming Contest
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
long double sec(long double a, long double b, long double c)
{
long double del = b*b - 4 * a *c;
long double x1 = (-sqrt(del) - b) / 2*a;
long double x2 = (sqrt(del) - b) / 2*a;
if (x1 > 0 && x1 < 0)
@OmarJH
OmarJH / edited
Created May 12, 2015 12:48
edited
#include <iostream>
#include <vector>
using namespace std;
int main()
{
double h=0;
double p1, p2, p3;
int n;
cin >> p1;
#include <iostream>
#include <vector>
using namespace std;
int main()
{
double h=0;
double p1, p2, p3;
int n;
cin >> p1;
@OmarJH
OmarJH / Sunset
Created May 12, 2015 12:33
Sunset
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> a;
vector <int> ans;
int n,maxx=0,t;
cin >> t;
while (t--)
@OmarJH
OmarJH / Board.cpp
Last active August 29, 2015 14:21
Board HakerRank
#include <iostream>
#include <vector>
using namespace std;
int main()
{
char m;
int xs, ys,n1,n2,tx,ty,coun=0;
vector < vector <int> > a;
@OmarJH
OmarJH / DIVSUM - Divisor Summation
Created May 2, 2015 21:26
ACM - DIVSUM - Divisor Summation - SPOJ
#include <iostream>
#include <string>
using namespace std;
int calcpr(int n)
{
if (n == 1)
return 0;
int summ = 0;
for (int i = 1; i*i <= n; i++)
{
@OmarJH
OmarJH / SCPC11D - Egypt.cpp
Last active August 29, 2015 14:20
ACM - SCPC11D - Egypt - SPOJ
#include <iostream>
#include <string>
using namespace std;
int main()
{
int t;
long long x, y,z;
cin >> x >> y >> z;
while (x!=0||y!=0||z!=0)
@OmarJH
OmarJH / EC_CONB - Even Numbers
Created May 2, 2015 21:24
ACM - EC_CONB - Even Numbers - SPOJ
#include <iostream>
using namespace std;
int main()
{
int t, x,tem,tem2;
cin >> t;
while (t--)
{
tem = 0;;
@OmarJH
OmarJH / NGM - A Game with Numbers
Created May 2, 2015 21:23
ACM - NGM - A Game with Numbers - SPOJ
#include<iostream>
using namespace std;
int main()
{
int x;
cin >> x;
if (x % 10 == 0)
cout << 2 << endl;
else
cout << 1 << endl << x % 10 << endl;
@OmarJH
OmarJH / UCV2013A - Counting Ids
Created May 2, 2015 21:22
ACM - UCV2013A - Counting Ids - SPOJ
#include <iostream>
using namespace std;
long long Bmode(int x, int p, int m)
{
long long tempo;
if (p == 0)
return 1;
if (p % 2 == 0)
{
tempo = Bmode(x, p / 2, m);