Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
各位大神求解,为什么会RE!import java.math.BigDecimal; import java.util.Scanner; public class Main{ public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); while(true){ n = sc.nextInt(); if(n%2==0){ System.out.println((new BigDecimal(2).pow(n+1).add(new BigDecimal(1))).divide(new BigDecimal(3))); }else{ System.out.println((new BigDecimal(2).pow(n+1).subtract(new BigDecimal(1))).divide(new BigDecimal(3))); } } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator