File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 44
55### 성능 요약
66
7- 메모리: 73 MB, 시간: 3.74 ms
7+ 메모리: 91.8 MB, 시간: 1.77 ms
88
99### 구분
1010
1616
1717### 제출 일자
1818
19- 2025년 07월 25일 18: 19:03
19+ 2025년 09월 11일 19:06:30
2020
2121### 문제 설명
2222
Original file line number Diff line number Diff line change 11class Solution {
2- public int solution (int n ) {
3- int answer = 0 ;
4- long [] pib = new long [ n + 1 ] ;
5- pib [ 0 ]= 0L ;
6- pib [ 1 ]= 1L ;
7- int times = 1 ;
8- for ( int i = 2 ; i <= n ; i ++){
9- pib [ i ]=( pib [ i - 1 ]+ pib [ i - 2 ])% 1234567L ;
2+ public int solution (int n ) {
3+ int answer = 1 ;
4+ int f1 = 0 , f2 = 1 ;
5+
6+ for ( int i = 2 ; i <= n ; i ++){
7+ answer = ( f1 + f2 )% 1234567 ;
8+ f1 = f2 ;
9+ f2 = answer ;
1010 }
11- //answer=(int)(pib[n]%1234567L);
12- answer =( int )( pib [ n ]) ;
11+
12+ //if(n>=2) answer %= 1234567 ;
1313 return answer ;
1414 }
1515}
You can’t perform that action at this time.
0 commit comments