原创 HDU 3790 簡單最短路徑問題(dijkstra+雙重權值)

給你n個點,m條無向邊,每條邊都有長度d和花費p,給你起點s終點t,要求輸出起點到終點的最短距離及其花費,如果最短距離有多條路線,則輸出花費最少的。 Input輸入n,m,點的編號是1~n,然後是m行,每行4個數 a,b,d,p,表示

原创 POJ 3660 Cow Contest (簡單floyd)

N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some co

原创 HDU 1535 Invitation Cards(多源點到單源點,dijkstra/spfa)

Invitation Cards Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submissio

原创 Codeforces Round #425 (Div. 2) B. Petya and Exam

B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard input

原创 POJ 1847 Tram (簡單最短路徑dijkstra-floyd-spfa)

題目鏈接:http://poj.org/problem?id=1847 大意:給你N個交叉路口,每個路口都對應幾個路口,第一個不用開關,其餘要扳動開關,S到T,問你需要扳動幾次開關 思路:把第一個賦值爲0,其餘爲1,進行最短路徑算法 上代

原创 HDU 2923 Einbahnstrasse(最短路徑,多源點到單源點)

Einbahnstrasse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s

原创 2017 CCPC 杭州 B題 /hdu 6265 (狀態壓縮/規律)

‘ 解法1代碼: //577ms #include <iostream> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <algorithm> #i

原创 Hdu 4565 So Easy! (矩陣快速冪)

So Easy! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 564

原创 POJ 1061 青蛙的約會 (拓展歐幾里得)

青蛙的約會 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 119313   Accepted: 25121 Description 兩隻青蛙在網上相識

原创 HDU 1757 A Simple Math Problem (矩陣快速冪)

A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis

原创 Codeforces Round #427 (Div. 2) C. Star sky

C. Star sky time limit per test 2 seconds memory limit per test 256 megabytes input standard input output sta

原创 Codeforces 7C Line(拓展歐幾里得)

C. Line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard

原创 Codeforces Round #451 (Div. 2) B 拓展歐幾里得

B. Proper Nutrition time limit per test 1 second memory limit per test 256 megabytes input standard input outp

原创 HDU 3501 Calculation 2 (歐拉函數)

Calculation 2                                                                    Time Limit: 2000/1000 MS (Java/Others)

原创 ZOJ 3872 Beauty of Array (DP)

Beauty of Array Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward has an array A with N integers. He defines the