Google Code Jam 的源代码样式
我计划明年参加 Code Jam 比赛。问题是(我在任何地方都找不到的东西)如何设置我的代码来接受输入并返回输出?
我只是对如何处理所有事情感到困惑,例如,我必须将 1 添加到输入并将结果作为输出,我将如何处理输入/输出?
我打算使用LUA。如果可以的话谢谢。我认为代码示例是最好的!
I plan on doing the Code Jam competition next year. The problem is (something that I can't find anywhere) how do I set up my code to accept input and return an output?
I'm just confused as to how I am supposed to handle everything, say for example that I have to add 1 to the input and make the result the output, how would I handle the input/output?
I plan on using LUA. Thanks if you can. I think a code example would be best!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在Python中,你可以
这样写然后从shell中调用脚本
将输出保存到文件中
In Python say, you could write
Then call the script from the shell like this
To save the output to a file
转至 http://www.go-hero.net/jam/11/solutions 并选择问题和语言。您将在那里找到所需的所有示例。包括Lua的。
Go to http://www.go-hero.net/jam/11/solutions and choose the problem and the language. You'll find all the examples you need there. Including Lua ones.
http://www.go-hero.net/jam/
在此页面上您可以看到每位参赛者的源代码。
您应该能够从中回答您的问题。
http://www.go-hero.net/jam/
On this page you can see source code for every contestant.
You should be able to answer your question from it.
您可以对文件或标准输入/标准输出执行 I/O。没关系。我见过使用文件的示例和使用 stdin/stdout 的示例。
You can either do I/O on files or on stdin/stdout. It doesn't matter. I've seen examples that used files and examples that used stdin/stdout.