Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO 类输出时的行末空行问题 #152

Open
weilycoder opened this issue Nov 27, 2024 · 0 comments
Open

IO 类输出时的行末空行问题 #152

weilycoder opened this issue Nov 27, 2024 · 0 comments

Comments

@weilycoder
Copy link
Contributor

这应该是一个比较无语的问题,众所周知,根据操作系统的不同,换行符可能是 '\r''\n''\r\n';大部分评测系统是 Linux 系统('\n'),而大部分出题人的电脑是 Windows 系统('\r\n')。

正常来说,在同一系统下,使用非二进制模式读取文件得到的换行符均被自动处理为一个字符,但跨系统数据生成时情况有所不同。

这导致了臭名昭著的换行符问题,即,选手可能被迫在手动处理换行符时进行特判;而数据的换行符可能是三者中的任何一种甚至混用。

由于项目的 IO 类并未使用二进制模式输入输出,其生成文件的换行符依赖系统环境。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant