原创 hdu 1157 (1.3.7) Who's in the Middle

<div class="panel_title" align="left">Problem Description</div><div class="panel_content">FJ is surveying his herd to f

原创 HDU 1.2.6 (ACM steps)

<table cellspacing="0" cellpadding="0" width="100%" align="center"><tbody><tr><td class="problem_content"><div class="p

原创 hdu-1009 FatMouse' Trade(貪心算法)

題目大意: 老鼠有M磅貓食。有N個房間,每個房間前有一隻貓,房間裏有老鼠最喜歡的食品JavaBean,J[i]。若要引開貓,必須付出相應的貓食F[i]。當然這隻老鼠沒必要每次都付出所有的F[i]。若它付出F[i]的a%,則得到J[i]

原创 HDU 1.2.5 GPA(ACM step)

Problem Description Each course grade is one of the following five letters: A, B, C, D, and F. (Note that there is no

原创 WindowsSocket編程初步-UDP

        學期期末C語言實訓,其中有個項目叫“UDP文件傳輸系統”。         其實如果只學了C語言,感覺做這些東西是根本不現實的。現在明白了,我們這一個學期就只是單純學習語言,其中的基本語法。實際上根本談不上寫出實際的程序。

原创 00-自測2. 素數對猜想 (20)

讓我們定義 dn 爲:dn = pn+1 - pn,其中 pi 是第i個素數。顯然有 d1=1 且對於n>1有 dn 是偶數。“素數對猜想”認爲“存在無窮多對相鄰且差爲2的素數”。 現給定任意正整數N (< 105),請計算不超過N的滿

原创 10-2. 刪除字符串中的子串(20)

/* 輸入2個字符串S1和S2,要求刪除字符串S1中出現的所有子串S2,即結果字符串中不能包含S2。   輸入格式:  輸入在2行中分別給出不超過8

原创 00-自測3. 數組元素循環右移問題 (20)

一個數組A中存有N(N>0)個整數,在不允許使用另外數組的前提下,將每個整數循環向右移M(M>=0)個位置,即將A中的數據由(A0 A1……AN-1)變換爲(AN-M …… AN-1 A0 A1……AN-M-1)(最後M個數循環移至

原创 linux下用gcc編譯使用了math庫函數的程序出錯的解決方法

在c程序中用到math庫函數時,編譯成obj後,再生成執行文件時,會遇到類似下面的錯誤: /tmp/ccalvMPY.o: In function `main':/tmp/ccalvMPY.o(.text+0x40): undefine

原创 C語言 格式說明符(小技巧)

前些日子看書看到的一個C語言的格式說明符----%n ,蠻有意思的,拿來與大家分享下。 printf可不只是一個輸出函數哦,這個%n就是把字符串的長度,寫進一個變量。 看代碼吧,好理解。 #include <stdio.h>

原创 1090-A+B for Input-Output Practice (II)

/* 本題主要是考察系統的適應,對於多次輸入控制 */ #include <stdio.h> int main() { int a, b, n; scanf("%d", &n); while(n--) { scanf("%d

原创 08-2. 求矩陣的局部極大值(15)

</pre><pre name="code" class="plain">#include <stdio.h> #include <stdlib.h> int main(void) { int num[20][20] = {0};

原创 1016. 部分A+B (15)

<h1>1016. 部分A+B (15)</h1><div class="rfloat" id="problemInfo"><div class="limit"><div class="key">時間限制 </div><div cla

原创 hdu 2561 第二小整數

第二小整數 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7789    

原创 1093-A+B for Input-Output Practice (V)

/* 本題主要是考察系統的適應,對於多次輸入控制 */ #include <stdio.h> int main() { int x, cnt, amount; int sum = 0; scanf("%d", &cnt); wh