uva673 Parentheses Balance
2016-03-03 15:47
225 查看
括号匹配。
就注意一点,cin原来是不读回车的.
getline()可以将缓冲区的回车带走。
就注意一点,cin原来是不读回车的.
getline()可以将缓冲区的回车带走。
import java.util.*; import java.io.*; import java.math.*; public class poj_1205 { public static void main(String[] args){ BigInteger f[]=new BigInteger[110]; f[1]=BigInteger.valueOf(1); f[2]=BigInteger.valueOf(3); for(int i=3;i<=100;i++){ f[i]=(f[i-1].multiply(BigInteger.valueOf(3))).subtract(f[i-2]); } Scanner cin=new Scanner(System.in); while(cin.hasNext()){ int n=cin.nextInt(); System.out.println(f ); } } }
相关文章推荐
- 1.10055 - Hashmat the brave warrior
- 2.10071 - Back to High School Physics
- 3.458 - The Decoder
- 4.694 - The Collatz Sequence
- 6.494 - Kindergarten Counting Game
- 7.490 - Rotating Sentences
- 8.414 - Machined Surfaces
- 9.488 - Triangle Wave
- A.457 - Linear Cellular Automata
- B.489 - Hangman Judge
- C.445 - Marvelous Mazes
- 1.10494 - If We Were a Child Again
- 2.424 - Integer Inquiry
- 3.10250 - The Other Two Trees
- 5.465 - Overflow
- 6.113 - Power of Cryptography
- 7.10161 - Ant on a Chessboard
- 8.621 - Secret Research
- 9.401 - Palindromes
- A.537 - Artificial Intelligence?