roman-numerals/solution.go: 4 prints IIII and 1994 prints MDCCCCLXXXXIIII (no subtractive forms)
维护者通常 1 天内回复
评估
调研方向
The bug is in problems/roman-numerals/solution.go, which emits additive forms like IIII and VIIII; problems/roman-numerals/solution.py already gives MCMXCIV for 1994 and is a reference. Add the subtractive inputs (3, 8, 2026, 1500, 3888) to cases.txt and run python3 run.py roman-numerals. Done means the Go output matches the README examples. Two open pull requests (#28, #34) already target this, so check them before starting.
由索引模型根据 Issue 内容生成。
描述
What I did
- Fresh checkout of
main, Go installed. - Run the Go solution on the README's own examples:
echo 4 | go run problems/roman-numerals/solution.go
echo 9 | go run problems/roman-numerals/solution.go
echo 40 | go run problems/roman-numerals/solution.go
echo 1994 | go run problems/roman-numerals/solution.go
echo 3999 | go run problems/roman-numerals/solution.go
- For comparison, the Python solution on the same inputs:
echo 1994 | python3 problems/roman-numerals/solution.py
What I expected
The problem README says: "Use the subtractive forms: 4 is IV, 9 is IX, 40 is XL, 90 is XC, 400 is CD and 900 is CM. So 1994 is MCMXCIV." (problems/roman-numerals/README.md)
So IV, IX, XL, MCMXCIV and MMMCMXCIX.
What happened instead
4 -> IIII
9 -> VIIII
40 -> XXXX
1994 -> MDCCCCLXXXXIIII
3999 -> MMMDCCCCLXXXXVIIII
The Python solution prints MCMXCIV for 1994. The Go solution is wrong for 1952 of the numbers from 1 to 3999. python3 run.py roman-numerals passes today only because cases.txt does not include any input that needs a subtractive form (3, 8, 2026, 1500, 3888).
Environment
code-corner main @ 81bb5dc, Go 1.27, Windows 11.
I'd like to work on the fix for this, and add the failing inputs to cases.txt as the Contributing section asks.
- 主要语言
- Python
- 星标
- 1
- 派生
- 6
- 平均合并
- 17 小时 52 分钟
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
techcsispit/code-corner 的其他 Issue
-
prime/solution.java doesn't compile: public class PrimeCheck in solution.java, README requires Solution.java with a Solution class可能已有人在做 @tanujb03 于 1 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
techcsispit/code-corner#35 ·
维护者通常 1 天内回复
-
Prime solution in C++ incorrectly returns true for some composite numbers可能已有人在做 @paramsj 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 25/100
techcsispit/code-corner#38 ·
维护者通常 1 天内回复
-
Failed compilations always report 0.000 seconds可能已有人在做 @Shivangi-singh18 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
techcsispit/code-corner#37 · 1 条评论 ·
维护者通常 1 天内回复
-
run.py: Python solutions are skipped on Windows when run via python instead of python3可能已有人在做 @tanujb03 于 1 天前认领。 未关闭bug good first issue
难度 1/5 1 小时以内 新手友好度 15/100
techcsispit/code-corner#29 ·
维护者通常 1 天内回复
-
fibonacci/solution.c: prints negative numbers for n of 47 or more (F(90) prints -1581614984)可能已有人在做 @tanujb03 于 1 天前认领。 未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 25/100
techcsispit/code-corner#27 ·
维护者通常 1 天内回复
查看 techcsispit/code-corner 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
vllm-project/vllm#61131 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
kubernetes-client/python#2735 ·
维护者通常 1 天内回复
-
desktop help wanted test
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
docs pydanty:is-working
难度 2/5 1-3 小时 新手友好度 68/100
pydantic/pydantic-ai#10113 ·
维护者通常 1 天内回复
-
Tutorial unit test leaks sample data into tutorial doctest可能已有人在做 @Gambit-Checkmate 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100