题解 | #数列求和#
数列求和
http://www.nowcoder.com/practice/6893484c04c24bfca1f606b1823a468d
public class Main { public static void main(String[] args) {
//write your code here........
long sum = 0L;
long temp = 0L;
for(int i = 1;i <= 10;i++){
//先求数列
temp = temp * 10 + 9;
//后求和
sum = sum + temp;
}
System.out.print(sum);
}
}