1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int K = sc.nextInt(); long[] zeroCntArray = new long[K+1]; long[] oneCntArray = new long[K+1]; int i = 0; zeroCntArray[i] = 0; oneCntArray[i++] = 0; zeroCntArray[i] = 0; oneCntArray[i++] = 1; if(K >= 2){ zeroCntArray[i] = 1; oneCntArray[i++] = 1; for(; i<K+1; i++){ zeroCntArray[i] = zeroCntArray[i-1] + zeroCntArray[i-2]; oneCntArray[i] = oneCntArray[i-1] + oneCntArray[i-2]; } } System.out.println(zeroCntArray[K]+" "+oneCntArray[K]); } } |
Labels
Programming
(16)
Algorithm
(15)
Java
(15)
ASP .NET
(4)
Enterprise Architecture
(4)
PHP and MySQL
(4)
Software Engineering
(2)
C#
(1)
Data Mining
(1)
Deep Learning
(1)
Java Script
(1)
Python
(1)
Sunday, October 18, 2015
수학귀신
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment