Home
Profile
Guestbook
Taglist
Admin
[usaco] 1.5 Prime Palindromes
- usaco
2009.08.08
23:08
neoevoke
Edit
매우 큰 수의 Prime Palindromes을 찾는 문제이다.
이 문제는
위키
피디아
에도 있을 정도로 유명한 문제이다.
Prime을 가지고 Palindromes을 찾으면 오래 걸리기 때문에
Palindromes숫자를 만들어서 Prime인지 판단하면 금방 나온다.
Palindromes가 생각보다 갯수가 많지 않다.
출력하는 부분이 ofstream을 쓰면 느릴 것 같아서 fopen을 하는 짓을 했는데
생각보다 개수가 많지 않아서 괜한 짓을 했다.
/* ID: neoevok1 PROG: pprime LANG: C++ */ #include
#include
#include
#include
#include
#include
#include
#include
using namespace std; int main() { // ofstream fout ("pprime.out"); FILE* outf=fopen("pprime.out","w"); ifstream fin ("pprime.in"); int A,B; fin >> A >> B; vector
ret; for(int left=1;;left++) { int i=left; int j=left/10; int right=0; while(j>0) { i*=10; right=right*10+j%10; j/=10; } i+=right; if(i>B) break; { ret.push_back(i); if(i==7) ret.push_back(11); } } int retn=ret.size(); for(int i=0;i
0
Perfect balanced KDTree
* Pacific Northwestsern Regional 2008
Trackbacks
0
엮인글 주소
http://dw.yutar.net/329397/632/trackback
Comments
0
Leave Comments
» 편집 도구모음 건너뛰기
입력창 크기 조절
비밀
neoevoke
난 전설 같은건 믿지 않아
검색
Category
전체글
(151)
기본 카테고리
(3)
일상
(9)
-
Code
(49)
usaco
(40)
topcoder
(1)
Work
(3)
-
맛집
(4)
일식
(1)
한식
학교식당
(2)
양식
미투데이
(23)
-
Util
(3)
Windows7
(1)
-
여행
(13)
제주도
(13)
펌
(7)
분류 전체보기
블로그리뷰
(1)
-
Study
(2)
경제
(2)
Recent Post
맥과 windows7 공유가 안될 ...
2010-08-31
15:32
yutar local 2010 후기
2
2010-07-15
01:22
도올선생님>이명박과 언론, ...
2010-06-26
19:35
야구공 던지는 속도, 날아간 ...
2010-06-02
09:30
국가별 의료비와 수명
1
2010-05-26
00:44
거짓말
2010-05-25
16:26
slapchop
2010-05-06
09:00
그냥 단상
2
2010-04-28
23:55
neoevoke의 미투데이 - 2010년...
2010-04-22
04:34
이니시스 창업자 권도균 강의
2010-04-21
05:16
Recent Comment
단순히 경제 인구가 주는것 뿐...
black_H
맞아요 ㅋㅋ 비슷한거예요~~
neoevoke
정보 올림피아드랑 비슷한 거네...
PSYPODIAS
정말 답답하네요 이래서 여자들...
나나나
이젠 늙어서 긴글 읽기가 힘듭...
scheme
음 뭔가 길어서 첫줄하고 마지...
hyoseung
좋은 글입니다.
감사합니다^^ 교수님이 좋은 말...
neoevoke
그러게요 ㅋㅋㅋ 교수님이 말씀...
neoevoke
좋은글이네여
자다가쿵했쪄
Recent Trackback
Tag
FTP 서버 설치
NOD32 Anti-Virus
textyle
thoth
acm-icpc
server
FTP서버
topcoder
2008
flickr
Kelly Clarkson
R2
ezpay
맛집
etnews
thoth 장점
e4c
TED
ps2009
filezilla server
method