분류 전체보기 (469) 썸네일형 리스트형 [ProjectEuler 206] 1_2_3_4_5_6_7_8_9_0 = n*n 인 유일한 n구하기. #!/usr/bin/env python ''' for x in xrange(101010101, 138902663): if xx % 10 != 7 or xx % 10 != 3: continue xx = 10*x s = str(xx*xx) # print s # print "1_2_3_4_5_6_7_8_9_0" MeetCondition=True for i in xrange(1, 10): if s[2*(i-1)] != str(i): MeetCondition=False break if MeetCondition: print xx*xx, xx print "1_2_3_4_5_6_7_8_9_0" ''' s = "1_2_3_4_5_6_7_8_9_0" def GetList(lst, length): if length == 9.. 직육면체가 특정 면으로 착지할 확률 관련 포스팅 http://astralepic.egloos.com/4022771 http://zariski.egloos.com/2229177 http://mcfrog.org/tt/848 #!/usr/bin/env python import math def length(V): sq_sum = 0 for i in xrange(3): sq_sum += V[i]*V[i] return math.sqrt(sq_sum) def dot(U, V): d = 0 for i in xrange(3): d += U[i]*V[i] return d def omega(A, B, C): ''' computes the steradian defined by three vectors A, B, C. ref : http://en.wikipedi.. [복잡] For all e in G, and for all f not in G, e # G is significantly bigger than f # G.By above definition, we should be able to define a group G out of a linked structure.Remainig problems are how should we define a product of an element on a set of elements, denoted above with #.how should we mathematically define the language "significantly bigger".Idea for 1 e # G = ratio of links from e into GIde.. 비트 인버트는 선형적인가? int main() { unsigned short i; unsigned short inv; unsigned short ineg; for(i = 0 ; i < 0xFFFF; i++) { inv = ~i; ineg = 0xFFFF - i; if(inv != ineg) { printf("For %d, ~i (%d) != 0xFFFF - i (%d)\n", i, inv, ineg); } } return 0; } 지금 생각하면 너무 당연하게 둘이 같아야 하는데, 잠결에 이게 아닐 것 같아서 일찍 출근했다. i가 선형적으로 변할 때, 그 인버트된 값도 선형적이다. [C#] 페졸드책연습중에 한글로 장난 재밌다. ^^; [CPP|초급] mod 클래스 아마 숙제 출제자의 의도와는 맞지 않는 답일 듯. 나머지연산 클래스를 만들어서 해 봤다. 클래스 연습이겠다. 이게 메인 // ModClass.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "Mod.h" int main(int argc, char* argv[]) { CMod mod47(47); int a, b; printf("7^13 mod 47 = %d\n", mod47.Pow(7, 13)); printf("7^13 x 21 mod 47 = %d = a\n", mod47.Mul(mod47.Pow(7, 13), 21)); printf("14^13 mod 47 = %d\n", mod47.Pow.. [C|초급] 큰숫자에 작은숫자가 몇 번 나오나 #include int main() // int main() { // { int n, m, cnt=0; // int n, m, 카운터=0; // scanf("%d %d", &n, &m); // (m, n)에입력숫자를저장하라; // while(m > 0) // (m > 0)한동안 { // { if(n == m%100) // 만약(n 이 m의 마지막두자리와 같다)면 cnt++; // 카운터++; m/=10; // m의 마지막자리수를 날린다; } // } printf("%d", cnt); // printf("%d", cnt); // return 0; // return 0; } // } 문제는 The Numbers Write a program to report the number of times a number.. [C,Py|초급] 1000 부터 1까지 5의 배수 출력하기 #include int main() { printf("1000 995 990 985 980 975 970 965 960 955 950 945 940 935 930 925 920 915 910 905 900 895 890 885 880 875 870 865 860 855 850 845 840 835 830 825 820 815 810 805 800 795 790 785 780 775 770 765 760 755 750 745 740 735 730 725 720 715 710 705 700 695 690 685 680 675 670 665 660 655 650 645 640 635 630 625 620 615 610 605 600 595 590 585 580 575 570 565 560 555 550 545.. 이전 1 ··· 54 55 56 57 58 59 다음