roman-numerals/solution.go: 4 prints IIII and 1994 prints MDCCCCLXXXXIIII (no subtractive forms)
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 6
- Merge trung bình
- 21 giờ 9 phút
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của techcsispit/code-corner
-
prime/solution.java doesn't compile: public class PrimeCheck in solution.java, README requires Solution.java with a Solution classCó thể đã có người làm @tanujb03 đã nhận 3 ngày trước. Đang mởbug good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
techcsispit/code-corner#35 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Failed compilations always report 0.000 secondsCó thể đã có người làm @Nik-2208 đã nhận 1 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
techcsispit/code-corner#37 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
binary-search/Solution.java: prints -1 when the target is the last element (`9 1 3 5 7 9`) or in a 1-element list (`5 5`)Có thể đã có người làm @tanujb03 đã nhận 4 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
techcsispit/code-corner#26 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add test cases to a problemCó thể đã có người làm @25crns đã nhận 10 ngày trước. Đang mởgood first issue tests
techcsispit/code-corner#2 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Solve a problem in a language it doesn't have yetCó thể đã có người làm @praseedbhat đã nhận 4 ngày trước. Đang mởfeature good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 52/100
techcsispit/code-corner#1 · 6 bình luận · 4 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của techcsispit/code-corner
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Deltares/imod-python#1940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort: low prio: low ready
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
digitalfabrik/integreat-cms#4621 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ioos/compliance-checker#1375 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
netbox status: backlog topic: testing type: housekeeping
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
netbox-community/netbox#23395 ·
Maintainer thường phản hồi trong vòng 1 ngày