This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# 문제 1 | |
traffic_code = [0, 9, 5] | |
def is_traffic_code(input_value): | |
return 0 <= input_value and input_value <= 2 | |
while True: | |
first = input('첫 번째 교통수단 (코드)를 입력해주세요!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.io.*; | |
import java.util.*; | |
public class Main { | |
static int[][] memo = new int[41][2]; | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
StringBuilder sb = new StringBuilder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
------------------------------ | |
| 스택 | | |
------------------------------ | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
// 사용할 함수들을 선언합니다. | |
void push(int n), menu(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 10809번 알바펫 찾기 | |
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
String str = sc.next(); | |
for (char i = 'a'; i<='z' ; i++) | |
System.out.print(str.indexOf(i) + " "); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2741번 N 찍기 | |
#include <stdio.h> | |
int main() { | |
int a,i ; | |
scanf("%d",&a); | |
for(i=1; i<=a; i++) | |
printf("%d\n",i); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Solution { | |
public int[] solution(int[] arr, int divisor) { | |
LinkedList<Integer> list = new LinkedList<>(); | |
Arrays.sort(arr); | |
for (int i : arr) | |
if(i%divisor==0) | |
list.add(i); | |
if(list.isEmpty()) list.add(-1); | |
return list.stream().mapToInt(i->i).toArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedList; | |
public class Solution { | |
public static void main(String[] args) { | |
int[] arr = new int[]{1, 1, 3, 3, 0, 1, 1}; | |
int[] r = solution(arr); | |
for (int i : r) | |
System.out.println(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public String solution(String s) { | |
int half = s.length()/2; | |
return s.length()%2==0 ? s.substring(half-1, half+1) : s.substring(half,half+1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
public class Solution { | |
public static void main(String[] args) { | |
int[][] board = new int[][]{{0,0,0,0,0},{0,0,1,0,3},{0,2,5,0,1},{4,2,4,4,2},{3,5,1,3,1}}; | |
int[] moves = new int[]{1,5,3,5,1,2,1,4}; | |
System.out.println(solution(board, moves)); | |
} | |
static int solution(int[][] board, int[] moves) { | |
int score = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public String solution(int a, int b) { | |
String[] week = new String[] {"THU","FRI","SAT","SUN","MON","TUE","WED"}; | |
int[] month = new int[] {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
int cal = 0; | |
for(int i=0; i<a-1; i++) | |
cal+=month[i]; | |
return week[(cal+b)%7]; | |
} | |
} |
NewerOlder