일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 피보나치 수
- Counting cells in a blob
- codesingal
- 10953
- til
- 수 정렬하기
- Sequential Search
- collections.deque
- cpp
- data_structure
- 파이썬머신러닝완벽가이드
- matrixElementsSum
- adjacentElementsProduct
- Python
- baekjun
- Numpy
- All Longest Strings
- markdown
- centuryFromYear
- flask
- recursion
- 백준
- C++
- 2750
- 파이썬 포렌식
- Daily Commit
- almostIncreasingSequence
- 2015 봄학기 알고리즘
- shapeArea
- codesignal
- Today
- Total
목록Programming_prob 59
Introfor
Recursive에 약해서 다시 공부한다는 생각으로 풀었다. 그런데 팩토리얼은 쉬었지만, 문제에서 0의 팩토리얼이 1이라는 사실을 간과하고 있었다. // 0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오. #include int factorial(int n){ if(n == 0) return 1; else return n * factorial(n-1); } int main(){ int N = 0; scanf("%d", &N); printf("%d", factorial(N)); }
sort 알고리즘을 공부하면서 알게된 내용을 활용해서 풀었다. [2750, 2751번] 수 정렬하기1, 2 #include #include #include using namespace std; int main(){ int n = 0; ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; vector v(n); for (int i=0; i> v[i].first; v[i].second = i; } sort(v.begin(), v.end()); for (int i = 0; i tmp; arr[tmp]++; } for(int i = 1 ; i
123456789101112#-*- coding: utf-8 -*- __author__="Introfor" import urllib, re num =12345 while(True): response = urllib.urlopen("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=%s" % num).read() num = "".join(re.findall(r"\d", response)) print responseColored by Color Scriptercs
12345678910111213# -*- coding: utf-8 -*- __author__='Introfor' import re, urllib2 url = "http://www.pythonchallenge.com/pc/def/equality.html"response = urllib2.urlopen(url).read()strings = response[response.rindex('')] result = "".join(re.findall(r"[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]",strings)) print resultColored by Color Scriptercs
123456789101112131415 import urllib2 url = "http://www.pythonchallenge.com/pc/def/ocr.html" # url 값 str로 저장response = urllib2.urlopen(url).read() # urlopen으로 url을 열고 read로 값을 읽은 후 response에 저장string = response[response.rindex('')] # 뒤에서 부터 이 위치한 인덱스의 값을 통해 슬라이싱 # 한 후에 string에 저장 result='' for i in string: #isalpha()는 알파벳이면 true를 반환하는데 string에 알파벳이 있으면 result에 문자를 추가 if i.isalpha(): result +=i pr..
1234567891011121314151617181920212223242526272829303132__author__='Introfor' import string"""The first methoddef decoding(str): global result result ='' for i in str: if(ord(i)==32 or ord(i)==39 or ord(i)==46 or ord(i)==40 or ord(i)==41): result +=i elif(ord(i)==121): result+='a' elif (ord(i) == 122): result += 'b' else: result+=chr(ord(i)+2) return resultstr1="g fmnc wms bgblr rpylqjyrc gr zw f..