-
Notifications
You must be signed in to change notification settings - Fork 4
/
countSolutions.py
82 lines (78 loc) · 2.51 KB
/
countSolutions.py
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import os
import datetime
# 统计天数
start = datetime.datetime(2021, 7, 4)
today = datetime.datetime.today()
between = today - start
print(between.days, 'days')
# 统计 leetcode 题量
cnt_lc_solutions = 0
cnt_lc_tests = 0
cwd = os.getcwd()
exclude_paths = ['algo-core', 'atcoder', 'codeforces', 'lanqiao',
'leetcode-extends', 'leetcode-lcp', 'luogu', 'nowcoder']
mp = set()
for dirpath, dirnames, filenames in os.walk(cwd):
ok = True
for exclude_path in exclude_paths:
if exclude_path in dirpath:
ok = False
break
if ok:
# 统计 Solution*.java
if '\src\main\java' in dirpath:
for filename in filenames:
if 'Solution' in filename:
key = filename.replace('SolutionP', '').replace('Solution', '').replace('.java', '')
mp.add(key)
cnt_lc_solutions += 1
# 统计 Solution*Tests.java
if '\src\\test\java' in dirpath:
for filename in filenames:
if 'Tests' in filename:
key = filename.replace('SolutionP', '').replace('Solution', '').replace('.java', '').replace(
'Tests', '')
mp.remove(key)
cnt_lc_tests += 1
print('leetcode:')
print(cnt_lc_solutions)
print(cnt_lc_tests)
print(mp)
# 统计 codeforces 题量
cnt_cf_mains = 0
cnt_cf_tests = 0
cwd = os.getcwd()
for dirpath, dirnames, filenames in os.walk(cwd):
if "codeforces" in dirpath:
# 统计 CF*.java
if '\src\main\java' in dirpath:
for filename in filenames:
if 'CF' in filename:
cnt_cf_mains += 1
# 统计 CF*Tests.java
if '\src\\test\java' in dirpath:
for filename in filenames:
if 'CF' in filename and 'Tests' in filename:
cnt_cf_tests += 1
print('codeforces:')
print(cnt_cf_mains)
print(cnt_cf_tests)
# 统计 atcoder 题量
cnt_at_mains = 0
cnt_at_tests = 0
cwd = os.getcwd()
for dirpath, dirnames, filenames in os.walk(cwd):
if "atcoder" in dirpath:
# 统计 CF*.java
if '\src\main\java' in dirpath:
for filename in filenames:
if '_' in filename:
cnt_at_mains += 1
# 统计 CF*Tests.java
if '\src\\test\java' in dirpath:
for filename in filenames:
if 'Tests' in filename:
cnt_at_tests += 1
print('atcoder:')
print(cnt_at_mains)
print(cnt_at_tests)