Skip to content

Commit

Permalink
February Cook-Off 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypotter0 committed Feb 19, 2018
1 parent 979b4b8 commit a078283
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 12 deletions.
12 changes: 0 additions & 12 deletions CP/Codemania/prob4.py

This file was deleted.

37 changes: 37 additions & 0 deletions CP/February Cook-Off 2018/prob1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
def readInts():
return map(int, raw_input().split())
def readInt():
return int(input())

for __ in range(readInt()):
arr = readInts()
c = 0
for i in arr:
if i==1:
c+=1
if(c==0):
print("Beginner")
elif(c==1):
print("Junior Developer")
elif(c==2):
print("Middle Developer")
elif(c==3):
print("Senior Developer")
elif(c==4):
print("Hacker")
else:
print("Jeff Dean")


'''
7
0 0 0 0 0
0 1 0 1 0
0 0 1 0 0
1 1 1 1 1
0 1 1 1 0
0 1 1 1 1
1 1 1 1 0
'''
58 changes: 58 additions & 0 deletions CP/February Cook-Off 2018/prob2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include <bits/stdc++.h>

using namespace std;

/* O(sqrt(N)). */
vector<int> divisors(int n){
vector<int> d;
int i;

// For every i up to sqrt(n).
for (i = 1; i * i <= n; i++){
// If i divides n.
if (n % i == 0){
if (i * i == n){
// Pushing i.
d.push_back(i);
}
else{
// Pushing i and n / i.
d.push_back(i);
d.push_back(n / i);
}
}
}
return d;
}


int main(){
int t, n, ans, a, b, c, i, j, x, y, z;
vector<int> dx, dy;

scanf("%d", &t);

while (t--){
scanf("%d%d%d%d", &n, &a, &b, &c);

dx = divisors(n);
ans = 0;

for (i = 0; i < (int)dx.size(); i++){
x = dx[i];

dy = divisors(n / x);

for (j = 0; j < (int)dy.size(); j++){
y = dy[j];
z = n / (x * y);

if (x <= a and y <= b and z <= c){
ans++;
}
}
}
printf("%d\n", ans);
}
return 0;
}
7 changes: 7 additions & 0 deletions CP/February Cook-Off 2018/prob3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def readInts():
return map(int, raw_input().split())
def readInt():
return int(input())

for __ in range(readInt()):
arr = readInts()
19 changes: 19 additions & 0 deletions CP/Keteki Power Match 2/prob1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import math

t = input()
while t>0:
t = t-1
s = raw_input()
d = {}
for i in range(len(s)):
if s[i] not in d.keys():
d[s[i]] = 1
else:
d[s[i]] += 1
ans = math.factorial(len(s))
# print(ans)
for i in d.keys():
p = math.factorial(d[i])
ans /= p
# print(p)
print ans
27 changes: 27 additions & 0 deletions CP/Keteki Power Match 2/prob2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def readInts():
return map(int, raw_input().split())
def readInt():
return int(input())

for __ in range(readInt()):
r,b,m = readInts()
ans = 0
for i in range(m+1):
j = m-i
# print(i,j,r,b)
if i>r or j>b:
continue
ans+=1
print ans

'''
Input:
2
1 1 2
3 2 2
Output:
1
3
'''
Empty file.

0 comments on commit a078283

Please sign in to comment.