Notice
Recent Posts
Recent Comments
ยซ   2025/04   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
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
Tags more
Archives
Today
Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

๐ŸŒฒ์ž๋ผ๋‚˜๋Š”์ฒญ๋…„

[๋ฐฑ์ค€] Q11057 ์˜ค๋ฅด๋ง‰ ์ˆ˜ ๋ณธ๋ฌธ

์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ

[๋ฐฑ์ค€] Q11057 ์˜ค๋ฅด๋ง‰ ์ˆ˜

JihyunLee 2019. 9. 23. 23:15
๋ฐ˜์‘ํ˜•

๋‹ค์ด๋‚˜๋ฏน ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฌธ์ œ์˜€๋‹ค. ์ฒ˜์Œ์— ํ‹€๋ ธ์—ˆ๋Š”๋ฐ, ๋งˆ์ง€๋ง‰ modula ๊ณ„์‚ฐ์„ ๋นผ๋จน์–ด์„œ ํ‹€๋ ธ์—ˆ๋‹ค.

 

์ฝ”๋“œ : 

 

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
import java.util.*;
public class Q11057{
    public static int[][] d;
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        d = new int[N+1][10];
        
        for(int i=1; i<N+1; i++){
            if(i==1){
                for(int j=0; j<10; j++){
                    d[i][j]=1;
                }
            }else if(i==2){
                for(int j=0; j<10; j++){
                    d[i][j]=j+1;
                }
            }else{
                for(int j=0; j<10; j++){
                    for(int k=0; k<=j; k++){
                        d[i][j] += d[i-1][k]; 
                    }
                    d[i][j] = d[i][j]%10007;
                }
            }    
           
        }
        int sum =0;
 
        for(int i=0; i<10; i++){
            sum += d[N][i];
        }
        System.out.println(sum%10007);
    }
}
cs
๋ฐ˜์‘ํ˜•