Skip to content

Commit 4f4f6cf

Browse files
committed
COUT-2K18
1 parent 0f8a520 commit 4f4f6cf

File tree

6 files changed

+180
-43
lines changed

6 files changed

+180
-43
lines changed

CP/COUT-2K18/p5.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
//CODE BY AKASH KANDPAL
4+
int main()
5+
{
6+
int t;
7+
cin>>t;
8+
while(t--)
9+
{
10+
int n,m;
11+
cin>>n>>m;
12+
char arr[n][m];
13+
int i,j;
14+
for(i=0;i<n;i++)
15+
{
16+
for(j=0;j<m;j++)
17+
{
18+
//fflush(stdin);
19+
cin>>arr[i][j];
20+
}
21+
}
22+
int cnt=1,ans=0;
23+
for(i=0;i<n;i++)
24+
{
25+
cnt=1;
26+
for(j=1;j<m;j++)
27+
{
28+
if(arr[i][j]==arr[i][j-1])
29+
cnt++;
30+
else
31+
cnt=1;
32+
ans=max(ans,cnt);
33+
}
34+
}
35+
for(i=0;i<m;i++)
36+
{
37+
cnt=1;
38+
for(j=1;j<n;j++)
39+
{
40+
if(arr[j][i]==arr[j-1][i])
41+
cnt++;
42+
else
43+
cnt=1;
44+
ans=max(ans,cnt);
45+
46+
}
47+
}
48+
cout<<ans<<endl;
49+
}
50+
return 0;
51+
}

CP/COUT-2K18/p5.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

CP/COUT-2K18/p6.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
T = int(input())
2+
for t in range(T):
3+
N = int(input())
4+
if N % 9 == 2 or N % 9 == 3:
5+
print('Sailaja')
6+
else:
7+
print('Supraja')
8+
9+
'''
10+
Input:
11+
5
12+
13+
Output:
14+
Supraja
15+
16+
17+
Sample - 2
18+
19+
Input:
20+
3
21+
22+
Output:
23+
Sailaja
24+
25+
'''

CP/COUT-2K18/p7.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
typedef unsigned long long int ll;
4+
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
5+
int main()
6+
{
7+
ll t;
8+
cin>>t;
9+
while(t--)
10+
{
11+
ll n,d=0;
12+
cin>>n;
13+
while(n)
14+
{
15+
if(!(n&1))
16+
d++;
17+
n=n>>1;
18+
}
19+
ll xx=pow(2,d);
20+
cout<<xx<<endl;
21+
}
22+
}
23+
24+
25+
/*
26+
27+
Example-1
28+
29+
Input:
30+
1
31+
5
32+
33+
Output:
34+
2
35+
36+
37+
Example-2
38+
39+
Input:
40+
1
41+
10
42+
43+
Output:
44+
4
45+
46+
*/

CP/COUT-2K18/p8.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
using namespace std;
3+
int sum =0 ;
4+
int fun(int n, int k)
5+
{
6+
// cout<<sum;
7+
if (n == 1)return 1;
8+
else
9+
return (fun(n - 1, k) + k - 1) % n + 1;
10+
}
11+
int saveMary(int n, int k){
12+
if (n<=0 || k<=0)return -1;
13+
else return fun(n, k);
14+
}
15+
int main()
16+
{
17+
int n,t,k;
18+
cin>>t;
19+
while(t--)
20+
{
21+
cin>>n>>k;
22+
cout<<saveMary(n, k)<<endl;
23+
// cout<<sum;
24+
}
25+
return 0;
26+
}

CP/Women's CodeSprint 5/p1.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import math
2+
def readInts():
3+
return list(map(int, raw_input().strip().split()))
4+
def readInt():
5+
return int(raw_input())
6+
def readIntsindex0():
7+
return list(map(lambda x: int(x) - 1, input().split()))
8+
def readStrs():
9+
return raw_input().split()
10+
def readStr():
11+
return raw_input()
12+
13+
14+
for __ in range(readInt()):
15+
a,b = readInts()
16+
17+
18+
19+
20+
'''
21+
Sample Input 0
22+
23+
3
24+
104 200
25+
370 420
26+
20 50
27+
Sample Output 0
28+
29+
4
30+
0
31+
-1
32+
'''

0 commit comments

Comments
 (0)