Skip to content

Commit

Permalink
COUT-2K18
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypotter0 committed Mar 12, 2018
1 parent 0f8a520 commit 4f4f6cf
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 43 deletions.
51 changes: 51 additions & 0 deletions CP/COUT-2K18/p5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <bits/stdc++.h>
using namespace std;
//CODE BY AKASH KANDPAL
int main()
{
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
char arr[n][m];
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
//fflush(stdin);
cin>>arr[i][j];
}
}
int cnt=1,ans=0;
for(i=0;i<n;i++)
{
cnt=1;
for(j=1;j<m;j++)
{
if(arr[i][j]==arr[i][j-1])
cnt++;
else
cnt=1;
ans=max(ans,cnt);
}
}
for(i=0;i<m;i++)
{
cnt=1;
for(j=1;j<n;j++)
{
if(arr[j][i]==arr[j-1][i])
cnt++;
else
cnt=1;
ans=max(ans,cnt);

}
}
cout<<ans<<endl;
}
return 0;
}
43 changes: 0 additions & 43 deletions CP/COUT-2K18/p5.py

This file was deleted.

25 changes: 25 additions & 0 deletions CP/COUT-2K18/p6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
T = int(input())
for t in range(T):
N = int(input())
if N % 9 == 2 or N % 9 == 3:
print('Sailaja')
else:
print('Supraja')

'''
Input:
5
Output:
Supraja
Sample - 2
Input:
3
Output:
Sailaja
'''
46 changes: 46 additions & 0 deletions CP/COUT-2K18/p7.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n,d=0;
cin>>n;
while(n)
{
if(!(n&1))
d++;
n=n>>1;
}
ll xx=pow(2,d);
cout<<xx<<endl;
}
}


/*
Example-1
Input:
1
5
Output:
2
Example-2
Input:
1
10
Output:
4
*/
26 changes: 26 additions & 0 deletions CP/COUT-2K18/p8.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <iostream>
using namespace std;
int sum =0 ;
int fun(int n, int k)
{
// cout<<sum;
if (n == 1)return 1;
else
return (fun(n - 1, k) + k - 1) % n + 1;
}
int saveMary(int n, int k){
if (n<=0 || k<=0)return -1;
else return fun(n, k);
}
int main()
{
int n,t,k;
cin>>t;
while(t--)
{
cin>>n>>k;
cout<<saveMary(n, k)<<endl;
// cout<<sum;
}
return 0;
}
32 changes: 32 additions & 0 deletions CP/Women's CodeSprint 5/p1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import math
def readInts():
return list(map(int, raw_input().strip().split()))
def readInt():
return int(raw_input())
def readIntsindex0():
return list(map(lambda x: int(x) - 1, input().split()))
def readStrs():
return raw_input().split()
def readStr():
return raw_input()


for __ in range(readInt()):
a,b = readInts()




'''
Sample Input 0
3
104 200
370 420
20 50
Sample Output 0
4
0
-1
'''

0 comments on commit 4f4f6cf

Please sign in to comment.