原创 hdu3489 Necklace

http://acm.hdu.edu.cn/showproblem.php?pid=3489 Necklace Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/

原创 usaco Magic Squares

這道題目,以前寫過類似的。所以這次看了題目後,還是有頭緒的。 不過這道真的很麻煩啊! 用到了Hash + BFS 1、2、3、4、5、6、7、8不管將它們怎樣變換,最多也就8! = 40320 種情況,所以可以使用BFS算法枚舉下,打表即

原创 poj1102 LC-Display

呵呵。。。 這道題是一位隊友向我推薦的,當時因爲看英文題看得頭都大了,本不想做A題了。但這道題只需看下輸入輸出就能明白題目大意, 太爽了! 咱就不喜歡他媽的一個題目頁來長。 其實這道題就是考簡單的輸入輸出問題。 代碼如下: #inclu

原创 G Greedy Tino

G  Greedy Tino  Description          Tinowrote a long long story. BUT! in Chinese...          SoI have to tell you the

原创 J Judge Segments

 J  Judge Segments            這道題目,一開始做的時候感覺題意都有點沒懂,最後靜下心來才把題意搞懂! 題意就是判斷線段是否包含在給出的線段中,感覺很簡單,直接做!提交之後就TLE,這才發現原來都沒有分析時間複

原创 usaco Fractions to Decimals

這是一道模擬題。 /* ID: guo geer PROG: fracdec LANG: C++ */ #include<iostream> #include<cstdio> #include<cstring> #include<stri

原创 usaco Home on the Range

這是一道簡單的DP問題。 代碼好下: /* ID: guo geer PROG: range LANG: C++ */ #include<iostream> #include<fstream> #include<cstring> #inc

原创 usaco A Game

好久沒寫過題目了……呵呵! 這是一道DP問題,比較簡單! 代碼如下: /* ID: guo geer PROG: game1 LANG: C++ */ #include<iostream> #include<fstream> #incl

原创 D Digit Size

Problem Description Digital LC-display is widely used in many different fields such as electronic calculator, electr

原创 H Hello Kiki

H  Hello Kiki Description One day I was shopping in the supermarket.There was a cashier counting coins seriously when a

原创 E Elevators in Jiayuan Students' Apartment

E  Elevators in Jiayuan Students' Apartment  Description There are three elevators in the Building Bof Jiayuan Students

原创 B Buy Sticks

Problem Description Imyourgod need 3 kinds of sticks which havedifferent sizes: 20cm, 28cm and 32cm. However the shop

原创 usaco contact

hehe..... 第一遍看完題目時,完全沒看明白什麼意思,就直接看輸入輸出去了。猜到個大致意思了,然後纔看題的。 懂了後,第一想法是覺得這題目很難

原创 最小生成樹

圖論 /* 最小生成樹算法 Prim算法 */ for(i=1; i<n; i++) { lowcost[i] = dist[0][i]; adjvex[i] = 0; } lowcost[0] = 0; for(i

原创 hoj Job!Job!Job!

hehe... 這是一道很好的題目,以下給出兩種解法——思想都是採用貪心, 不過採用的數據結構不同。 一、並查集 #include<iostream> using namespace std; #define N 100000 stru