大多数人在他们的代码中写下这个。
剂量是什么意思?
有什么用#ifndef。
#ifndef ONLINE_JUDGE
freopen("E://ADpan//in.in", "r", stdin);
freopen("E://ADpan//out.out", "w", stdout);
#endif
Run Code Online (Sandbox Code Playgroud)
粗略的谷歌搜索导致了这篇文章。总结一下:有一些在线编码竞赛,其中预定义的输入被发送到stdin并预计在 上stdout。在本地测试和开发时,有些人更喜欢破解他们的程序以从文件中读取,因此他们不必执行类似的操作
test_program < input | diff - expected_output
Run Code Online (Sandbox Code Playgroud)
最后,该ONLINE_JUDGE宏是在竞争环境中定义的,因此使用stdin/ stdout,而本地编译不会有该宏,因此会从这些文件中读取。