본문 바로가기

UVA

UVa 628. Passwords 628 - PasswordsTime limit: 3.000 seconds 비밀번호 여러 서버에 여러개의 계정을 둔 사람은 당연히 여러 가지의 비밀번호를 기억해야 합니다. 그리고 어떤 사람이 비밀번호를 잊어버린 상황을 충분히 상상할 수 있을겁니다. 그/그녀 가 기억하고 있는 것은 오직 단어 x, y 그리고 z 와 두 개의 숫자입니다: 하나는 시작하는 숫자이고 다른 하나는 끝나는 숫자입니다. 당신은 이제 주어진 단어와 규칙을 기반으로 하여 비밀번호의 가능성이 있는 모든 것을 찾아내는 프로그램을 작성해야 합니다. 예를 들어 주어진 3 개의 단어: x, y, z 와 주어진 규칙이 0#0 라면, 이 규칙은 의 형태로 나타나야 합니다. 입력 첫 번째 줄은 사전에 있는 단어들의 숫자를 나타냅니다(n). 각 단어들은 .. 더보기
UVa 628. Passwords 628 - PasswordsTime limit: 3.000 seconds Passwords Having several accounts on several servers one has to remember many passwords. You can imagine a situation when someone forgets one of them. He/she remembers only that it consisted of words x, y and z as well as two digits: one at the very beginning and the other one at the end of the password. Your task is to write a program which will generate.. 더보기
UVa 341. Non-Stop Travel 341 - Non-Stop TravelTime limit: 3.000 seconds 안멈추는 여행 David는 운전할 때 정지 신호와 양보신호, 그리고 신호등의 삼색 신호에 따라 기다리는 것을 싫어합니다. 이러한 짜증을 줄이기 위해서 평소에 자주 가는 곳들의 지도를 준비한 뒤 각 지역들의 교차로마다 평균적으로 얼마나 멈추게 되는지를 초단위로 잽니다. David는 이제 당신의 도움을 받아서, 각 지역의 특정한 두 지점을 놓고, 그가 한 지점에서 다른 한 지점으로 갈 때까지 걸리는 지연시간을 최소로 할 수 있는 방법을 찾고 싶어합니다. 이 때, 지연시간을 최소로 하기 위하여 총 운전거리가 늘어나는 것은 상관하지 않습니다. 입력 각 지역에서 David는 당신에게 지도를 줄겁니다. 지도에 나와있는 데이터의 첫번.. 더보기
UVa 341. Non-Stop Travel 341 - Non-Stop TravelTime limit: 3.000 seconds Non-Stop Travel David hates to wait at stop signs, yield signs and traffic signals while driving. To minimize this aggravation, he has prepared maps of the various regions in which he frequently drives, and measured the average delay (in seconds) at each of the various intersections in these regions. He wants to find the routes between specified poi.. 더보기
UVa 562. Dividing Coins. 동전 나누기 일반적으로 구리선은 네덜란드인이 발명한 것으로 알려져 있습니다. 두 네덜란드 사람이 구리로 만들어진 동전을 두고 싸우고 있었습니다. 그들은 동전을 매우 가지고 싶었기 때문에 싸움은 꽤나 난폭하게 벌어졌고 결국 동전을 매우 세게 양쪽에서 잡아당기는 바람에 구리선이 만들어지게 되었다고 합니다. 그러나 싸운 뒤의 일은 잘 알려져 있지 않은데요, 그 뒤에 두 사람은 동전으로 차있는 가방을 둘 중 한 명에게 주려고 했습니다. 가방 안의 들어있는 동전들은 똑같이 나눌순 없었습니다. 첫 번째 사람은 그 둘 모두가 아주 사소한 것까지 똑같이 나누고 싶어한다는 점에서 분배량이 똑같지 않다는 것을 참을 수 없었습니다. 요즘 들어서 동전 하나때문에 싸운다는것은 찾아보기 어려운 일이지만, 가능한한 최대한 공평하도.. 더보기
UVa 562. Dividing Coins Dividing coins It's commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so eager to get it and the fighting was so fierce, they stretched the coin to great length and thus created copper-wire. Not commonly known is that the fighting started, after the two Dutch tried to divide a bag with coins between the tw.. 더보기
PKU 1008, UVa 300. Maya Calendar. AC get. #include #include char *HaabMonth[18]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"}; char *TzolkinDay[20]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; int main() { int n, i; int year, mon.. 더보기
UVa 300. Maya Calendar. AC # Problem Verdict Language Run Time Submission Date 7273761 300 Maya Calendar Accepted ANSI C 0.008 2009-07-26 09:43:44 haab력을 일수로 계산해서 다시 tzolkin으로 변환합니다. #include #include int get_haab() { int y, m, d, days; char *names[20]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}; char tmp[7]; scanf("%d.. 더보기
UVa 300. Maya Calendar 300 - Maya CalendarTime limit: 3.000 seconds 마야 달력 M. A. Ya 교수는 저번 휴일에 낡은 마야 달력에 대한 놀라운 발견을 했습니다. 오래된 어려운 메시지에서, 교수는 마야 문명에서 Haab 이라고 부르는, 19달과 365일로 이루어진 역법을 사용했다는것을 알아냈습니다. 처음부터 18번째 달까지는 각각 20일로 이루어져 있는데, 그 달들의 이름은 pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu 였습니다. 각 달의 날들은 이름이 있지 않고 0부터 19까지의 숫자로 표기되었습니다. Haab의 마지막 달은 uayet 이라는 이름이었는데,.. 더보기
UVa 300. Maya Calendar 300 - Maya CalendarTime limit: 3.000 seconds Maya Calendar During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day long year, called Haab, which had 19 months. Each of the first 18 months was 20 days long, and the names of the months were pop, no, zip, zotz,.. 더보기
UVa 324. Factorial Frequencies 324 - Factorial FrequenciesTime limit: 3.000 seconds Factorial Frequencies 불 보듯 뻔히 보이는 사업의 하락세를 보강하기 위하여, Madam Pheonix는 그녀의 고객들에게 여러 종류의, 수를 이용한 점 서비스를 하기로 했습니다. 그녀는 십진수로 표현되는 팩토리얼의 각 자리에 있는 숫자들의 개수의 합이, 그들이 겪게 될 미래의 일들의 가짓수를 표현할 수 있다고 믿도록 만들었습니다.그러나 단순한 손금보기와는 다르게, 그녀는 이 수열들을 단숨에 계산하여 알려줄 능력이 되지 못했기에 당신을 고용하여 각 값들을 결정하려 합니다. n!(n 팩토리얼)의 정의가 1*2*3*...*n임을 잊지 마세요. 그녀가 한 주의 , 한 달의, 혹은 한 해 중의 하루의 .. 더보기
UVa 324. Factorial Frequencies 324 - Factorial FrequenciesTime limit: 3.000 seconds Factorial Frequencies In an attempt to bolster her sagging palm-reading business, Madam Phoenix has decided to offer several numerological treats to her customers. She has been able to convince them that the frequency of occurrence of the digits in the decimal representation of factorials bear witness to their futures. Unlike palm-reading, how.. 더보기
UVa 200. Rare Order AC get =_= #include #include #include #define FUCKYOUSPARKING 100 int graph[FUCKYOUSPARKING][FUCKYOUSPARKING]; int out_degree[FUCKYOUSPARKING]; int degree[FUCKYOUSPARKING]; char prev[255]; char curr[255]; // 문자 비교 파트에요. -_- void fuckingJAVA(char *a, char *b, int graph[FUCKYOUSPARKING][FUCKYOUSPARKING], int degree[FUCKYOUSPARKING], int out_degree[FUCKYOUSPARKING]) { int firstChar = *a - 'A', secondChar = *b.. 더보기
UVa 200. Rare Order Rare Order 한 희귀 서적 수집가가 최근에 어떤 책이 영어와 같은 문자로 이루어져 있지만 낯설은 언어로 적혀있는 것을 발견하였습니다. 짧은 색인이 있지만, 영어의 알파벳과 같이 생각하지 못할만큼 다른 순서로 적혀있었습니다. 수집가는 색인을 이용하여 문자의 순서를 확인해보려 했지만 지루함과 당혹감을 느끼며 포기했습니다. 당신은 수집가의 작업을 마무리할 프로그램을 작성해야 합니다. 특히, 이미 특정 방법에 의해 짜여진 문자열들을 분류하고 어떤 순서인지를 알아내야 합니다. 입력 입력은 대문자로, 한 줄에 한 문자열이 들어갑니다. 각 문자열은 최대 20개의 문자를 포함할 수 있습니다. 목록의 마지막은 '#' 문자를 사용합니다. 모든 문자가 사용되어야 하는건 아니지만, 목록에 사용된 문자들 모두가 특정 방.. 더보기
UVa 200. Rare Order Rare Order A rare book collector recently discovered a book written in an unfamiliar language that used the same characters as the English language. The book contained a short index, but the ordering of the items in the index was different from what one would expect if the characters were ordered the same way as in the English alphabet. The collector tried to use the index to determine the order.. 더보기
UVa. 112, PKU 1145. Tree Summing. AC #include int num,yes; char ch; int func(int sum) { int n,leaf=0; if(scanf(" %d",&n)) { sum+=n; scanf(" %c",&ch); leaf+=func(sum); scanf(" %c",&ch); leaf+=func(sum); if(leaf==2 && sum==num) { yes=1; } } else { if(scanf(" %c",&ch)) { if(ch==')') return 1; } } if(scanf(" %c",&ch)) { if(ch==')') return 0; } } main() { while (scanf("%d", &num) != EOF) { scanf(" %c",&ch); func(0); if(yes==1) puts("yes.. 더보기