본문 바로가기

프로그래밍

(357)
[MFC|CPP] 사구모양의 포텐셜 만들기 다음 신지식에 재미있어 보이는 게 있길래 답변달다가 만들어 본 것. 2차원 평면상에 주어진 점 P를 중심으로 둥그런 모양의 산을 만들어 보란다. 3차원 그래픽까지 구현할라면 죽을 것 같아서, 2차원 평면의 각 점에서의 함수값은 색으로 표현했다. 단색으로 표현할라니까 분해능이 256가지 뿐이다. 왼쪽 버튼을 클릭하면, 분지의 중앙점이 되는 P가 바뀌고, 오른쪽 버튼을 클릭하면 산이 바라보는 타겟 T가 바뀐다. 휠을 돌리면 분지의 반지름이 넓어진다. 소스코드다. VC6.0 에서 만들었다.
[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..
[복잡] 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..