Skip to content

Instantly share code, notes, and snippets.

import Multiplexer::*;
interface BarrelShifterRight;
method ActionValue#(Bit#(64)) rightShift(Bit#(64) val, Bit#(6) shiftAmt, Bit#(1) shiftValue);
endinterface
module mkBarrelShifterRight(BarrelShifterRight);
function Bit #(w) barrel_shift_right(Int #(k) n, Bit #(w) arg, Bit#(1) shiftValue);
Bit #(w) ans = 0;
for(Integer j = 0; j < (valueOf(w) - n); j = j + 1)
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stack>
#include <cstring>
#define SIZE 3001
#define MAX 5001
#define pii pair<int, int>
#define f first
#define s second
//
// C++ 2178.cpp
// C - Algorithms
//
// Created by yunsu Jung on 2018. 2. 25..
// Copyright © 2018년 yunsu Jung. All rights reserved.
//
#include <iostream>
#include <string>
/*
Mac console game : Sokoban by C language.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <curses.h>
from random import randint
numbers = []
strike = 0
count = 0
# 세개 뽑을때까지 반복
while len(numbers) < 3:
new_number = randint(0, 9)
# 새로운 수 나올때까지 다시 뽑기
def guess(guesses, n):
while(True):
guess2 = int(input("{}번째 수를 입력하세요".format(n)))
if guess2 not in range(10):
print("범위를 벗어나는 수입니다 다시 입력해주세요")
elif guess2 in guesses:
print("중복되는 수입니다. 다시 입력해주세요")
else:
guesses.append(guess2)
break
value = [5,4,3,2,1]
1. bulit in functiond을 사용해 value의 값을 모두 없애시오.
2. a = value, value[1] = 10일 때 a[1]값과
a = value.copy() value[1] = 10일 때 a[1]의 값은 같을까?
3. c = [3, -4, 5, -6, 7] 일 때 sort메소드를 사용하여 제곱값이 큰 작은 순서대로 정렬하시오.
4. a = {1,2,3,4,5}, b = {2,3,4,5,6}라고 주어졌다.
4-1 a.difference(b)의 값 {1,6}이다. True or False
4-2 a - b 와 a.difference_update(b)의 값은 같다. True or False
4-3 a.discard(6) 오류가 난다. True or False
4-4 a와 b의 공통 요소만 뽑아 새로운 list를 만들어 보시오.
@yunsu3042
yunsu3042 / # opencv3 - 2017-03-03_01-14-37.txt
Created March 3, 2017 08:20
opencv3 (homebrew/science/opencv3) on macOS 10.11.6 - Homebrew build logs
Homebrew build logs for homebrew/science/opencv3 on macOS 10.11.6
Build date: 2017-03-03 01:14:37
# 이미지 내의 한줄로 구성된 문자들이 있을 경우 문자들을 구분해주는 흰 여백의 x좌표를 list로 반환한다.
def x_cordinate(url):
arr = image_into_array(url,(1000,1000))
img = Image.open(url)
xcrop = [0]
satisfied = 0
width,height = img.size
for y in range(width):
for x in range(height):
if arr[x][y] == 1:
#배열을 다시 이미지화 하는 과정
import numpy as np
def numpy_array_to_image(numpy_array)
img = Image.fromarray(numpy_array)
return img