题解 | #百万富翁问题#写个for循环就行
百万富翁问题
https://www.nowcoder.com/practice/9fe25b6cf93e46dcb09ba67aeef2c4cc
public class Main { public static void main(String[] args) { int wealthy = 0, stranger = 0; for (int i = 0; i < 30; i++) { wealthy += 10; stranger += (int) Math.pow(2, i); } System.out.println(wealthy + " " + stranger); } }