diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..480bdf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +.kotlin + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/artifacts/MathGenerator1_jar.xml b/.idea/artifacts/MathGenerator1_jar.xml new file mode 100644 index 0000000..adadbae --- /dev/null +++ b/.idea/artifacts/MathGenerator1_jar.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/out/artifacts/MathGenerator1_jar + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0c04b52 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index be379d6..8f275d0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,298 @@ -# MathGenerator +中小学数学卷子自动生成程序 + +项目概述 + +中小学数学卷子自动生成程序是一个基于 Java 开发的命令行应用程序,旨在帮助小学、初中和高中数学老师快速生成符合教学要求的数学题目。程序支持不同难度级别的题目生成、用户认证、题目查重和文件保存等功能。 + + + +核心功能 + +🔐 用户认证系统 + +预设账户:系统内置小学、初中、高中各三个教师账户 + + + +登录验证:通过用户名和密码进行身份验证 + + + +权限分级:根据账户类型自动确定题目难度级别 + + + +📚 题目生成引擎 + +小学题目 + +运算符:加(+)、减(-)、乘(\*)、除(/) + + + +特殊要求:可能包含括号 + + + +操作数:2-5个操作数,取值范围1-100 + + + +初中题目 + +运算符:包含平方(²)、开根号(√)等高级运算符 + + + +特殊要求:至少包含一个平方或开根号运算符,且必须通过四则运算连接其他操作数 + + + +操作数:3-5个操作数,取值范围1-100 + + + +高中题目 + +运算符:包含三角函数(sin、cos、tan) + + + +特殊要求:至少包含一个三角函数和一个平方/开根号运算符 + + + +操作数:2-5个操作数,取值范围1-100 + + + +🔄 交互功能 + +难度切换:登录后可通过命令切换题目难度 + + + +题目数量控制:支持生成10-30道题目 + + + +重复检测:避免生成与历史题目重复的内容 + + + +灵活退出:支持退出当前用户重新登录 + + + +💾 文件管理 + +按用户分文件夹:每个用户的题目单独存放 + + + +时间戳命名:文件格式为"年-月-日-时-分-秒.txt" + + + +规范格式:每道题目有序号,题目间空一行 + + + +技术架构 + +项目结构 + +text + +MathGenerator/ + +└── src/ + +  └── test/ + +  └── java/ + +  ├── main/ + +  │ └── Main.java # 主程序入口 + +  ├── entity/ + +  │ ├── User.java # 用户实体类 + +  │ └── Question.java # 题目实体类 + +  ├── service/ + +  │ ├── UserService.java # 用户认证服务 + +  │ ├── QuestionService.java # 题目生成服务 + +  │ ├── FileService.java # 文件操作服务 + +  │ └── ValidationService.java # 输入验证服务 + +  ├── factory/ + +  │ ├── QuestionFactory.java # 题目生成器工厂 + +  │ └── QuestionGenerator.java # 题目生成器接口 + +  └── generator/ + +  ├── PrimaryQuestionGenerator.java # 小学题目生成器 + +  ├── JuniorQuestionGenerator.java # 初中题目生成器 + +  └── SeniorQuestionGenerator.java # 高中题目生成器 + +设计模式 + +工厂模式:通过 QuestionFactory 创建不同难度的题目生成器 + + + +策略模式:QuestionGenerator 接口支持多难度题目生成策略 + + + +分层架构:清晰的 entity-service-factory 分层结构 + + + +使用指南 + +启动程序 + +bash + +mvn clean package + +java -jar target/math-test-generator.jar + +操作流程 + +登录系统 + + + +text + +请输入用户名和密码(用空格隔开): 张三1 123 + +当前选择为小学出题 + +生成题目 + + + +text + +准备生成小学数学题目,请输入生成题目数量(输入-1将退出当前用户,重新登录): 15 + +题目已生成并保存到: exams/张三1/2025-01-20-14-30-25.txt + +切换难度 + + + +text + +切换为初中 + +准备生成初中数学题目,请输入生成题目数量 + +退出登录 + + + +text + +输入-1将退出当前用户,重新登录 + +预设账户 + +类型 用户名 密码 + +小学 张三1, 张三2, 张三3 123 + +初中 李四1, 李四2, 李四3 123 + +高中 王五1, 王五2, 王五3 123 + +代码规范 + +项目严格遵循 Google Java 编码规范: + + + +使用 2 空格缩进 + + + +完整的 Javadoc 注释 + + + +清晰的包和类结构 + + + +方法长度控制在 40 行以内 + + + +有意义的命名约定 + + + +输出示例 + +生成的题目文件格式: + + + +text + +1\. 25 + 47 - 13 + + + +2\. (18 \* 3) / 6 + 29 + + + +3\. 45 - 17 + 32 \* 2 + + + +... + +扩展性 + +程序具有良好的扩展性,可以轻松: + + + +添加新的题目难度级别 + + + +支持更多的数学运算符 + + + +集成数据库存储 + + + +添加图形用户界面 + + + +支持自定义题目模板 + + + +该项目专为中小学数学教育设计,帮助教师提高出题效率,确保题目质量一致性。 diff --git a/doc/张三1/2025-09-28-22-30-53.txt b/doc/张三1/2025-09-28-22-30-53.txt new file mode 100644 index 0000000..bdc943f --- /dev/null +++ b/doc/张三1/2025-09-28-22-30-53.txt @@ -0,0 +1,20 @@ +1. 39 - 97 * 72 + +2. 79 - 23 + +3. 93 - 22 + +4. 83 + (9 - 61 / 41 + 100) + +5. 82 * 100 + +6. (7 * 12 - 31) + +7. 3 + 84 + 89 - 2 + 7 + +8. 70 - 72 + +9. 67 - 27 - 98 - (45 / 17) + +10. 96 / 55 - 17 * 84 + diff --git a/doc/张三1/2025-09-28-22-30-54.txt b/doc/张三1/2025-09-28-22-30-54.txt new file mode 100644 index 0000000..5ee58bf --- /dev/null +++ b/doc/张三1/2025-09-28-22-30-54.txt @@ -0,0 +1,22 @@ +1. 24 / 82 - 98 * 51 + +2. 33 * 57 / 8 + +3. 66 / 41 * 71 + (96 * 8) + +4. 39 + 53 - (58 - 23) + +5. 33 + 25 * 26 + 74 / 30 + +6. 57 - 86 + +7. 84 / 80 - 90 + (92 + 73) + +8. 39 + 24 - 36 + +9. 98 + (74 + 39) + +10. 40 / 75 * 4 - 22 + +11. 30 / 67 + diff --git a/doc/张三1/2025-09-28-22-30-55.txt b/doc/张三1/2025-09-28-22-30-55.txt new file mode 100644 index 0000000..19d5e58 --- /dev/null +++ b/doc/张三1/2025-09-28-22-30-55.txt @@ -0,0 +1,24 @@ +1. 1 + 35 - 4 + +2. 49 + 93 + +3. 58 / 69 * 47 + +4. 20 - 80 + 35 + 80 * 91 + +5. 57 * 95 / 61 * 12 + +6. 12 + 94 + +7. 53 + 56 / 9 + +8. 47 + 38 + +9. 86 + 43 / 54 - 16 + +10. 84 / 93 * (53 / 82) + +11. 43 * 94 + +12. 87 / 24 / 41 + 25 + 4 + diff --git a/doc/张三1/2025-09-28-22-30-57.txt b/doc/张三1/2025-09-28-22-30-57.txt new file mode 100644 index 0000000..07eb728 --- /dev/null +++ b/doc/张三1/2025-09-28-22-30-57.txt @@ -0,0 +1,26 @@ +1. 32 - 80 / 21 + +2. 57 / 55 / 39 + +3. 18 / 45 + 77 + +4. 48 + 99 / 7 + 34 * 93 + +5. (31 - 5 + 40) + +6. 12 + 3 + 30 + +7. 26 / 100 + +8. 96 * 35 / (50 / 43) + +9. 30 - 88 + 7 * 41 + 16 + +10. 92 * (100 / 13 - 9 + 76) + +11. (33 / 11 * 1 + 77) + +12. 89 - 95 + +13. 37 / 75 / 40 / 16 + diff --git a/doc/张三1/2025-09-28-22-30-59.txt b/doc/张三1/2025-09-28-22-30-59.txt new file mode 100644 index 0000000..e3e1e2c --- /dev/null +++ b/doc/张三1/2025-09-28-22-30-59.txt @@ -0,0 +1,28 @@ +1. 100 * 1 / 62 + +2. 35 * (96 / 52) + +3. 30 + 88 + 43 * 27 + +4. 37 - (5 / 4 *) 68 + +5. (6 / 41 -) 8 + +6. 77 - 61 / 21 * 33 + +7. (24 * 12 * 58) + +8. 91 / 93 / 31 - 26 * 15 + +9. 37 + 88 * 76 * 4 + +10. 54 - 9 + +11. 98 / 34 + +12. 94 + 94 * 62 + +13. 77 - 95 / 63 + +14. (61 / 15 * 33 + 82 + 99) + diff --git a/doc/张三1/2025-09-28-22-31-04.txt b/doc/张三1/2025-09-28-22-31-04.txt new file mode 100644 index 0000000..8293244 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-04.txt @@ -0,0 +1,30 @@ +1. 22 * 26 - 57 - 54 * 56 + +2. (89 - 32 /) 37 + +3. (52 / 90 - 81 /) 13 + +4. 29 - 63 - 18 + +5. 96 - 31 - 16 + 46 * 58 + +6. 5 - 41 + +7. 16 / 25 / 10 + +8. 58 - 3 / 50 + +9. 30 * 71 - 54 + 4 - 25 + +10. 28 / 51 + 6 + +11. 42 + 51 + +12. 84 / 12 * 89 + +13. 15 - 22 + +14. 92 + 55 + +15. 66 * 55 + 64 * 50 + diff --git a/doc/张三1/2025-09-28-22-31-06.txt b/doc/张三1/2025-09-28-22-31-06.txt new file mode 100644 index 0000000..d1260bb --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-06.txt @@ -0,0 +1,32 @@ +1. 45 + 82 / 48 * 46 * 11 + +2. 82 * 11 + 96 / 78 + 72 + +3. 98 + (12 - 79) + +4. 20 + 6 - 36 - 85 + +5. 76 - 88 * 30 * 4 - 27 + +6. 3 / 59 + 61 - 88 / 75 + +7. 99 + 39 + 66 - 57 / 17 + +8. 55 * (39 * 19 * 12) + +9. 3 - 65 - 36 / 17 - 10 + +10. 89 * 36 / 26 * 52 + +11. 89 * 34 + +12. 13 / 45 - 49 + +13. 98 * 56 + 5 + +14. 74 * 45 * 2 - 2 - 10 + +15. 40 / 67 / 17 - 27 * 36 + +16. 3 * (73 + 88) + diff --git a/doc/张三1/2025-09-28-22-31-08.txt b/doc/张三1/2025-09-28-22-31-08.txt new file mode 100644 index 0000000..c0a5663 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-08.txt @@ -0,0 +1,34 @@ +1. 23 + 1 + +2. 63 + 81 / 61 * 2 + +3. 11 - 47 - 69 * 22 + +4. 87 / 30 * 60 + 6 + +5. 75 * 79 / 13 - 86 + +6. 29 * 63 + +7. 57 + 100 * 50 * 95 * 99 + +8. 39 - 97 + +9. 47 - 46 * (80 + 90 /) 7 + +10. (4 * 56 * 46) + +11. 82 + 46 / 99 * 49 + +12. 1 + 97 * 55 / (17 * 77) + +13. 61 / 61 + +14. 60 / (55 / 76) + +15. 4 + 46 - 81 + +16. 1 + (27 - 55) + +17. 93 / (75 + 33 - 53) + diff --git a/doc/张三1/2025-09-28-22-31-09.txt b/doc/张三1/2025-09-28-22-31-09.txt new file mode 100644 index 0000000..025839b --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-09.txt @@ -0,0 +1,36 @@ +1. 49 + 80 - 27 - 8 + +2. 73 * 63 / 44 + 23 + +3. (39 + 21 - 33 - 56 +) 60 + +4. 4 * 8 + 93 + 19 - 51 + +5. (35 + 76 / 23) + +6. 48 - 6 + +7. 92 / 40 * 96 + +8. 11 + 18 / (51 + 97) + +9. 47 * 95 - 34 - 88 + +10. (13 + 45 * 88) + +11. 9 + 4 / 37 * 10 * 47 + +12. 60 - 12 / (25 / 100 *) 92 + +13. 72 * 27 + 90 + +14. 70 * 47 + 3 + +15. 57 + 6 - 14 / 7 * 30 + +16. 14 * 3 + 99 - 30 + 46 + +17. 74 / 58 / 58 * 76 + 47 + +18. 59 * 87 + diff --git a/doc/张三1/2025-09-28-22-31-11.txt b/doc/张三1/2025-09-28-22-31-11.txt new file mode 100644 index 0000000..657d8c5 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-11.txt @@ -0,0 +1,38 @@ +1. (16 * 37 - 4) + +2. 53 - 25 + +3. 20 + (86 / 41 * 48 * 50) + +4. 78 * 55 * 98 - 91 + +5. 96 * 7 + (39 * 95) + +6. 41 * 29 - 4 - 18 - 91 + +7. 75 / 89 + 53 + +8. 78 * 77 + +9. 5 * 57 * (51 + 25 /) 50 + +10. 67 - 87 - (83 / 21) + +11. 33 / 38 / 86 - 3 + +12. 36 / 88 * 88 - 43 - 93 + +13. 60 * 26 - 27 - 38 - 3 + +14. 35 + 36 + +15. 85 - 47 - 4 / 28 - 44 + +16. (7 * 81 + 40) + +17. 44 + (82 + 29 +) 50 + +18. 82 * (51 / 64) + +19. 24 - 94 + 6 + diff --git a/doc/张三1/2025-09-28-22-31-22.txt b/doc/张三1/2025-09-28-22-31-22.txt new file mode 100644 index 0000000..9e0ecbe --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-22.txt @@ -0,0 +1,20 @@ +1. (59)² / (45)² + 30 / 13 + +2. 34 * √(6) * √(55) + +3. 70 - 75 * √(40) + 97 + +4. √(71) + (50)² * 29 + +5. 11 / √(13) - 10 - 74 - √(64) + +6. √(84) + √(64) / (56)² + +7. (26)² - (87)² * (10)² + +8. 80 / (87)² / 12 + +9. (28)² + 37 + 46 + 26 / 16 + +10. 7 / 81 / 55 + √(55) + diff --git a/doc/张三1/2025-09-28-22-31-23.txt b/doc/张三1/2025-09-28-22-31-23.txt new file mode 100644 index 0000000..a2dbaf7 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-23.txt @@ -0,0 +1,22 @@ +1. √(24) / 5 * 94 * 70 * √(70) + +2. 59 / 70 / (10)² / √(84) + +3. √(52) - 88 * √(74) + +4. (3)² - 86 + √(29) * (99)² + 40 + +5. 25 * (25)² + (46)² * 67 + +6. 87 + 17 * √(59) / (30)² + +7. (18)² / 76 + 77 * 39 - (33)² + +8. √(94) + 80 - 54 + √(52) * 51 + +9. (63)² - 44 - √(88) * (6)² + +10. 39 - √(26) / √(35) - (55)² - 92 + +11. (100)² - 16 * 18 / (45)² + diff --git a/doc/张三1/2025-09-28-22-31-24.txt b/doc/张三1/2025-09-28-22-31-24.txt new file mode 100644 index 0000000..9e649ed --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-24.txt @@ -0,0 +1,24 @@ +1. 36 * (18)² * 69 * √(8) + +2. (57)² + 39 * (35)² / (55)² + +3. √(27) + (9)² * (37)² + +4. 30 - 27 / (17)² * √(93) / (73)² + +5. (60)² + 2 - 75 + +6. 11 * (47)² - (96)² * 17 * (62)² + +7. 12 * √(56) + 88 - (100)² * 60 + +8. √(56) / 26 * 47 / √(67) + +9. (49)² - √(64) * √(37) - (33)² + +10. (53)² / 28 - 59 + 43 + √(98) + +11. (63)² * 72 * √(3) * 50 + +12. (69)² - 65 * √(8) * √(7) + diff --git a/doc/张三1/2025-09-28-22-31-27.txt b/doc/张三1/2025-09-28-22-31-27.txt new file mode 100644 index 0000000..edc689e --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-27.txt @@ -0,0 +1,26 @@ +1. (11)² - 53 / (57)² + +2. 73 / √(71) + √(95) / 93 - 78 + +3. (10)² / √(3) - (64)² * (70)² + 69 + +4. 64 * 32 / (59)² - 59 + +5. √(65) - √(38) - √(91) - (91)² / √(31) + +6. (94)² + (35)² / (15)² + +7. 53 - √(100) + √(83) + +8. (65)² - √(2) - (26)² - 60 + (73)² + +9. √(51) - 31 / 79 * √(84) + +10. 46 * 55 + √(16) - (19)² + +11. √(7) * 61 + √(79) * √(51) + +12. 16 - √(18) - √(95) + +13. √(34) - 85 / √(7) - (33)² + diff --git a/doc/张三1/2025-09-28-22-31-29.txt b/doc/张三1/2025-09-28-22-31-29.txt new file mode 100644 index 0000000..4aa23d0 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-29.txt @@ -0,0 +1,28 @@ +1. (6)² * √(60) + (97)² + +2. (29)² + (47)² / 97 + +3. 56 * 84 * 46 / √(2) + +4. 98 * √(64) - √(90) + +5. (97)² / 95 / √(50) * 71 + +6. (98)² - (1)² * (68)² * 24 + +7. √(4) * (72)² * 100 * √(1) * (46)² + +8. 9 - (1)² - 57 - (89)² + +9. √(1) - (40)² + 18 - 38 + +10. 76 * 47 - (92)² + 80 / (77)² + +11. 99 + √(65) + 8 - 86 + +12. 5 * (20)² / √(24) + 8 + +13. (14)² / √(30) * 47 - 79 + 32 + +14. √(88) + √(22) / (30)² - (90)² + diff --git a/doc/张三1/2025-09-28-22-31-30.txt b/doc/张三1/2025-09-28-22-31-30.txt new file mode 100644 index 0000000..5684b62 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-30.txt @@ -0,0 +1,30 @@ +1. 37 * (21)² - 11 + +2. 99 / 95 + 17 + 91 - √(41) + +3. (45)² - √(94) - (23)² * √(68) - (46)² + +4. √(93) / 39 + (17)² / (89)² / (78)² + +5. (8)² - (19)² * 15 * 67 + +6. √(95) - √(94) - 14 * √(98) * √(74) + +7. (49)² / 34 + √(63) / √(29) - 90 + +8. 80 + √(1) * √(98) + 33 * 62 + +9. 8 + (13)² / 15 + +10. √(94) / (21)² - 43 / 91 + (41)² + +11. √(60) * √(66) - 27 + +12. 9 * 98 * (91)² * √(72) + +13. (75)² * √(92) / (97)² / (58)² - 16 + +14. √(65) / √(28) - 78 - 40 * (96)² + +15. 28 / √(22) / (26)² + (72)² - √(26) + diff --git a/doc/张三1/2025-09-28-22-31-32.txt b/doc/张三1/2025-09-28-22-31-32.txt new file mode 100644 index 0000000..3d08243 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-32.txt @@ -0,0 +1,32 @@ +1. 16 / (33)² - (71)² + +2. 4 - √(23) - (52)² / 90 + (82)² + +3. (48)² * (14)² + 12 + +4. √(16) - √(97) + 27 + +5. (92)² / √(22) / 22 * (68)² + (19)² + +6. √(6) - 13 - √(67) + +7. (16)² / 21 * √(16) - (40)² + (52)² + +8. √(83) + √(43) / 71 * √(99) * 41 + +9. (3)² + (13)² - (1)² + +10. √(61) * √(98) - √(72) * √(14) / √(55) + +11. √(22) - √(28) + 59 * 65 + +12. 94 * 13 / (94)² * √(61) + 98 + +13. 14 - √(1) + 34 * 37 + +14. 29 - √(21) * 100 + 20 + +15. √(43) * 15 + √(48) + (92)² + 30 + +16. (100)² + (53)² / 88 + √(70) + diff --git a/doc/张三1/2025-09-28-22-31-33.txt b/doc/张三1/2025-09-28-22-31-33.txt new file mode 100644 index 0000000..7834b7e --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-33.txt @@ -0,0 +1,34 @@ +1. 12 / (39)² / 43 + 27 - (74)² + +2. √(54) * (70)² + √(71) + +3. 62 / (50)² / 19 + +4. √(69) / √(91) * 30 + 89 + +5. √(54) - 16 - (31)² * 31 + +6. (47)² - 69 / (35)² + +7. √(27) / (55)² - √(1) - √(74) - 7 + +8. √(8) * 45 * 70 + (48)² + +9. √(62) / √(74) / 17 - 89 + 26 + +10. 51 - √(27) - 51 / (2)² - 36 + +11. 61 - (52)² + √(9) + +12. √(84) / √(75) + 89 * (58)² + +13. √(27) - √(97) * 26 / √(69) + (19)² + +14. (76)² / 52 * √(7) / (81)² + +15. √(3) / √(81) / 65 * (4)² * (95)² + +16. 38 * 45 + √(92) * (15)² + +17. √(61) - 81 - √(53) / (87)² + diff --git a/doc/张三1/2025-09-28-22-31-34.txt b/doc/张三1/2025-09-28-22-31-34.txt new file mode 100644 index 0000000..f71f81f --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-34.txt @@ -0,0 +1,36 @@ +1. (51)² - 95 - √(85) + (20)² + 98 + +2. (86)² / 37 - √(42) - 44 + 52 + +3. √(42) - √(58) / (23)² / √(10) + +4. (40)² - 50 - (61)² + +5. (90)² - (21)² * 3 + +6. 15 * √(58) + (56)² + +7. 7 / 43 - √(94) + +8. 52 - 85 - 64 * (59)² + +9. (45)² / 53 / (53)² + 76 * (33)² + +10. √(11) + (52)² * (52)² + +11. √(61) + 22 * (24)² / √(31) - √(85) + +12. 20 - √(79) - (100)² + +13. √(5) * (29)² / 75 * √(75) + +14. √(98) + 49 * 32 + √(22) + +15. (93)² - √(83) / (80)² + √(29) + 57 + +16. (28)² * √(58) / 93 + +17. (75)² / √(81) + (40)² + +18. √(86) * 8 * 20 / 33 * (91)² + diff --git a/doc/张三1/2025-09-28-22-31-35.txt b/doc/张三1/2025-09-28-22-31-35.txt new file mode 100644 index 0000000..800329f --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-35.txt @@ -0,0 +1,38 @@ +1. 42 * 45 - (37)² + +2. 90 / (84)² + 13 / √(79) + +3. 66 - √(84) * (97)² + +4. 35 * √(33) + (4)² - √(32) / √(5) + +5. 65 * 98 * (53)² + 95 - 35 + +6. (13)² - 59 + 59 * √(39) / √(80) + +7. 2 + (21)² + (53)² + +8. (54)² / 44 * (41)² - 2 * √(17) + +9. √(32) / 7 - (100)² - √(39) + 95 + +10. 70 * 85 * √(87) + +11. 90 * (33)² + √(86) + +12. (19)² / √(83) / (91)² + +13. √(46) + 89 - 93 + +14. √(62) - (53)² + √(13) / (98)² + +15. √(2) * √(59) / 71 + (13)² + √(87) + +16. 82 / √(83) + 51 - 80 + +17. 46 + (41)² / 27 * 72 + (98)² + +18. √(15) / (52)² + √(6) * (62)² + +19. √(2) - 34 - (47)² + diff --git a/doc/张三1/2025-09-28-22-31-46.txt b/doc/张三1/2025-09-28-22-31-46.txt new file mode 100644 index 0000000..fee2d29 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-46.txt @@ -0,0 +1,22 @@ +1. cos(90°) + +2. 30 / sin(180) + +3. 55 / tan(218°) + +4. 17 * cos(45°) + +5. tan(153) + +6. 82 / (78 + 50 /) cos(300) + +7. 67 + cos(180°) + 20 / 79 + +8. sin(45°) * 89 * 56 + 58 / tan(210°) + +9. sin(300) + +10. sin(120°) / 40 - (tan(315) +) tan(195°) + +11. 21 - sin(120°) + diff --git a/doc/张三1/2025-09-28-22-31-47.txt b/doc/张三1/2025-09-28-22-31-47.txt new file mode 100644 index 0000000..e13f25d --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-47.txt @@ -0,0 +1,24 @@ +1. 79 - 53 * sin(0) + +2. 80 - 86 - 58 / sin(300°) + +3. tan(94°) * 65 + +4. sin(300) - sin(180) - (58 /) tan(330°) * 51 + +5. sin(30°) + 56 + 22 + +6. sin(330) - 10 + +7. cos(342) / cos(60°) / tan(315°) + +8. sin(90) + 14 + +9. 37 / tan(240°) / cos(330°) - 15 / tan(180°) + +10. cos(240) - 38 + cos(315°) + +11. sin(0°) + 5 - sin(60°) - cos(60°) / 38 + +12. sin(178) + diff --git a/doc/张三1/2025-09-28-22-31-48.txt b/doc/张三1/2025-09-28-22-31-48.txt new file mode 100644 index 0000000..b216750 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-48.txt @@ -0,0 +1,24 @@ +1. 29 / 11 + tan(270) - sin(30) * 61 + +2. (cos(270) * sin(30) + sin(150) -) 88 + +3. tan(225°) + +4. 29 - tan(150) + +5. tan(270) * 82 * tan(150°) + +6. 74 + cos(270) - 27 * 45 / 86 + +7. cos(61°) - tan(360) - (29 +) 57 + +8. (27 / tan(330°) +) 8 * sin(30°) * 57 + +9. (93 + tan(315°) *) 86 + +10. sin(360) + +11. tan(30°) * 73 + +12. tan(340°) - (70 *) 80 + diff --git a/doc/张三1/2025-09-28-22-31-50.txt b/doc/张三1/2025-09-28-22-31-50.txt new file mode 100644 index 0000000..466fb86 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-50.txt @@ -0,0 +1,26 @@ +1. 14 + tan(330°) + +2. sin(300°) / 49 + +3. sin(30°) - 39 / 24 - 70 + +4. cos(210) + +5. (sin(180°) / 98 -) cos(235) - cos(61°) - 75 + +6. sin(150) - 73 + 58 + +7. sin(150°) - 6 - tan(180) + sin(225°) - 64 + +8. tan(315) - sin(315°) + tan(45) * (69 +) sin(317) + +9. tan(63) / sin(30) + +10. 60 * tan(45) + +11. tan(135°) / 63 / sin(270) + 84 + 64 + +12. 48 / tan(315°) / 81 + sin(360°) + +13. sin(45°) + diff --git a/doc/张三1/2025-09-28-22-31-51.txt b/doc/张三1/2025-09-28-22-31-51.txt new file mode 100644 index 0000000..71f9e7b --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-51.txt @@ -0,0 +1,28 @@ +1. sin(179°) + 8 - (90 /) 81 + +2. 66 + tan(300°) / 23 - 59 * 46 + +3. 70 - 18 + (tan(56) / cos(180) -) 2 + +4. (29 / 11 * 76 -) cos(360) + +5. cos(210) - cos(210°) + 38 + +6. cos(30°) / 72 / 45 + +7. (tan(135°) -) 98 + 28 + +8. 66 * cos(315) * 25 - 68 + +9. sin(204) + +10. (sin(0) - 2 *) 9 + +11. 17 + tan(0) + +12. cos(117°) * sin(240) + cos(313) - 59 - 72 + +13. tan(45) * 15 / tan(135°) - (tan(90°) +) 75 + +14. tan(330) + diff --git a/doc/张三1/2025-09-28-22-31-52.txt b/doc/张三1/2025-09-28-22-31-52.txt new file mode 100644 index 0000000..58e3364 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-52.txt @@ -0,0 +1,30 @@ +1. tan(185°) + +2. cos(180°) + +3. cos(30°) + +4. (sin(270°) +) sin(150°) / tan(19°) + +5. cos(180°) * 17 + 37 - (24 -) 1 + +6. tan(120°) / sin(30) / 46 + +7. 87 / tan(120°) + 100 - cos(210°) + +8. tan(90°) - 87 - 10 + +9. (cos(315°) *) 45 - cos(315) + 38 + +10. sin(184°) - 81 + +11. cos(60°) + +12. 36 - tan(30) * 11 / 13 + +13. tan(45) / sin(180) - (64 -) 43 + tan(111) + +14. 35 * (5 +) tan(300°) * 93 + +15. tan(315°) + diff --git a/doc/张三1/2025-09-28-22-31-53.txt b/doc/张三1/2025-09-28-22-31-53.txt new file mode 100644 index 0000000..a978aee --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-53.txt @@ -0,0 +1,32 @@ +1. sin(210) - 48 * 54 + +2. tan(150) + +3. 30 - tan(0°) + +4. 14 + cos(60°) * sin(270) * 8 + 60 + +5. 38 - (57 /) sin(270) + +6. (30 -) sin(0°) - 94 - 77 / sin(60) + +7. 15 + sin(180) + 32 / cos(120) + +8. tan(275°) * 75 + tan(30°) - tan(270) + tan(30) + +9. tan(46°) + +10. sin(225°) - 1 + +11. (32 /) cos(156) + 95 + +12. sin(300) + +13. sin(30°) / 65 + cos(52) / cos(0) + +14. 84 * (37 *) 10 - cos(210°) + +15. 81 / (72 - 69 -) cos(0) - 20 + +16. cos(210) / 12 / 61 + diff --git a/doc/张三1/2025-09-28-22-31-54.txt b/doc/张三1/2025-09-28-22-31-54.txt new file mode 100644 index 0000000..e0248d4 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-54.txt @@ -0,0 +1,34 @@ +1. cos(180) * 37 + +2. cos(279) / 95 + +3. tan(180°) + +4. sin(219) / 92 / (8 *) 10 + +5. tan(240°) / (74 - 35 -) 56 + 84 + +6. 86 / 28 + (98 *) cos(135°) + +7. sin(150°) + 1 + +8. sin(191°) + +9. tan(210) + (tan(148) -) 82 + 11 + +10. 9 / 95 + tan(150) + +11. 93 - cos(56°) * 34 * 94 + +12. cos(360°) + +13. tan(120°) + +14. sin(120°) + +15. (84 - sin(318°) *) sin(22) + +16. 65 / (sin(270) + sin(30°) + 6 +) cos(90) + +17. tan(45°) / 73 + diff --git a/doc/张三1/2025-09-28-22-31-56.txt b/doc/张三1/2025-09-28-22-31-56.txt new file mode 100644 index 0000000..a89637b --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-56.txt @@ -0,0 +1,36 @@ +1. cos(143°) + (tan(0°) /) sin(210°) + +2. tan(90°) / tan(353°) / (tan(90°) *) 11 * 40 + +3. tan(90°) / tan(0) / 59 + sin(45°) - cos(360) + +4. tan(330°) / tan(150°) + sin(210°) / 80 + 78 + +5. 92 + 35 / sin(360°) - cos(274) + +6. (cos(240°) +) 57 * 81 + +7. 24 + (81 -) cos(330°) / sin(150) + +8. cos(300) * (30 /) 39 + +9. 46 * (tan(315°) -) 92 + +10. cos(30) + tan(150°) * 2 * 17 + +11. tan(60) * 38 * cos(240) + +12. 87 / tan(45°) + +13. tan(330°) + +14. cos(120°) / 80 + +15. 60 * 28 / tan(240°) * 43 + +16. cos(330) + 59 + +17. 39 * (sin(135°) /) 78 + +18. 29 - (cos(150°) *) 42 + diff --git a/doc/张三1/2025-09-28-22-31-57.txt b/doc/张三1/2025-09-28-22-31-57.txt new file mode 100644 index 0000000..6925fb9 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-57.txt @@ -0,0 +1,38 @@ +1. sin(0°) + +2. sin(330°) + +3. (cos(90°) * 2 /) 24 + +4. 23 - 47 - sin(38°) / cos(279) + +5. tan(60°) / 24 * 71 + +6. (8 / cos(60°) - sin(240°) * 24 *) cos(270°) + +7. 100 - sin(180) / 49 + tan(225) * cos(180°) + +8. sin(270) * 38 + +9. 89 - tan(330°) + +10. tan(360°) - 72 / 30 / 72 + 64 + +11. tan(360) + cos(352) / 80 + 65 + +12. 41 + (tan(300°) * sin(240) -) 5 + +13. 88 + 28 * 45 / tan(30) - 2 + +14. sin(45°) - 60 * (sin(360°) +) sin(251) + +15. tan(135) * 10 + 44 - 33 + +16. sin(135°) + 78 - (54 -) sin(0°) + +17. 30 - 57 + tan(225) + +18. cos(150°) / tan(149°) * sin(225°) + +19. 85 * 32 - cos(120°) + diff --git a/doc/张三1/2025-09-28-22-31-59.txt b/doc/张三1/2025-09-28-22-31-59.txt new file mode 100644 index 0000000..cef5433 --- /dev/null +++ b/doc/张三1/2025-09-28-22-31-59.txt @@ -0,0 +1,40 @@ +1. tan(135) / (19 - 33 +) 40 + +2. tan(300) / 15 + +3. sin(270) + +4. cos(30) - sin(90°) - 50 + 46 + +5. 4 / sin(135°) + +6. 15 / cos(315) + +7. cos(315°) + 63 * 9 + +8. 72 / sin(0) + 5 / cos(90°) * sin(330°) + +9. 24 * tan(315°) - sin(135) + +10. (sin(315°) -) 39 / tan(270) + +11. tan(210°) - (51 -) 79 + 81 / tan(150°) + +12. cos(255) + +13. sin(240°) - (31 - 17 /) tan(225) + +14. 9 * tan(300°) + +15. tan(227) + sin(225) * 99 - (28 +) 88 + +16. 55 * tan(210) * 55 + 35 + +17. cos(60) + +18. tan(300) / cos(360) - tan(45°) + 35 + +19. 53 + (49 *) 92 * tan(225) + +20. (96 +) 70 * tan(60) + diff --git a/doc/张三2/2025-09-28-22-32-11.txt b/doc/张三2/2025-09-28-22-32-11.txt new file mode 100644 index 0000000..cacc83d --- /dev/null +++ b/doc/张三2/2025-09-28-22-32-11.txt @@ -0,0 +1,24 @@ +1. (66 - 35 - 2 / 66) + +2. 81 + 91 * 53 * 98 * 93 + +3. 86 / 63 + 48 * 73 + 35 + +4. 12 - 69 + +5. (82 * 66 / 31) + +6. 90 / (16 / 95) + +7. 44 * 67 * 57 + +8. 84 / 33 + 47 - 40 + +9. (63 - 49 / 35 /) 39 + 37 + +10. 75 / 21 * 11 + +11. 11 * 30 / 73 + +12. 93 / 27 + diff --git a/doc/张三2/2025-09-28-22-32-12.txt b/doc/张三2/2025-09-28-22-32-12.txt new file mode 100644 index 0000000..4f12f73 --- /dev/null +++ b/doc/张三2/2025-09-28-22-32-12.txt @@ -0,0 +1,46 @@ +1. 24 - 37 + 96 * 83 + +2. 60 * 76 - 82 + 68 + +3. 9 + 77 - 89 - 72 + +4. 94 + 89 + +5. 55 * 47 + +6. 34 / 86 - 40 + 56 + +7. 29 / 71 - 75 + +8. 76 + 99 + +9. 15 / 49 + 95 - 17 + +10. 54 * 45 + +11. 68 * 72 + +12. 57 + (6 / 88 - 75) + +13. (9 + 3 + 18) + +14. 47 - 73 + +15. 6 / 52 * (94 - 38) + +16. 52 / 97 * 76 / 53 - 47 + +17. 40 + 44 * 17 / 90 + 22 + +18. 84 - (37 - 69 / 39) + +19. 40 / 44 - 73 + 22 * 51 + +20. 11 - 25 * 20 + 8 + +21. 24 - 92 - 94 / 74 - 56 + +22. 38 + 58 + +23. 6 * 23 / 41 / 85 + diff --git a/doc/张三3/2025-09-28-22-32-21.txt b/doc/张三3/2025-09-28-22-32-21.txt new file mode 100644 index 0000000..0380e74 --- /dev/null +++ b/doc/张三3/2025-09-28-22-32-21.txt @@ -0,0 +1,24 @@ +1. 90 - 99 + 90 + +2. 47 - 37 / 88 * 85 + +3. 6 - (18 - 65) + +4. 20 / 70 - 13 + +5. (66 - 10 / 41 / 14) + +6. 76 / (72 - 21) + +7. 14 / (91 / 74 *) 80 + +8. 96 / 70 - 84 + +9. 71 * 18 / 6 - 47 + +10. 75 / 5 * 68 + +11. 14 - 10 + 78 + +12. 48 * 70 * 6 * 69 + diff --git a/doc/张三3/2025-09-28-22-32-22.txt b/doc/张三3/2025-09-28-22-32-22.txt new file mode 100644 index 0000000..5d53b19 --- /dev/null +++ b/doc/张三3/2025-09-28-22-32-22.txt @@ -0,0 +1,46 @@ +1. (42 / 53 /) 80 + +2. 69 - 60 * 29 / 36 + +3. 81 / 49 + +4. 11 / 51 * 11 / 65 + 36 + +5. 42 - 100 * 1 + +6. 90 - 40 * 94 + +7. 48 / 54 * 2 + 12 - 100 + +8. 37 - 43 / 62 - (62 * 45) + +9. 45 / 78 - 100 / 15 + +10. 12 - 73 / (10 * 11) + +11. 73 - 64 * 97 + +12. 83 / 19 - 96 + +13. 2 / 87 + +14. (44 + 59 -) 89 + +15. 36 * 5 * 54 - (70 + 64) + +16. 55 * 51 * 60 + +17. (58 / 37 / 12 -) 6 - 76 + +18. (80 + 59 - 2) + +19. 39 * 92 + +20. 27 * 60 - 71 + +21. 81 / 13 - (83 + 87 *) 87 + +22. 31 / 36 * 20 - 21 - 1 + +23. 72 - 31 * 96 + 18 + 94 + diff --git a/doc/李四1/2025-09-28-22-32-33.txt b/doc/李四1/2025-09-28-22-32-33.txt new file mode 100644 index 0000000..7929ca0 --- /dev/null +++ b/doc/李四1/2025-09-28-22-32-33.txt @@ -0,0 +1,24 @@ +1. √(75) - √(72) * (10)² + (26)² + +2. 80 * √(75) - √(17) / 33 / 37 + +3. (20)² * 87 - (44)² * 9 + +4. (100)² + 2 * 41 * √(48) - (38)² + +5. √(50) - (79)² / 7 / 18 - √(37) + +6. √(56) - √(15) - (86)² + (58)² + +7. (68)² + (98)² / 58 + +8. (96)² + √(40) - (4)² + 12 + +9. 42 - 22 / √(41) + (53)² + +10. 94 - 69 / (57)² + +11. √(59) / 51 - 55 - √(98) + +12. √(81) * 73 / 85 + diff --git a/doc/李四1/2025-09-28-22-32-35.txt b/doc/李四1/2025-09-28-22-32-35.txt new file mode 100644 index 0000000..27d0e57 --- /dev/null +++ b/doc/李四1/2025-09-28-22-32-35.txt @@ -0,0 +1,46 @@ +1. √(12) - (93)² * √(16) + +2. √(72) / √(35) * (76)² / √(79) * √(74) + +3. √(94) * 60 + 63 + (68)² + +4. 28 - 24 / √(27) - 53 + +5. √(48) + (71)² * 44 + +6. 82 - √(83) + 19 + +7. √(83) / 63 / 92 / 35 / 73 + +8. (49)² * (9)² * √(93) * 52 - 28 + +9. (43)² / (71)² * (72)² - 13 + +10. 98 / √(77) / 23 + 15 / (63)² + +11. √(54) * (17)² + √(75) / √(42) + +12. √(28) + (32)² + 29 + +13. 56 - √(57) - 28 * √(60) / √(8) + +14. 8 / √(20) - √(25) + 82 + +15. √(34) * √(52) - √(21) - (13)² * 90 + +16. 76 + √(82) + 73 * (39)² + +17. √(50) - 77 / (96)² - 90 + √(49) + +18. (81)² / (9)² / √(71) - 81 - √(98) + +19. 50 - 16 / √(31) / √(98) / 26 + +20. (5)² * 88 * √(56) * (20)² - (97)² + +21. 47 / (83)² + (67)² / 88 + +22. 39 / √(14) - 36 + 87 + 1 + +23. 84 + (87)² / 56 + diff --git a/doc/李四2/2025-09-28-22-32-45.txt b/doc/李四2/2025-09-28-22-32-45.txt new file mode 100644 index 0000000..dfd4979 --- /dev/null +++ b/doc/李四2/2025-09-28-22-32-45.txt @@ -0,0 +1,24 @@ +1. 73 + (88)² - 86 + +2. (28)² / 82 + (91)² - 6 * (51)² + +3. √(19) / (36)² + √(24) + √(96) + +4. (55)² + (5)² + 16 / (37)² * 18 + +5. (76)² - 62 * √(2) / (93)² + +6. (30)² * (42)² - 33 + +7. 40 - √(94) + (39)² + +8. √(30) - (67)² + √(60) + +9. (56)² - (75)² + (31)² + (12)² + +10. (10)² * 24 * 4 - 26 + +11. 47 * 100 / √(55) / (58)² - (99)² + +12. 55 + (73)² * (48)² * (88)² + diff --git a/doc/李四2/2025-09-28-22-32-46.txt b/doc/李四2/2025-09-28-22-32-46.txt new file mode 100644 index 0000000..475052f --- /dev/null +++ b/doc/李四2/2025-09-28-22-32-46.txt @@ -0,0 +1,46 @@ +1. √(7) / √(49) * (94)² + 85 / 90 + +2. (64)² + √(92) * √(70) + (46)² + +3. (25)² * 49 - (25)² - (6)² + +4. 71 * √(18) / (19)² + √(4) / (40)² + +5. (27)² * √(41) / 47 * 32 - (51)² + +6. (93)² * 25 * 67 - √(89) + +7. √(99) / 80 + (39)² + +8. √(10) - 2 - 29 / (45)² + +9. (17)² - (82)² * (95)² + +10. 84 + 99 - √(73) + +11. √(82) - 73 / √(26) * √(9) + √(95) + +12. √(64) - √(29) * (13)² * √(38) + 39 + +13. (43)² / √(85) - 68 - 93 + +14. (76)² * 15 * (96)² + +15. √(22) - 49 * 9 + 24 + +16. √(94) * 97 - (81)² + +17. (33)² / √(27) * √(70) + (3)² + +18. √(1) - (44)² * √(48) + +19. 19 + 19 - (91)² * √(51) / 50 + +20. (39)² - 22 * √(14) / (4)² + +21. √(15) / 40 / √(64) + +22. √(71) * √(68) - 32 / √(85) - 87 + +23. 83 * (86)² - √(88) + diff --git a/doc/李四3/2025-09-28-22-32-56.txt b/doc/李四3/2025-09-28-22-32-56.txt new file mode 100644 index 0000000..f75de48 --- /dev/null +++ b/doc/李四3/2025-09-28-22-32-56.txt @@ -0,0 +1,24 @@ +1. (14)² * (77)² / (39)² / 89 * 87 + +2. 75 * 38 - √(22) + 13 / (14)² + +3. (96)² * 1 - (45)² + +4. 66 + 84 * 89 * (64)² + √(99) + +5. 79 - 25 + (70)² + +6. 79 + (75)² + (35)² / 17 / 59 + +7. 47 + (77)² - √(23) + +8. √(32) + (56)² - √(71) * (100)² + +9. √(11) + √(62) * √(67) * (26)² / √(54) + +10. √(23) + √(2) + 68 + +11. 31 - (57)² + (71)² + +12. √(22) / 92 - 1 + diff --git a/doc/李四3/2025-09-28-22-32-57.txt b/doc/李四3/2025-09-28-22-32-57.txt new file mode 100644 index 0000000..69e2f7b --- /dev/null +++ b/doc/李四3/2025-09-28-22-32-57.txt @@ -0,0 +1,46 @@ +1. 36 / √(62) + (27)² + +2. (16)² - 5 - √(21) + +3. √(42) / 39 * √(21) - 15 + +4. 11 - (29)² * 96 - 93 + +5. (73)² - 88 + √(70) + +6. 70 + 16 - 59 / (52)² + √(97) + +7. 88 / √(39) + √(68) + (35)² + +8. 94 / √(63) / √(3) + +9. (38)² * 44 + 89 + +10. (66)² * (38)² + 94 / (70)² - 88 + +11. (82)² / (68)² / 60 + 3 + +12. √(36) * 84 * √(81) * √(4) + +13. 15 / 21 - √(66) * (5)² + +14. 55 / (19)² - √(64) + +15. √(24) * 42 - 65 + +16. 80 + 74 + √(76) - 75 - (22)² + +17. 78 - √(65) + (18)² + +18. 6 * 78 - 95 / (21)² / 58 + +19. √(20) / (33)² - 39 * (18)² + +20. (24)² + 7 - 86 + √(49) + √(94) + +21. (52)² - (84)² / 61 + +22. (85)² - √(83) * √(75) / (43)² - (80)² + +23. √(20) - √(99) + (78)² + diff --git a/doc/王五1/2025-09-28-22-33-05.txt b/doc/王五1/2025-09-28-22-33-05.txt new file mode 100644 index 0000000..9c110b2 --- /dev/null +++ b/doc/王五1/2025-09-28-22-33-05.txt @@ -0,0 +1,24 @@ +1. tan(60) + +2. cos(210) / 84 - (tan(176) + 39 /) 22 + +3. cos(210°) - 43 / 3 * 20 + +4. (98 / sin(315) * tan(119°) *) 28 + +5. 56 / 55 * 60 + cos(110) - sin(150°) + +6. tan(120) - 46 / sin(315°) + 58 + +7. 45 / sin(210) + +8. tan(360) + sin(60) + +9. 52 + sin(336) + sin(16) + +10. sin(210°) + 88 + +11. 77 + 12 / tan(120°) + +12. (11 /) 38 + cos(135) * 16 + diff --git a/doc/王五1/2025-09-28-22-33-06.txt b/doc/王五1/2025-09-28-22-33-06.txt new file mode 100644 index 0000000..23699af --- /dev/null +++ b/doc/王五1/2025-09-28-22-33-06.txt @@ -0,0 +1,46 @@ +1. sin(180°) * 89 + +2. 6 - tan(30°) - tan(210) + +3. 61 * sin(303°) + +4. (tan(45°) /) 97 * 66 + +5. (75 -) cos(161°) / 27 + 51 + tan(330) + +6. 100 - cos(135°) + +7. (tan(90°) +) 66 / 29 + +8. sin(30°) + sin(150) * 5 + +9. sin(0°) / 15 + +10. tan(340) / 62 + +11. sin(213°) / 74 + +12. tan(60°) + +13. (cos(330) * tan(210) / 7 -) 50 * 83 + +14. 73 - tan(315°) + +15. 57 / tan(210°) + 57 - 91 / 90 + +16. 96 * cos(225) + +17. 6 * sin(270°) + +18. sin(240) + +19. sin(300°) - cos(210°) + +20. 33 * (40 - 78 / sin(250) -) cos(183°) + +21. 95 * 23 + sin(150) - (52 +) 47 + +22. cos(178°) / tan(135°) + +23. 98 * cos(315°) + diff --git a/doc/王五2/2025-09-28-22-33-14.txt b/doc/王五2/2025-09-28-22-33-14.txt new file mode 100644 index 0000000..4e6c8e6 --- /dev/null +++ b/doc/王五2/2025-09-28-22-33-14.txt @@ -0,0 +1,24 @@ +1. 84 * cos(90°) + +2. sin(0°) - (48 +) 32 + +3. 53 * 83 / sin(90°) + +4. 15 + tan(240) + 31 + sin(86°) / 18 + +5. cos(225) + +6. tan(0°) + 32 + sin(315) / 87 * tan(150) + +7. sin(240) + +8. cos(275) + +9. 87 * 87 + 53 + tan(240) + +10. tan(300°) - (cos(30°) /) 65 + +11. (cos(78°) -) sin(270°) * 13 + +12. 53 - 41 * cos(210°) * 6 + diff --git a/doc/王五2/2025-09-28-22-33-15.txt b/doc/王五2/2025-09-28-22-33-15.txt new file mode 100644 index 0000000..1f93606 --- /dev/null +++ b/doc/王五2/2025-09-28-22-33-15.txt @@ -0,0 +1,46 @@ +1. sin(30°) / sin(30) + 76 + 53 + +2. (tan(240) + 56 +) 43 + +3. 17 + cos(303°) + +4. cos(322°) - 29 - (37 -) 7 + +5. tan(30) + +6. sin(225) * cos(180°) - 40 + 17 + +7. (tan(259) - 23 +) 71 + +8. tan(212) + +9. tan(30) + +10. 2 / cos(0°) + +11. cos(150) + 25 + +12. sin(30) + 5 / cos(45) + +13. 81 / 94 / sin(120) / cos(60) / cos(180°) + +14. 88 * (75 -) cos(90) / 62 + +15. cos(270) + 94 + 20 * 33 / 70 + +16. tan(180) * 94 + +17. 22 * sin(210°) + +18. tan(120) * 73 + +19. sin(315) + +20. (4 - cos(300°) /) tan(315) / cos(252) + +21. sin(300) / 86 + +22. (31 - cos(0°) -) 66 + +23. 65 * sin(360) + tan(148°) * cos(315°) + diff --git a/doc/王五3/2025-09-28-22-33-22.txt b/doc/王五3/2025-09-28-22-33-22.txt new file mode 100644 index 0000000..78de36b --- /dev/null +++ b/doc/王五3/2025-09-28-22-33-22.txt @@ -0,0 +1,24 @@ +1. cos(225) + +2. 100 * 17 * tan(30°) + sin(18) + +3. 25 + tan(108°) + (cos(150°) -) tan(45°) + +4. (cos(357) /) 47 * tan(45°) - 92 / 74 + +5. sin(150°) + +6. cos(0) + (74 -) cos(319) + +7. cos(90°) * sin(120°) + +8. 62 + tan(330°) / tan(150) * sin(360°) / 6 + +9. cos(300°) + +10. cos(60°) + (tan(210) *) 34 + +11. 35 - 40 - cos(120°) + (25 -) 80 + +12. (79 -) cos(240°) - tan(135°) + diff --git a/doc/王五3/2025-09-28-22-33-23.txt b/doc/王五3/2025-09-28-22-33-23.txt new file mode 100644 index 0000000..6729353 --- /dev/null +++ b/doc/王五3/2025-09-28-22-33-23.txt @@ -0,0 +1,46 @@ +1. 18 * (59 *) sin(315) + +2. tan(300) / (85 * 29 -) 36 + +3. 56 + cos(330°) + +4. (tan(90) * 79 / 38 +) 11 - 61 + +5. tan(300) + +6. 99 + cos(193) + 6 - 43 + +7. tan(240°) * 29 - 68 + +8. (cos(180) /) cos(90°) / sin(120) / 6 + +9. cos(90) + +10. cos(60°) + +11. cos(210°) + +12. sin(45) / 6 + +13. 26 / tan(13) + +14. cos(146) + +15. (cos(90) * 32 /) 32 + +16. cos(240°) / cos(150) - (tan(294°) +) cos(270) / 69 + +17. cos(210) + 57 + 84 - cos(210°) * cos(170°) + +18. 79 + sin(135) / (16 /) 82 + +19. tan(360) + +20. cos(360°) / 72 + +21. 31 / 52 - tan(270°) - 78 * cos(135) + +22. tan(0) + (6 /) 84 + +23. (sin(192) - 92 /) 5 + diff --git a/out/artifacts/MathGenerator1_jar/MathGenerator1.jar b/out/artifacts/MathGenerator1_jar/MathGenerator1.jar new file mode 100644 index 0000000..6f409d2 Binary files /dev/null and b/out/artifacts/MathGenerator1_jar/MathGenerator1.jar differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d8248f9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,118 @@ + + + 4.0.0 + + + com.math + math-test-generator + 1.0.0 + + + + 8 + 8 + UTF-8 + + Main + + + + + + + junit + junit + 4.13.2 + test + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 8 + 8 + UTF-8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + + + ${main.class} + + true + lib/ + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.3.0 + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory}/lib + false + false + true + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.4.2 + + + + ${main.class} + + + + + jar-with-dependencies + + math-test-generator + false + + + + make-assembly + package + + single + + + + + + + \ No newline at end of file diff --git a/src/main/java/entity/Question.java b/src/main/java/entity/Question.java new file mode 100644 index 0000000..9239c2c --- /dev/null +++ b/src/main/java/entity/Question.java @@ -0,0 +1,58 @@ +<<<<<<< HEAD +package entity; + +/** + 题目实体类 + 封装题目的基本属性:题号和题目内容 + 提供格式化的字符串输出方法 + */ +public class Question { + private final int number; // 题号 + private final String content; // 题目内容(数学表达式) + + /** + 构造函数 + @param number 题号(从1开始) + @param content 题目内容 + */ +======= +package main.java.entity; + +//题目类定义 +public class Question { + private int number; + private String content; + +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 + public Question(int number, String content) { + this.number = number; + this.content = content; + } + +<<<<<<< HEAD + // Getter方法 + public int getNumber() { return number; } + public String getContent() { return content; } + + /** + 重写toString方法,格式化输出题目 + 格式:题号. 题目内容 + @return 格式化后的题目字符串 + */ + @Override + public String toString() { + return number + ". " + content; + } +} +======= + //获取题目信息 + public int getNumber() {return number;} + public String getContent() {return content;} + + @Override + //重写toString方法返回number与content + public String toString() { + return number + " " + content; + } +} +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/entity/User.java b/src/main/java/entity/User.java new file mode 100644 index 0000000..1d51d7a --- /dev/null +++ b/src/main/java/entity/User.java @@ -0,0 +1,49 @@ +<<<<<<< HEAD +package entity; + +/** + 用户实体类 + 用于存储用户的基本信息:用户名、密码和用户类型(小学/初中/高中) + 这是一个不可变类,所有字段都是final的,确保对象创建后状态不会被修改 + */ +public class User { + private final String username; // 用户名 + private final String password; // 密码 + private final String type; // 用户类型:小学、初中、高中 + + /** + 构造函数 + @param username 用户名 + @param password 密码 + @param type 用户类型 + */ +======= +package main.java.entity; + +//用户类定义 +public class User { + private String username; + private String password; + private String type; + +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 + public User(String username, String password, String type) { + this.username = username; + this.password = password; + this.type = type; + } + +<<<<<<< HEAD + // Getter方法 + public String getUsername() { return username; } + public String getPassword() { return password; } + public String getType() { return type; } +} +======= + //获得用户信息 + public String getUsername() {return username;} + public String getPassword() {return password;} + public String getType() {return type;} +} + +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/factory/QuestionFactory.java b/src/main/java/factory/QuestionFactory.java new file mode 100644 index 0000000..c01b113 --- /dev/null +++ b/src/main/java/factory/QuestionFactory.java @@ -0,0 +1,34 @@ +<<<<<<< HEAD +package factory; + +/** + 题目生成器工厂类 + 使用工厂模式创建不同难度的题目生成器 + 封装了对象创建的细节,客户端无需知道具体实现类 + */ +public class QuestionFactory { + /** + 根据类型创建对应的题目生成器 + @param type 题目类型:小学、初中、高中 + @return 对应的题目生成器实例 + @throws IllegalArgumentException 如果类型不支持 + */ + public static QuestionGenerator createGenerator(String type) { + switch (type) { + case "小学": + return new generator.PrimaryQuestionGenerator(); + case "初中": + return new generator.JuniorQuestionGenerator(); + case "高中": + return new generator.SeniorQuestionGenerator(); + default: + throw new IllegalArgumentException("不支持的题目类型: " + type); + } + } +======= +package main.java.factory; + +public class QuestionFactory { + +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 +} diff --git a/src/main/java/factory/QuestionGenerator.java b/src/main/java/factory/QuestionGenerator.java new file mode 100644 index 0000000..dad820b --- /dev/null +++ b/src/main/java/factory/QuestionGenerator.java @@ -0,0 +1,37 @@ +<<<<<<< HEAD +package factory; + +import entity.Question; +import java.util.List; + +/** + 题目生成器接口 + 定义所有题目生成器必须实现的方法 + 采用策略模式,支持不同难度题目的生成 + */ +public interface QuestionGenerator { + /** + 生成指定数量的题目列表 + @param count 要生成的题目数量 + @return 题目列表,包含指定数量的题目 + */ + List generateQuestions(int count); + + /** + 生成单个题目 + @return 单个题目对象 + */ + Question generateQuestion(); + + /** + 获取题目生成器的类型 + @return 类型字符串(小学/初中/高中) + */ + String getType(); +} +======= +package main.java.factory; + +public class QuestionGenerator { +} +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/generator/JuniorQuestionGenerator.java b/src/main/java/generator/JuniorQuestionGenerator.java new file mode 100644 index 0000000..5f3f710 --- /dev/null +++ b/src/main/java/generator/JuniorQuestionGenerator.java @@ -0,0 +1,244 @@ +<<<<<<< HEAD +package generator; + +import entity.Question; +import factory.QuestionGenerator; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + 初中题目生成器 +

生成初中难度的数学题目,包含平方(²)和开根号(√)运算符 + 确保每个题目至少有一个平方或开根号运算符,并且这些运算符处理的操作数 + 需要通过四则运算符与其他操作数连接 + */ +public class JuniorQuestionGenerator implements QuestionGenerator { + private static final String[] BINARY_OPERATORS = {"+", "-", "*", "/"}; + private static final String[] UNARY_OPERATORS = {"²", "√"}; + private static final int MIN_OPERAND_COUNT = 3; + private static final int MAX_OPERAND_COUNT = 5; + private static final int MIN_OPERAND_VALUE = 1; + private static final int MAX_OPERAND_VALUE = 100; + private static final double UNARY_OPERATOR_PROBABILITY = 0.6; + + private final Random random; + + /** + 构造函数 + */ + public JuniorQuestionGenerator() { + this.random = new Random(); + } + + /** + 生成指定数量的初中题目 + @param count 要生成的题目数量 + @return 题目列表,包含指定数量的初中难度题目 + */ + @Override + public List generateQuestions(int count) { + List questions = new ArrayList<>(); + for (int i = 0; i < count; i++) { + questions.add(generateQuestion()); + } + return questions; + } + + /** + 生成单个初中题目 +

确保题目中至少有一个平方或开根号的运算符,并且这些运算符处理的操作数 + 需要通过四则运算符与其他操作数连接 + @return 单个题目对象 + */ + @Override + public Question generateQuestion() { + String expression; + boolean hasAdvancedOperator; + boolean hasBinaryConnection; + + // 循环生成直到满足条件 + do { + expression = generateValidExpression(); + hasAdvancedOperator = containsAdvancedOperator(expression); + hasBinaryConnection = hasBinaryOperatorConnection(expression); + } while (!hasAdvancedOperator || !hasBinaryConnection); + + return new Question(0, expression); + } + + /** + * 获取题目生成器的类型 + * + * @return 类型字符串"初中" + */ + @Override + public String getType() { + return "初中"; + } + + /** + * 生成有效的表达式 + * + *

生成包含操作数和运算符的表达式,确保有足够的操作数来支持四则运算连接 + * + * @return 有效的表达式字符串 + */ + private String generateValidExpression() { + int operandCount = random.nextInt(MAX_OPERAND_COUNT - MIN_OPERAND_COUNT + 1) + MIN_OPERAND_COUNT; + StringBuilder expression = new StringBuilder(); + + // 添加第一个操作数,可能应用一元运算符 + expression.append(generateOperandWithPossibleUnaryOperator()); + + // 添加后续操作数和运算符 + for (int i = 1; i < operandCount; i++) { + expression.append(" ").append(generateBinaryOperator()).append(" "); + expression.append(generateOperandWithPossibleUnaryOperator()); + } + + return expression.toString(); + } + + /** + * 生成可能带有一元运算符的操作数 + * + * @return 可能应用了一元运算符的操作数字符串 + */ + private String generateOperandWithPossibleUnaryOperator() { + String operand = generateOperand(); + + // 根据概率决定是否应用一元运算符 + if (random.nextDouble() < UNARY_OPERATOR_PROBABILITY) { + String operator = UNARY_OPERATORS[random.nextInt(UNARY_OPERATORS.length)]; + return applyUnaryOperator(operand, operator); + } + + return operand; + } + + /** + * 应用一元运算符到操作数 + * + * @param operand 操作数 + * @param operator 一元运算符 + * @return 应用运算符后的表达式 + */ + private String applyUnaryOperator(String operand, String operator) { + switch (operator) { + case "²": + return "(" + operand + ")²"; + case "√": + return "√(" + operand + ")"; + default: + return operand; + } + } + + /** + * 生成操作数(1-100) + * + * @return 操作数字符串 + */ + private String generateOperand() { + return String.valueOf(random.nextInt(MAX_OPERAND_VALUE) + MIN_OPERAND_VALUE); + } + + /** + * 生成二元运算符 + * + * @return 二元运算符字符串 + */ + private String generateBinaryOperator() { + return BINARY_OPERATORS[random.nextInt(BINARY_OPERATORS.length)]; + } + + /** + * 检查表达式是否包含高级运算符(平方或开根号) + * + * @param expression 数学表达式 + * @return 如果包含高级运算符返回true,否则返回false + */ + private boolean containsAdvancedOperator(String expression) { + return expression.contains("²") || expression.contains("√"); + } + + /** + * 检查高级运算符处理的操作数是否有四则运算符连接其他操作数 + * + *

确保平方或根号处理的操作数不是孤立存在的,而是通过四则运算与其他操作数连接 + * + * @param expression 数学表达式 + * @return 如果满足连接条件返回true,否则返回false + */ + private boolean hasBinaryOperatorConnection(String expression) { + // 如果表达式包含高级运算符,检查是否有足够的二元运算符连接 + if (containsAdvancedOperator(expression)) { + int binaryOperatorCount = countBinaryOperators(expression); + // 至少需要1个二元运算符来连接操作数 + return binaryOperatorCount >= 1; + } + return false; + } + + /** + * 计算表达式中二元运算符的数量 + * + * @param expression 数学表达式 + * @return 二元运算符的数量 + */ + private int countBinaryOperators(String expression) { + int count = 0; + for (String operator : BINARY_OPERATORS) { + // 简单的计数方法,实际可能需要更复杂的解析 + int index = expression.indexOf(operator); + while (index >= 0) { + count++; + index = expression.indexOf(operator, index + 1); + } + } + return count; + } + + /** + * 生成一个确保满足条件的表达式(备用方法) + * + *

这个方法确保生成的表达式一定包含高级运算符并且有二元运算符连接 + * + * @return 满足条件的表达式 + */ + private String generateGuaranteedValidExpression() { + StringBuilder expression = new StringBuilder(); + + // 至少生成3个操作数以确保有连接 + int operandCount = random.nextInt(MAX_OPERAND_COUNT - MIN_OPERAND_COUNT + 1) + MIN_OPERAND_COUNT; + + // 第一个操作数:普通操作数 + expression.append(generateOperand()); + expression.append(" ").append(generateBinaryOperator()).append(" "); + + // 第二个操作数:应用高级运算符 + String advancedOperand = generateOperand(); + String unaryOperator = UNARY_OPERATORS[random.nextInt(UNARY_OPERATORS.length)]; + expression.append(applyUnaryOperator(advancedOperand, unaryOperator)); + + // 如果有更多操作数,继续添加 + for (int i = 2; i < operandCount; i++) { + expression.append(" ").append(generateBinaryOperator()).append(" "); + // 随机决定是否应用一元运算符 + if (random.nextBoolean()) { + expression.append(generateOperandWithPossibleUnaryOperator()); + } else { + expression.append(generateOperand()); + } + } + + return expression.toString(); + } +} +======= +package main.java.generator; + +public class JuniorQuestionGenerator { +} +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/generator/PrimaryQuestionGenerator.java b/src/main/java/generator/PrimaryQuestionGenerator.java new file mode 100644 index 0000000..3986c7b --- /dev/null +++ b/src/main/java/generator/PrimaryQuestionGenerator.java @@ -0,0 +1,208 @@ +<<<<<<< HEAD +package generator; + +import entity.Question; +import factory.QuestionGenerator; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + 小学题目生成器 +

生成小学难度的数学题目,只包含加减乘除和括号 + 确保每个题目至少有两个操作数,操作数范围1-100 + */ +public class PrimaryQuestionGenerator implements QuestionGenerator { + private static final String[] OPERATORS = {"+", "-", "*", "/"}; + private static final int MIN_OPERAND_COUNT = 2; + private static final int MAX_OPERAND_COUNT = 5; + private static final int MIN_OPERAND_VALUE = 1; + private static final int MAX_OPERAND_VALUE = 100; + private static final double PARENTHESIS_PROBABILITY = 0.3; + + private final Random random; + + /** + 构造函数 + */ + public PrimaryQuestionGenerator() { + this.random = new Random(); + } + + /** + 生成指定数量的小学题目 + @param count 要生成的题目数量 + @return 题目列表,包含指定数量的小学难度题目 + */ + @Override + public List generateQuestions(int count) { + List questions = new ArrayList<>(); + for (int i = 0; i < count; i++) { + questions.add(generateQuestion()); + } + return questions; + } + + /** + 生成单个小学题目 +

题目包含2-5个操作数,操作数范围1-100 + 只包含加减乘除运算符,可能包含括号 + @return 单个题目对象 + */ + @Override + public Question generateQuestion() { + // 生成基础表达式(不带括号) + String baseExpression = generateBaseExpression(); + + // 随机决定是否添加括号 + String finalExpression = maybeAddParentheses(baseExpression); + + return new Question(0, finalExpression); + } + + /** + 获取题目生成器的类型 + @return 类型字符串"小学" + */ + @Override + public String getType() { + return "小学"; + } + + /** + 生成基础表达式(不带括号) + @return 基础表达式字符串 + */ + private String generateBaseExpression() { + int operandCount = random.nextInt(MAX_OPERAND_COUNT - MIN_OPERAND_COUNT + 1) + MIN_OPERAND_COUNT; + StringBuilder expression = new StringBuilder(); + + // 添加第一个操作数 + expression.append(generateOperand()); + + // 添加后续操作数和运算符 + for (int i = 1; i < operandCount; i++) { + expression.append(" ").append(generateOperator()).append(" "); + expression.append(generateOperand()); + } + + return expression.toString(); + } + + /** + 随机决定是否为表达式添加括号 + @param expression 原始表达式 + @return 可能添加括号后的表达式 + */ + private String maybeAddParentheses(String expression) { + // 只有当操作数大于2时才考虑添加括号 + if (countOperands(expression) > 2 && random.nextDouble() < PARENTHESIS_PROBABILITY) { + return addParentheses(expression); + } + return expression; + } + + /** + 为表达式添加括号 +

在表达式中随机选择一个子表达式添加括号 + @param expression 原始表达式 + @return 添加括号后的表达式 + */ + private String addParentheses(String expression) { + String[] parts = expression.split(" "); + + // 如果表达式太短,直接为整个表达式添加括号 + if (parts.length <= 3) { + return "(" + expression + ")"; + } + + // 随机选择括号的起始位置(操作数的位置) + int startPos = random.nextInt(parts.length / 2) * 2; // 确保在操作数位置 + + // 随机选择括号的长度(包含的操作数数量,至少2个) + int maxLength = (parts.length - startPos) / 2 + 1; + int length = random.nextInt(maxLength - 1) + 2; // 至少2个操作数 + + // 计算结束位置 + int endPos = startPos + (length * 2 - 1); + if (endPos >= parts.length) { + endPos = parts.length - 1; + } + + // 构建带括号的表达式 + StringBuilder result = new StringBuilder(); + for (int i = 0; i < parts.length; i++) { + if (i == startPos) { + result.append("("); + } + + result.append(parts[i]); + + if (i == endPos) { + result.append(")"); + } + + if (i < parts.length - 1) { + result.append(" "); + } + } + + return result.toString(); + } + + /** + 计算表达式中的操作数数量 + @param expression 数学表达式 + @return 操作数的数量 + */ + private int countOperands(String expression) { + // 简单估算:操作数数量 ≈ (分割后的数组长度 + 1) / 2 + String[] parts = expression.split(" "); + return (parts.length + 1) / 2; + } + + /** + 生成操作数(1-100) + @return 操作数字符串 + */ + private String generateOperand() { + return String.valueOf(random.nextInt(MAX_OPERAND_VALUE) + MIN_OPERAND_VALUE); + } + + /** + 生成运算符 + @return 运算符字符串 + */ + private String generateOperator() { + return OPERATORS[random.nextInt(OPERATORS.length)]; + } + + /** + 生成一个确保有两个操作数的表达式(备用方法) +

这个方法确保生成的表达式至少有两个操作数 + @return 至少有两个操作数的表达式 + */ + private String generateGuaranteedTwoOperandExpression() { + StringBuilder expression = new StringBuilder(); + + // 确保至少有两个操作数 + int operandCount = random.nextInt(MAX_OPERAND_COUNT - MIN_OPERAND_COUNT + 1) + MIN_OPERAND_COUNT; + + // 添加第一个操作数 + expression.append(generateOperand()); + + // 添加后续操作数和运算符 + for (int i = 1; i < operandCount; i++) { + expression.append(" ").append(generateOperator()).append(" "); + expression.append(generateOperand()); + } + + return expression.toString(); + } +} +======= +package main.java.generator; + +public class PrimaryQuestionGenerator { +} +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/generator/SeniorQuestionGenerator.java b/src/main/java/generator/SeniorQuestionGenerator.java new file mode 100644 index 0000000..9963ecb --- /dev/null +++ b/src/main/java/generator/SeniorQuestionGenerator.java @@ -0,0 +1,234 @@ +<<<<<<< HEAD +package generator; + +import entity.Question; +import factory.QuestionGenerator; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + 高中题目生成器(包含三角函数) + 生成高中难度的数学题目,确保每个题目至少包含一个三角函数 + 操作数范围:1-100 + 操作数数量:1-5个 + */ +public class SeniorQuestionGenerator implements QuestionGenerator { + private static final String[] BINARY_OPERATORS = {"+", "-", "*", "/"}; + private static final String[] TRIGONOMETRIC_FUNCTIONS = {"sin", "cos", "tan"}; + private final Random random = new Random(); + + /** + 生成指定数量的高中题目 + @param count 题目数量 + @return 题目列表 + */ + @Override + public List generateQuestions(int count) { + List questions = new ArrayList<>(); + for (int i = 1; i <= count; i++) { + questions.add(generateQuestion()); + } + return questions; + } + + /** + 生成单个高中题目 + 确保题目中至少包含一个三角函数 + 操作数数量在1-5之间 + 操作数范围在1-100之间 + @return 单个题目 + */ + @Override + public Question generateQuestion() { + // 生成1-5个操作数 + int operandCount = random.nextInt(5) + 1; + + // 确保至少有一个三角函数 + int trigFunctionCount = random.nextInt(operandCount) + 1; + + // 构建表达式 + StringBuilder expression = new StringBuilder(); + + // 生成第一个操作数或三角函数 + if (random.nextBoolean() && trigFunctionCount > 0) { + expression.append(generateTrigonometricFunction()); + trigFunctionCount--; + } else { + expression.append(generateOperand()); + } + + // 生成后续操作数和运算符 + for (int i = 1; i < operandCount; i++) { + // 添加运算符 + expression.append(" ").append(generateBinaryOperator()).append(" "); + + // 决定下一个是普通操作数还是三角函数 + if (random.nextBoolean() && trigFunctionCount > 0) { + expression.append(generateTrigonometricFunction()); + trigFunctionCount--; + } else { + expression.append(generateOperand()); + } + } + + // 如果还没有包含三角函数,强制添加一个 + if (!expression.toString().contains("sin") && + !expression.toString().contains("cos") && + !expression.toString().contains("tan")) { + // 在表达式的随机位置插入一个三角函数 + expression = insertTrigonometricFunction(expression.toString()); + } + + // 随机添加括号以增加复杂度 + if (operandCount > 2 && random.nextBoolean()) { + expression = addParentheses(expression.toString()); + } + + return new Question(0, expression.toString()); + } + + /** + 获取生成器类型 + @return "高中" + */ + @Override + public String getType() { + return "高中"; + } + + /** + 生成操作数(1-100) + @return 随机操作数 + */ + private int generateOperand() { + return random.nextInt(100) + 1; + } + + /** + 生成二元运算符 + @return 运算符字符串 + */ + private String generateBinaryOperator() { + return BINARY_OPERATORS[random.nextInt(BINARY_OPERATORS.length)]; + } + + /** + 生成三角函数表达式 + @return 三角函数表达式字符串 + */ + private String generateTrigonometricFunction() { + String function = TRIGONOMETRIC_FUNCTIONS[random.nextInt(TRIGONOMETRIC_FUNCTIONS.length)]; + int angle = generateAngle(); // 生成合适的角度值 + + // 随机决定是否使用度数符号 + if (random.nextBoolean()) { + return function + "(" + angle + "°)"; + } else { + return function + "(" + angle + ")"; + } + } + + /** + 生成适合三角函数的角度值 + 返回常见角度值,使三角函数值更合理 + @return 角度值 + */ + private int generateAngle() { + // 常见角度值,使三角函数值更合理 + int[] commonAngles = {0, 30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330, 360}; + + // 80%的概率使用常见角度,20%的概率使用随机角度 + if (random.nextDouble() < 0.8) { + return commonAngles[random.nextInt(commonAngles.length)]; + } else { + return random.nextInt(360) + 1; // 1-360度 + } + } + + /** + 在表达式中插入三角函数 + 确保表达式至少包含一个三角函数 + @param expression 原始表达式 + @return 包含三角函数的表达式 + */ + private StringBuilder insertTrigonometricFunction(String expression) { + String[] parts = expression.split(" "); + StringBuilder newExpression = new StringBuilder(); + + // 随机选择一个位置插入三角函数 + int insertPosition = random.nextInt(parts.length); + + for (int i = 0; i < parts.length; i++) { + if (i == insertPosition) { + // 在选定位置插入三角函数 + if (i % 2 == 0) { // 偶数位置是操作数 + // 替换操作数为三角函数 + newExpression.append(generateTrigonometricFunction()); + } else { // 奇数位置是运算符 + // 在运算符后添加三角函数 + newExpression.append(parts[i]).append(" ").append(generateTrigonometricFunction()); + // 跳过下一个操作数 + if (i + 1 < parts.length) { + i++; + } + } + } else { + newExpression.append(parts[i]); + } + + if (i < parts.length - 1) { + newExpression.append(" "); + } + } + + return newExpression; + } + + /** + 为表达式添加括号 + @param expression 原始表达式 + @return 添加括号后的表达式 + */ + private StringBuilder addParentheses(String expression) { + // 简化的括号添加逻辑:为部分表达式添加括号 + String[] parts = expression.split(" "); + + if (parts.length <= 2) { + return new StringBuilder(expression); + } + + // 随机选择括号的起始和结束位置 + int start = random.nextInt(parts.length / 2) * 2; // 确保从操作数开始 + int end = start + 2 + random.nextInt((parts.length - start) / 2) * 2; // 确保以操作数结束 + + if (end - start < 2 || end > parts.length) { + return new StringBuilder(expression); + } + + StringBuilder result = new StringBuilder(); + for (int i = 0; i < parts.length; i++) { + if (i == start) { + result.append("("); + } + + result.append(parts[i]); + + if (i == end - 1) { + result.append(")"); + } + + if (i < parts.length - 1) { + result.append(" "); + } + } + + return result; + } +} +======= +package main.java.generator; + +public class SeniorQuestionGenerator { +} +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java new file mode 100644 index 0000000..74ba0f2 --- /dev/null +++ b/src/main/java/org/example/Main.java @@ -0,0 +1,184 @@ +package org.example; + +import entity.User; +import entity.Question; +import service.UserService; +import service.QuestionService; +import service.FileService; +import service.ValidationService; +import java.util.List; +import java.util.Scanner; + +/** + * 主程序类 - 应用程序的入口点 + * 负责协调各个组件,处理用户交互 + * 实现主要的业务流程控制 + */ +public class Main { + // 依赖注入的服务组件 + private final UserService userService; + private final QuestionService questionService; + private final FileService fileService; + private final ValidationService validationService; + private final Scanner scanner; + + // 当前会话状态 + private User currentUser; // 当前登录用户 + private String currentType; // 当前题目类型 + + /** + * 构造函数 - 初始化所有服务组件 + */ + public Main() { + this.userService = new UserService(); + this.validationService = new ValidationService(); + this.questionService = new QuestionService(validationService); + this.fileService = new FileService(); + this.scanner = new Scanner(System.in); + } + + /** + * 应用程序主入口 + * @param args 命令行参数 + */ + public static void main(String[] args) { + Main app = new Main(); + app.run(); + } + + /** + * 主运行循环 + * 控制整个应用程序的生命周期 + */ + public void run() { + System.out.println("=== 中小学数学卷子自动生成程序 ==="); + + while (true) { + // 登录阶段 + if (!login()) { + continue; // 登录失败,重新尝试 + } + + // 题目生成阶段 + generateQuestionsLoop(); + } + } + + /** + * 用户登录处理 + * @return 登录成功返回true,失败返回false + */ + private boolean login() { + System.out.print("请输入用户名和密码(用空格隔开): "); + String input = scanner.nextLine().trim(); + + // 输入验证 + if (input.isEmpty()) { + System.out.println("请输入正确的用户名、密码"); + return false; + } + + String[] credentials = input.split(" "); + if (credentials.length != 2) { + System.out.println("请输入正确的用户名、密码"); + return false; + } + + String username = credentials[0]; + String password = credentials[1]; + + // 用户认证 + User user = userService.authenticate(username, password); + if (user == null) { + System.out.println("请输入正确的用户名、密码"); + return false; + } + + // 登录成功,设置当前状态 + currentUser = user; + currentType = user.getType(); + System.out.println("当前选择为" + currentType + "出题"); + return true; + } + + /** + * 题目生成循环 + * 处理登录后的各种用户操作 + */ + private void generateQuestionsLoop() { + while (currentUser != null) { + System.out.print("准备生成" + currentType + "数学题目,请输入生成题目数量(输入-1将退出当前用户,重新登录): "); + String input = scanner.nextLine().trim(); + + // 检查是否是切换命令 + if (validationService.isValidSwitchCommand(input)) { + handleSwitchCommand(input); + continue; + } + + // 处理数字输入 + try { + int count = Integer.parseInt(input); + + if (count == -1) { + // 退出当前用户 + currentUser = null; + System.out.println("退出当前用户,重新登录..."); + break; + } + + // 验证题目数量 + if (!questionService.validateQuestionCount(count)) { + System.out.println("题目数量应在10-30之间"); + continue; + } + + // 生成并保存题目 + generateAndSaveQuestions(count); + + } catch (NumberFormatException e) { + System.out.println("请输入小学、初中和高中三个选项中的一个或有效的数字"); + } + } + } + + /** + * 处理类型切换命令 + * @param command 切换命令字符串 + */ + private void handleSwitchCommand(String command) { + String newType = validationService.extractTypeFromCommand(command); + if (newType.equals("小学") || newType.equals("初中") || newType.equals("高中")) { + currentType = newType; + System.out.println("准备生成" + currentType + "数学题目,请输入生成题目数量"); + } else { + System.out.println("请输入小学、初中和高中三个选项中的一个"); + } + } + + /** + * 生成并保存题目 + * @param count 题目数量 + */ + private void generateAndSaveQuestions(int count) { + try { + // 生成题目 + List questions = questionService.generateQuestions(currentType, count); + + // 查重检查 + if (fileService.checkDuplicate(currentUser.getUsername(), questions)) { + System.out.println("检测到重复题目,重新生成中..."); + generateAndSaveQuestions(count); // 递归重新生成 + return; + } + + // 保存到文件 + String filePath = fileService.saveQuestions(currentUser.getUsername(), questions); + System.out.println("题目已生成并保存到: " + filePath); + + } catch (Exception e) { + System.out.println("生成题目时出现错误: " + e.getMessage()); + e.printStackTrace(); // 调试用,实际应该记录日志 + } + } +} \ No newline at end of file diff --git a/src/main/java/service/FileService.java b/src/main/java/service/FileService.java new file mode 100644 index 0000000..ca71eee --- /dev/null +++ b/src/main/java/service/FileService.java @@ -0,0 +1,74 @@ +<<<<<<< HEAD +package service; + +import entity.Question; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +/** + 文件服务类 + 负责题目的文件存储和查重功能 + 每个用户有独立的文件夹存储生成的题目文件 + */ +public class FileService { + private static final String BASE_DIR = "doc"; // 基础存储目录 + + /** + 保存题目到文件 + @param username 用户名(用于创建用户文件夹) + @param questions 题目列表 + @return 保存的文件路径 + @throws IOException 文件操作异常 + */ + public String saveQuestions(String username, List questions) throws IOException { + // 创建用户专属文件夹 + File userDir = new File(BASE_DIR, username); + if (!userDir.exists()) { + userDir.mkdirs(); // 递归创建目录 + } + + // 生成基于时间戳的文件名 + String filename = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date()) + ".txt"; + File file = new File(userDir, filename); + + // 使用try-with-resources确保文件正确关闭 + try (FileWriter writer = new FileWriter(file)) { + for (Question question : questions) { + writer.write(question.toString()); // 写入题目 + writer.write("\n\n"); // 题目之间空一行 + } + } + + return file.getAbsolutePath(); + } + + /** + 检查题目是否重复(简化版实现) + 实际应该读取用户所有历史文件进行比较 + @param username 用户名 + @param newQuestions 新生成的题目 + @return 是否发现重复题目 + */ + public boolean checkDuplicate(String username, List newQuestions) { + File userDir = new File(BASE_DIR, username); + if (!userDir.exists()) { + return false; // 用户没有历史文件,肯定不重复 + } + + // 简化的查重实现 + // 实际应该:1.读取用户所有历史文件 2.解析历史题目 3.比较新题目与历史题目 + // 这里为了简化直接返回false,表示没有重复 + + // TODO: 实现完整的查重逻辑 + return false; + } +======= +package main.java.service; + +public class FileService { +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 +} diff --git a/src/main/java/service/QuestionService.java b/src/main/java/service/QuestionService.java new file mode 100644 index 0000000..ea1a74f --- /dev/null +++ b/src/main/java/service/QuestionService.java @@ -0,0 +1,59 @@ +<<<<<<< HEAD +package service; + +import entity.Question; +import factory.QuestionGenerator; +import factory.QuestionFactory; +import java.util.List; + +/** + 题目服务类 + 负责题目的生成和管理 + 协调题目生成器和验证服务的工作 + */ +public class QuestionService { + private final ValidationService validationService; + + /** + 构造函数 + @param validationService 验证服务实例 + */ + public QuestionService(ValidationService validationService) { + this.validationService = validationService; + } + + /** + 生成指定类型和数量的题目 + @param type 题目类型(小学/初中/高中) + @param count 题目数量 + @return 题目列表,包含正确题号的题目 + */ + public List generateQuestions(String type, int count) { + // 使用工厂创建对应的题目生成器 + QuestionGenerator generator = QuestionFactory.createGenerator(type); + // 生成题目 + List questions = generator.generateQuestions(count); + + // 为每个题目设置正确的题号 + for (int i = 0; i < questions.size(); i++) { + Question question = questions.get(i); + questions.set(i, new Question(i + 1, question.getContent())); + } + + return questions; + } + + /** + 验证题目数量是否有效 + @param count 题目数量 + @return 是否有效(10-30或-1) + */ + public boolean validateQuestionCount(int count) { + return validationService.isValidQuestionCount(count); + } +======= +package main.java.service; + +public class QuestionService { +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 +} diff --git a/src/main/java/service/UserService.java b/src/main/java/service/UserService.java new file mode 100644 index 0000000..8a600f6 --- /dev/null +++ b/src/main/java/service/UserService.java @@ -0,0 +1,64 @@ +<<<<<<< HEAD +package service; + +import entity.User; +import java.util.HashMap; +import java.util.Map; + +/** + 用户服务类 + 负责用户认证和用户数据管理 + 使用内存存储用户信息(实际项目中应该使用数据库) + */ +public class UserService { + private final Map users = new HashMap<>(); // 用户名到用户的映射 + + /** + 构造函数,初始化预定义的用户数据 + */ + public UserService() { + initializeUsers(); + } + + /** + 初始化预定义的用户账户 + 包括小学、初中、高中各三个账户 + */ + private void initializeUsers() { + // 小学账户 + users.put("张三1", new User("张三1", "123", "小学")); + users.put("张三2", new User("张三2", "123", "小学")); + users.put("张三3", new User("张三3", "123", "小学")); + + // 初中账户 + users.put("李四1", new User("李四1", "123", "初中")); + users.put("李四2", new User("李四2", "123", "初中")); + users.put("李四3", new User("李四3", "123", "初中")); + + // 高中账户 + users.put("王五1", new User("王五1", "123", "高中")); + users.put("王五2", new User("王五2", "123", "高中")); + users.put("王五3", new User("王五3", "123", "高中")); + } + + /** + 用户认证方法 + @param username 用户名 + @param password 密码 + @return 认证成功的用户对象,失败返回null + */ + public User authenticate(String username, String password) { + User user = users.get(username); + // 检查用户是否存在且密码匹配 + if (user != null && user.getPassword().equals(password)) { + return user; + } + return null; + } +} +======= +package main.java.service; + +public class UserService { +} +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 diff --git a/src/main/java/service/ValidationService.java b/src/main/java/service/ValidationService.java new file mode 100644 index 0000000..a7c0a81 --- /dev/null +++ b/src/main/java/service/ValidationService.java @@ -0,0 +1,42 @@ +<<<<<<< HEAD +package service; + +/** + 验证服务类 + 集中处理各种输入验证逻辑 + 保持验证规则的统一性 + */ +public class ValidationService { + + /** + 验证题目数量是否有效 + @param count 题目数量 + @return 有效返回true(10-30或-1) + */ + public boolean isValidQuestionCount(int count) { + return count == -1 || (count >= 10 && count <= 30); + } + + /** + 验证切换命令格式是否正确 + @param command 用户输入的命令 + @return 格式正确返回true + */ + public boolean isValidSwitchCommand(String command) { + return command.matches("切换为(小学|初中|高中)"); + } + + /** + 从切换命令中提取类型 + @param command 切换命令 + @return 提取的类型(小学/初中/高中) + */ + public String extractTypeFromCommand(String command) { + return command.replace("切换为", ""); + } +======= +package main.java.service; + +public class ValidationService { +>>>>>>> 93d8b771666e4fb2ee7477c19dcf6f4fb1eec045 +} diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..53851ab --- /dev/null +++ b/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: org.example.Main +