Skip to content

Instantly share code, notes, and snippets.

# -*- 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('첫 번째 교통수단 (코드)를 입력해주세요!')
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();
@dalcon10028
dalcon10028 / 4주차 스택과 재귀.c
Last active July 20, 2020 04:35
4주차 스택과 재귀
/*
------------------------------
| 스택 |
------------------------------
*/
#include <stdio.h>
#include <string.h>
// 사용할 함수들을 선언합니다.
void push(int n), menu();
@dalcon10028
dalcon10028 / 4주차.java
Created July 14, 2020 01:15
4주차 소스코드
// 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) + " ");
}
@dalcon10028
dalcon10028 / 3주차.c
Created July 8, 2020 00:50
3주차 소스코드
// 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;
}
@dalcon10028
dalcon10028 / 나누어 떨어지는 숫자 배열.java
Created July 7, 2020 14:31
프로그래머스 코딩테스트 연습 Level1 - 나누어 떨어지는 숫자 배열 [ Java ]
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();
@dalcon10028
dalcon10028 / 같은 숫자는 싫어.java
Created July 7, 2020 11:29
프로그래머스 코딩테스트 연습 Level1 - 같은 숫자는 싫어 [ Java ]
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);
}
@dalcon10028
dalcon10028 / 가운데 글자 가져오기.java
Created July 7, 2020 10:50
프로그래머스 코딩테스트 연습 Level1 - 가운데 글자 가져오기 [ Java ]
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);
}
}
@dalcon10028
dalcon10028 / 크레인 인형뽑기 게임.java
Created July 7, 2020 10:23
프로그래머스 코딩테스트 연습 Level1 - 크레인 인형뽑기 게임 [ Java ]
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;
@dalcon10028
dalcon10028 / 2016년.java
Created July 7, 2020 09:12
프로그래머스 코딩테스트 연습 Level1 - 2016년 [ Java ]
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];
}
}