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 <iostream> | |
#include <vector> | |
using namespace std; | |
int T; // 테스트 횟수 | |
int L; // 막대 사이즈 | |
int N; // 개미수 | |
vector<int> positions; // 입력값들이 저장됨 | |
vector<int> earlies; // 최소시간들이 저장됨 |
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 <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
int N; // 로프 개수 | |
vector<int> rope; // 로프 한계 무게가 저장됨 | |
bool compare_rope(int r1, int r2){ | |
if(r1 > r2) return true; |
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 <iostream> | |
using namespace std; | |
class Parent{ | |
public: | |
virtual void print(){ | |
cout<<"PARENT PRINT"<<endl; | |
} | |
void display(){ | |
cout<<"PARENT DISPLAY"<<endl; |
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
int main(){ | |
volatile int impenetrable_variable=10; | |
for(int i=1; i<=3; i++){ | |
// Every time the value is changed, it really changes the value in the main memory. | |
impenetrable_variable += 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
class iPhone: | |
iphone_list = ["3g", "3gs", "4", "4S", "5", "5s"] | |
def __init__(self, model): | |
self.model = model | |
@classmethod | |
def from_year(cls, year): | |
return cls(iPhone.iphone_list[int(year) - 2008]) |
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
def parent_index(i): | |
return (i-1)//2 | |
def lchild_index(i): | |
return i*2+1 | |
def rchild_index(i): | |
return i*2+2 | |
# max_min==1 means a max-heap. -1 means a min-heap. | |
# right means the rightmost index (not the length) | |
def recursive_heapify(list, i, right, max_min=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
def partition(list, l, r): | |
pivot = list[r] | |
i=l | |
j=r-1 | |
while True: | |
while i<r and list[i]<=pivot: | |
i+=1 | |
while j>l and list[j]>pivot: | |
j-=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
""" | |
Other request methods to use in the Resource object: | |
- request.get_json() | |
- request.path | |
- request.base_url | |
- request.get_data() | |
- request.query_string | |
- request.args -> Kind of dict | |
""" |
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
-- Worked on MySQL 5.7 | |
CREATE DATABASE IF NOT EXISTS rest; | |
CREATE TABLE IF NOT EXISTS rest.Users( | |
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, | |
username VARCHAR(128) NOT NULL, | |
email VARCHAR(128) NOT NULL, | |
joined_datetime DATETIME DEFAULT NOW() | |
); | |
CREATE TABLE IF NOT EXISTS rest.Makers( |
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 pandas as pd | |
import pymysql | |
from flask import Flask, request | |
from flask_restful import Api, Resource | |
host = 'your_mysql_ip' | |
user = 'your_username' | |
password = 'your_password' | |
database = 'rest' |
OlderNewer