-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVMWARE.py
More file actions
54 lines (44 loc) · 1.23 KB
/
VMWARE.py
File metadata and controls
54 lines (44 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
n, m = map(int, input())
Value = list(map(int, input().split()))
Num = list(map(int, input().split()))
def search(n, m, Value, Num):
Value, Num = map(
list, zip(*sorted(list(zip(Value, Num)), key=lambda x: x[0])))
res = 0
while m > 0:
while Num[-1] > 0:
if m <= 0:
break
res += 1
m = m - Value[-1]
Num[-1] -= 1
if not m:
return res
Num.pop(-1)
Value.pop(-1)
return res
print(search(n, m, Value, Num))
def deltaCalculate(String):
import datetime
year, month1, day1, month2, day2 = map(int, String.split())
dateOne = datetime.date(year, month1, day1)
dateTwo = datetime.date(year, month2, day2)
ans = dateTwo - dateOne
return (
ans.days) if int(
ans.days) > 0 else (
(datetime.date(
year +
1,
month2,
day2) -
dateOne).days)
current = 0
def MaxNumCalculate(String, res=''):
global current
if not String:
if int(res) > current:
current = int(res)
return
for i in range(len(String)):
MaxNumCalculate(String[:i] + String[i + 1:], res + String[i])