java 判断输入结束语句
如果依题目要求,输入一系列数(个数不定),然后倒序输出它们的平方根,如:输入:14916输出:4321这就要求像C语言EOF一样判断输入结束,然后将计算的平方根逆序输出,...
如果依题目要求,输入一系列数(个数不定),然后倒序输出它们的平方根,如:
输入:1 4 9 16
输出:4 3 2 1
这就要求像C语言EOF一样判断输入结束,然后将计算的平方根逆序输出,但这在Java中hasNextInt()之类的函数好像无法解决,头疼中,求解,谢谢!!
Input
The input stream contains a set of integer numbers Ai (0 ≤ Ai ≤ 1018). The numbers are separated by any number of spaces and line breaks. A size of the input stream does not exceed 256 KB.
Output
For each number Ai from the last one till the first one you should output its square root. Each square root should be printed in a separate line with at least four digits after decimal point.
input
1427 0
876652098643267843
5276538
output
2297.0716
936297014.1164
0.0000
37.7757
这是题目要求,至于特殊字符,那是题目中不允许的,我的程序调试可知栈里的元素符合要求,但由于不知道什么时候输入结束,故无法输出 展开
输入:1 4 9 16
输出:4 3 2 1
这就要求像C语言EOF一样判断输入结束,然后将计算的平方根逆序输出,但这在Java中hasNextInt()之类的函数好像无法解决,头疼中,求解,谢谢!!
Input
The input stream contains a set of integer numbers Ai (0 ≤ Ai ≤ 1018). The numbers are separated by any number of spaces and line breaks. A size of the input stream does not exceed 256 KB.
Output
For each number Ai from the last one till the first one you should output its square root. Each square root should be printed in a separate line with at least four digits after decimal point.
input
1427 0
876652098643267843
5276538
output
2297.0716
936297014.1164
0.0000
37.7757
这是题目要求,至于特殊字符,那是题目中不允许的,我的程序调试可知栈里的元素符合要求,但由于不知道什么时候输入结束,故无法输出 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询