关于等差数列和的问题 大哥 教教小弟我吧 1+2+3+4......+n <8888求最大的正整数N用JAVA来编.我真整不会了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public int maxN() { int i = 1; int result = 0; while(true) { result += i; if (result < 8888) { i++; continue; } else { break; } } return i;}代码没有调试,随手写的。应该能满足你的功能需要了。 (n^2+n)/2<8888 不等式求解不可以吗 return Math.floor((Math.floor(Math.sqrt(1 + 8 * 8888)) - 1) / 2);看不明白的,复习一下初一数学,哈哈。 java 接听电脑网卡 usb接口 cookie和session 如何用java定义动态二维数组 讨论(热切欢迎你的参与):如何从Excel中读取图片? 如何在Java程序中调用windows本身的程序? FTP的问题,救命! 请问在一个类内部定义的类和原来的类是什么关系? java socket编程,希望高手帮忙,马上结贴! printIn 这是我最近遇到一个奇怪的问题,高手help!!!!! 谁知道用Java怎么实现Yahoo Finance里边的那种效果?? 数组
public int maxN() {
int i = 1;
int result = 0;
while(true) {
result += i;
if (result < 8888) {
i++;
continue;
} else {
break;
}
}
return i;
}
代码没有调试,随手写的。应该能满足你的功能需要了。
return Math.floor((Math.floor(Math.sqrt(1 + 8 * 8888)) - 1) / 2);看不明白的,复习一下初一数学,哈哈。