Facebook 谜题错误:抛出有关构建/运行错误的自动邮件
我解决了 Facebook 拼图页面 上给出的问题(Hoppity)。我用 c++ 语言(使用 g++ 编译器)解决了这个问题,并将 .cpp 文件作为附件邮寄到上述电子邮件地址。我没有压缩文件。几个小时后,我收到一封有关运行/构建错误的邮件。谁能帮我解决这个问题吗?我哪里错了?
这是我提交的代码:
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
long long i,n,k;
ifstream fin("a.in");
ofstream fout("output.in");
fin>>n;
k=n/15;
for(i=0;i<k;i++)
{
fout<<"Hoppity"<<"\n";
fout<<"Hophop"<<"\n";
fout<<"Hoppity"<<"\n";
fout<<"Hoppity"<<"\n";
fout<<"Hophop"<<"\n";
fout<<"Hoppity"<<"\n";
fout<<"Hop"<<"\n";
}
for(i=k*15+1;i<=n;i++)
{
if(i%5==0) fout<<"Hophop"<<"\n";
else if(i%3==0) fout<<"Hoppity"<<"\n";
}
return 0;
}
I solved the problem (Hoppity) as given on Facebook Puzzle Page. I solved it in c++ language (using g++ compiler) and mailed the .cpp file as an attachment to the mentioned e-mail address. I didn't zip the file. After few hours I received a mail regarding run/build error. Can anyone please help me with this. Where m I going wrong?
Here's the code I submitted:
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
long long i,n,k;
ifstream fin("a.in");
ofstream fout("output.in");
fin>>n;
k=n/15;
for(i=0;i<k;i++)
{
fout<<"Hoppity"<<"\n";
fout<<"Hophop"<<"\n";
fout<<"Hoppity"<<"\n";
fout<<"Hoppity"<<"\n";
fout<<"Hophop"<<"\n";
fout<<"Hoppity"<<"\n";
fout<<"Hop"<<"\n";
}
for(i=k*15+1;i<=n;i++)
{
if(i%5==0) fout<<"Hophop"<<"\n";
else if(i%3==0) fout<<"Hoppity"<<"\n";
}
return 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我印象深刻的是,您没有像 Hoppity 谜题所要求的那样从命令行获取输入文件的名称。相反,您从某个“a.in”文件中读取输入。
此外,您应该将结果写入 STDOUT,而不是某些“output.in”文件。
What strikes me is that you do not take the name of your input file from the command line like the Hoppity puzzle demands. Instead, you read input from some "a.in" file.
Furthermore, you're expected to write the results to STDOUT, not some "output.in" file.