1 Star 0 Fork 0

逸扬/leetcode-hub-java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
countSolutions.py 2.16 KB
一键复制 编辑 原始数据 按行查看 历史
逸扬 提交于 2023-10-29 22:14 . 1494 (1)
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',
'leetcode-extends', 'leetcode-lcp', 'nowcoder']
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:
cnt_lc_solutions += 1
# 统计 Solution*Tests.java
if '\src\\test\java' in dirpath:
for filename in filenames:
if 'Tests' in filename:
cnt_lc_tests += 1
print('leetcode:')
print(cnt_lc_solutions)
print(cnt_lc_tests)
# 统计 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)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/gdut_yy/leetcode-hub-java.git
git@gitee.com:gdut_yy/leetcode-hub-java.git
gdut_yy
leetcode-hub-java
leetcode-hub-java
master

搜索帮助