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

1010代码提交,部分正确 #5

Closed
mexbo opened this issue Feb 24, 2018 · 4 comments
Closed

1010代码提交,部分正确 #5

mexbo opened this issue Feb 24, 2018 · 4 comments
Labels

Comments

@mexbo
Copy link

mexbo commented Feb 24, 2018

1010题有点小问题,提交只是部分正确

@mexbo
Copy link
Author

mexbo commented Feb 24, 2018

感觉逻辑不对,假如说只有输入 5 0 ,你的代码是没有输出的,while循环一直在等待输入,没有中断,但题目要求的是输出“0 0”

@xlucn
Copy link
Owner

xlucn commented Feb 24, 2018

@mexbo 经验证,确实通过不了了。但是当时应该是通过的啊,我每次push都会检查的

不过,我代码里用的是

while(scanf("%d %d", &coef, &index) != EOF) 

来判断输入结束,就是说不能判断回车,只能通过输入流/文件的结束来判断。测试的时候可以使用输入文件,或者使用Ctrl+D来结束输入。如果这个地方出问题的话我怀疑是PAT的测试设置有变化

@mexbo
Copy link
Author

mexbo commented Feb 24, 2018

可能吧

@xlucn xlucn closed this as completed in ad6e5a4 Feb 24, 2018
@xlucn
Copy link
Owner

xlucn commented Feb 24, 2018

找到问题了,之前这样的输出方法

printf("%c%d %d", count++ ? ' ' : '\0', coef * index, index - 1);

是可以通过的,但是现在可能这个\0的输出会造成问题。

具体原因我还不明白,输出的内容看起来是不会影响的,以后恐怕不能这么写了

@xlucn xlucn added the bug label Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants