标签:style blog http color io java ar for div
最近学java,会陆续找点水题练手。
1 import java.util.*; 2 import java.awt.*; 3 import java.math.*; 4 5 public class Main { 6 7 public static void main(String args[]) { 8 Scanner cin=new Scanner(System.in); 9 int n, i; 10 int f[] = new int[35]; 11 f[0] = 0; 12 f[1] = 1; 13 f[2] = 2; 14 f[3] = 3; 15 for(i = 4; i < 31; i ++) 16 f[i] = f[i-1] + f[i-2] + f[i-3]; 17 while(cin.hasNext()) //多组 18 { 19 n = cin.nextInt(); 20 System.out.println(f[n]); 21 } 22 } 23 }
标签:style blog http color io java ar for div
原文地址:http://www.cnblogs.com/bfshm/p/3954679.html