File tree Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,12 @@ function solution(s) {
88 if ( countP !== countY ) answer = false
99
1010 return answer ;
11- }
11+ }
12+
13+ //정답 2 - yongchanson
14+ function solution ( s ) {
15+ p = s . toLowerCase ( ) . split ( "p" ) . length ;
16+ y = s . toLowerCase ( ) . split ( "y" ) . length ;
17+
18+ return p == y ? true : false ;
19+ }
Original file line number Diff line number Diff line change @@ -6,4 +6,16 @@ function solution(s) {
66 const length = s . length
77 if ( s . search ( / \D / g) < 0 && ( length === 4 || length === 6 ) ) answer = true
88 return answer ;
9- }
9+ }
10+
11+ //정답 2 - yongchanson
12+ function solution ( s ) {
13+ let parseInts = parseInt ( s ) ;
14+ if ( s . length == 6 || s . length == 4 ) {
15+ if ( s == parseInts ) {
16+ return true ;
17+ }
18+ }
19+
20+ return false ;
21+ }
Original file line number Diff line number Diff line change @@ -5,4 +5,23 @@ function solution(n) {
55 var answer = 0 ;
66 for ( let divisor = 1 ; divisor <= n ; divisor ++ ) if ( n % divisor === 0 ) answer += divisor
77 return answer ;
8- }
8+ }
9+
10+ //정답 2 - yongchanson
11+ function solution ( n ) {
12+ var answer = 0 ;
13+ let i ;
14+ for ( i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) {
15+ if ( n % i == 0 ) {
16+ if ( i * i == n ) {
17+ //i의 제곱이 n인경우 처리
18+ answer += i ;
19+ } else {
20+ answer += i ;
21+ answer += n / i ;
22+ }
23+ }
24+ }
25+
26+ return answer ;
27+ }
You can’t perform that action at this time.
0 commit comments