daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.BufferedReader;
  2. import java.io.BufferedWriter;
  3. import java.io.IOException;
  4. import java.io.InputStreamReader;
  5. import java.io.OutputStreamWriter;
  6.  
  7. public class Main{
  8.     public static void main(String args[]) throws IOException{
  9.         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  10.         BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
  11.        
  12.         int num = Integer.parseInt(br.readLine());
  13.        
  14.         int[][] arr = new int[1001][11];
  15.        
  16.         for(int i=0;i<10;i++){
  17.             arr[1][i] = 1;
  18.         }
  19.         for(int i=0;i<=num;i++){
  20.             arr[i][0] = 1;
  21.         }
  22.        
  23.         for(int i=2;i<=num;i++){
  24.             for(int j=1;j<10;j++){
  25.                 arr[i][j] = arr[i][j-1]+arr[i-1][j];
  26.                 arr[i][j] = arr[i][j]%10007;
  27.             }
  28.         }
  29.        
  30.         int res = 0;
  31.         for(int i=0;i<10;i++){
  32.             res = res+arr[num][i];
  33.             res = res%10007;
  34.         }
  35.        
  36.         bw.write(res+"");
  37.         bw.flush();
  38.         bw.close();
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top