Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Autoencoder
- 냥코 센세
- 전처리
- Gram matrix
- deep learning
- 딥러닝
- 자전거 여행
- neural network
- 역전파법
- SQL
- project euler
- 신경망
- c#
- 오토인코더
- Convolutional Neural Network
- 수달
- 오일러 프로젝트
- CNN
- backpropagation
- 베이지안
- 합성곱 신경망
- Python
- 소수
- 비샤몬당
- bayesian
- 소인수분해
- 히토요시
- A Neural Algorithm of Artistic Style
- mnist
- 역전파
Archives
- Today
- Total
통계, IT, AI
42. Coded triangle numbers 본문
1. 개요
문제는 이곳에서 확인할 수 있다.
2. 구현
어떤 수가
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # -*- coding: utf-8 -*- import string import math as m alpabet_order = {s: idx + 1 for idx, s in enumerate (string.ascii_uppercase)} count = 0 with open ( 'p042_words.txt' , 'r' ) as f: for s in f.readlines()[ 0 ].replace( '"' , ' ').split(' ,'): triangle_num = sum (alpabet_order[alpabet] for alpabet in s) temp_k = int (m.sqrt( 8 * triangle_num + 1 )) if any ( a * * 2 = = 8 * triangle_num + 1 for a in range (temp_k - 1 , temp_k + 1 )): print ( 'triangle word: {word}' . format (word = s)) count + = 1 print ( 'answer: {answer}' . format (answer = count)) |
답은 162이다.
'IT > PROJECT_EULER' 카테고리의 다른 글
[Project Euler] 44. Pentagon numbers (0) | 2017.05.05 |
---|---|
[Project Euler] 43. Sub-string divisibility (0) | 2017.05.01 |
41. Pandigital prime (0) | 2017.04.29 |
40. Champernowne's constant (0) | 2017.04.26 |
39. Integer right triangles (0) | 2017.04.23 |