Skip to content

Commit

Permalink
Aug,2017
Browse files Browse the repository at this point in the history
  • Loading branch information
akashpatek committed Aug 5, 2017
1 parent 602f00d commit 77e52bc
Show file tree
Hide file tree
Showing 655 changed files with 9,043 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Algorithm/KMPstringSearch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <bits/stdc++.h>
using namespace std;

int main(){

cout<<"Yes"<<endl;
}
Binary file added Algorithm/KMPstringSearch.exe
Binary file not shown.
31 changes: 31 additions & 0 deletions Algorithm/Seive_Prime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <bits/stdc++.h>
using namespace std;


int n=50;
bool prime[n+1];


void primeGen()
{

memset(prime, true, sizeof(prime));

for (int p=2; p*p<=n; p++)
{
if (prime[p] == true)
{
for (int i=p*2; i<=n; i += p)
prime[i] = false;
}
}

/* for (int p=2; p<=n; p++)
if (prime[p])
cout << p << " ";*/
}


int main(){

}
53 changes: 53 additions & 0 deletions Algorithm/combinationTaking_r_at_a_time.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Program to print all combination of size r in an array of size n
#include <stdio.h>
void combinationUtil(int arr[], int data[], int start, int end,
int index, int r);

// The main function that prints all combinations of size r
// in arr[] of size n. This function mainly uses combinationUtil()
void printCombination(int arr[], int n, int r)
{
// A temporary array to store all combination one by one
int data[r];

// Print all combination using temprary array 'data[]'
combinationUtil(arr, data, 0, n, 0, r);
}

/* arr[] ---> Input Array
data[] ---> Temporary array to store current combination
start & end ---> Staring and Ending indexes in arr[]
index ---> Current index in data[]
r ---> Size of a combination to be printed */
void combinationUtil(int arr[], int data[], int start, int end,
int index, int r)
{
// Current combination is ready to be printed, print it
if (index == r)
{
for (int j=0; j<r; j++)
printf("%d ", data[j]);
printf("\n");
return;
}

// replace index with all possible elements. The condition
// "end-i+1 >= r-index" makes sure that including one element
// at index will make a combination with remaining elements
// at remaining positions
for (int i=start; i<end && end-i >= r-index; i++)
{
data[index] = arr[i];
combinationUtil(arr, data, i+1, end, index+1, r);
}
}

// Driver program to test above functions
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int r = 3;
int n = sizeof(arr)/sizeof(arr[0]);
printCombination(arr, n, r);
}
ayhumar.yakup@gmail.com humargul516
Binary file added Algorithm/errorhere.exe
Binary file not shown.
1 change: 1 addition & 0 deletions Algorithm/inputf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inputf.in
1 change: 1 addition & 0 deletions Algorithm/outputf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Yes
13 changes: 13 additions & 0 deletions Contest-Solved/Herbon/B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
#include <cstdio>
using namespace std;

int main(){
double sum=0;
for(int i=0;i<12;i++){
double t;
cin>>t;
sum+=t;
}
printf("$%.2f\n",sum/12.0);
}
Binary file added Contest-Solved/Herbon/B.exe
Binary file not shown.
Binary file added Contest-Solved/Herbon/B.o
Binary file not shown.
20 changes: 20 additions & 0 deletions Contest-Solved/Herbon/C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <iostream>
using namespace std;

int main(){
double sum=0,ex[279];
for(int i=2;i<279;i++){
sum+=1.0/i;
ex[i-1]=sum;
}
double c;
cin>>c;
while(c!=0){
for(int i=1;i<279;i++){
if(ex[i]>=c){
cout<<i<<" card(s)"<<endl;break;
}
}
cin>>c;
}
}
Binary file added Contest-Solved/Herbon/C.exe
Binary file not shown.
Binary file added Contest-Solved/Herbon/C.o
Binary file not shown.
36 changes: 36 additions & 0 deletions Contest-Solved/Herbon/D.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int value(string ex){
int val=0;
for(int i=0;i<ex.length()-1;i++){
for(int j=i+1;j<ex.length();j++){
if(ex[j]<ex[i])
val++;
}
}
return val;
}

bool cmp (const pair<string,int> &a, const pair<string,int> &b ){
return a.second <= b.second;
}

int main(){

int n,m;
cin>>n>>m;
vector< pair<string,int> > fx;
for(int i=0;i<m;i++){
string ex;
cin>>ex;
fx.push_back(make_pair(ex,value(ex)));
}
sort(fx.begin(),fx.end(),cmp);
for(int i=0;i<m;i++){
cout<<fx[i].first<<endl;
}
}
Binary file added Contest-Solved/Herbon/D.exe
Binary file not shown.
Binary file added Contest-Solved/Herbon/D.o
Binary file not shown.
15 changes: 15 additions & 0 deletions Contest-Solved/IIUMicpc/10/A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
int ar[n];
for(int i=0;i<n;i++)
{
cin>>ar[i];
}
sort(ar,ar+n);
cout<<ar[n-1]<<" "<<ar[0]<<endl;

}
Binary file added Contest-Solved/IIUMicpc/10/A.exe
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/10/A.o
Binary file not shown.
17 changes: 17 additions & 0 deletions Contest-Solved/IIUMicpc/10/B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
sort(arr,arr+n);
for(int i=n-1;i>=0;i--)
cout<<arr[i]<<" ";
cout<<endl;

}
Binary file added Contest-Solved/IIUMicpc/10/B.exe
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/10/B.o
Binary file not shown.
39 changes: 39 additions & 0 deletions Contest-Solved/IIUMicpc/10/C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
stack<int> ex[n];
for(int i=0;i<n;i++){
int t,m;
cin>>t;
ex[i].push(i+1);
while(t--){
cin>>m;
ex[i].push(m);
}
}
int k;
cin>>k;
int route[k];
for(int i=0;i<k;i++)
cin>>route[i];
for(int i=0;i<k-1;i++){
int r=route[i]-1;
stack<int> tm=ex[r];
bool b=true;
while(!tm.empty()){
if(tm.top()==route[i+1]){
b=false;
break;
}
tm.pop();
}
if(b){
cout<<"This instruction will lead you astray"<<endl;return 0;
}
}
cout<<"Instruction is OK"<<endl;

}
Binary file added Contest-Solved/IIUMicpc/10/C.exe
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/10/C.o
Binary file not shown.
6 changes: 6 additions & 0 deletions Contest-Solved/IIUMicpc/10/D.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <bits/stdc++.h>
using namespace std;

int main(){

}
21 changes: 21 additions & 0 deletions Contest-Solved/IIUMicpc/10/E.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;

int sol(int s){

return sol(s-1)+sol(s-2);
}

int main(){
int t;
cin>>t
while(t--){
int s;
cin>>s
int ans=0;
while(--s){
int x=1;

}
}
}
Binary file added Contest-Solved/IIUMicpc/10/E.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions Contest-Solved/IIUMicpc/10/F.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <bits/stdc++.h>
using namespace std;

int main(){

}
Binary file added Contest-Solved/IIUMicpc/10/F.exe
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/10/F.o
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/10/en.pdf
Binary file not shown.
16 changes: 16 additions & 0 deletions Contest-Solved/IIUMicpc/11/A/A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
while(n--){
int sum=0,s;
for(int i=0;i<8;i++){
cin>>s;
sum+=s;
}
printf("%.2f\n",sum/4.0);

}
}
Binary file added Contest-Solved/IIUMicpc/11/A/A.out
Binary file not shown.
9 changes: 9 additions & 0 deletions Contest-Solved/IIUMicpc/11/A/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
2
5 5
10 10
5 10
10 5
5 5
10 10
5 10
10 5
25 changes: 25 additions & 0 deletions Contest-Solved/IIUMicpc/11/B/B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <bits/stdc++.h>
using namespace std;

int count(string ex){
int c=0;
for(int i=0;i<ex.length();i++){
if(isspace(ex[i]))
c++;
}
return c;
}
int main(){
int n;
cin>>n;
cin.ignore();
while(n--){
string ex,fx,a,b;
getline(cin,ex);
getline(cin,fx);
if(count(ex)>=count(fx))
cout<<ex<<endl;
else
cout<<fx<<endl;
}
}
Binary file added Contest-Solved/IIUMicpc/11/B/B.exe
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/11/B/B.o
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/11/B/B.out
Binary file not shown.
3 changes: 3 additions & 0 deletions Contest-Solved/IIUMicpc/11/B/hh.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
Muhammad Amirul Ashraf
Amjad A seini k k
Expand Down
5 changes: 5 additions & 0 deletions Contest-Solved/IIUMicpc/11/B/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2
dfggrgrgrgAmjad Alhouseini
Muhammad Amirul Ashraf
mjad Alhouseini
Muhammad Amirul Ashraf
Binary file added Contest-Solved/IIUMicpc/11/C/.C.cpp.swp
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/11/C/.input.swp
Binary file not shown.
52 changes: 52 additions & 0 deletions Contest-Solved/IIUMicpc/11/C/C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include <bits/stdc++.h>
using namespace std;

int main(){
//freopen("input","r",stdin);
int r,c;
cin>>r>>c;
while(r!=0 && c!=0){
string ex[r];
for(int i=0;i<r;i++){
cin>>ex[i];
}
bool flag[r][c];
memset(flag,0,sizeof(flag));
int count=0;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
if(ex[i][j]=='X' && !flag[i][j]){
count++;
// cout<<i<<" "<<j<<endl;
stack<pair<int,int> > stat;
stat.push(make_pair(i,j));
flag[i][j]=true;
while(!stat.empty()){
pair<int,int> tm=stat.top();
stat.pop();
//cout<<tm.first<<" tm " <<tm.second<<endl;
for(int x=-1;x<2;x++){
for(int y=-1;y<2;y++){
if(x==0 && y==0)
continue;
int nx=tm.first+x,ny=tm.second+y;
if(nx>=0 && nx<r && ny>=0 && ny<c ){
if(ex[nx][ny]=='X' && !flag[nx][ny]){
flag[nx][ny]=true;
stat.push(make_pair(nx,ny));
// cout<<nx<<", "<<ny<<"pushed"<<endl;
}

}
}
}
}
//cout<<endl;
}
}
}
cout<<count<<endl;
cin>>r>>c;
}

}
Binary file added Contest-Solved/IIUMicpc/11/C/C.exe
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/11/C/C.o
Binary file not shown.
Binary file added Contest-Solved/IIUMicpc/11/C/C.out
Binary file not shown.
Loading

0 comments on commit 77e52bc

Please sign in to comment.