卡了一道題,想今天怎麼都得過一道題,就先拿著開刀吧,比較簡單的#include <cstdio>#include <algorithm>#include <cstring>using namespace std;typedef long long ll;struct edge { int u, v; ll w; bool is;}e[25010];int n, m, fa[1010];bool cmp( edge a, edge b ) {
題目分析:裸的最短路,但是結點有點多,用鄰接矩陣會RE,用鄰接鏈表格儲存體圖。然後就BallmanFord了。吐槽:首先沒看資料一直RE,各種RE,然後輸出的時候#和數字寫反了,一直WA,囧!代碼:#include<cstdio>#include<cstring>#include<vector>#include<queue>using namespace std;const int INF = 2000000010;const int maxn =
RoadblocksTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5564 Accepted: 2111DescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly,
Bone CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14600 Accepted Submission(s): 5817Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone
分析:剛寫這道題的時候,就當作簡單的棧的題寫,但是有一點問題,就是矩陣相乘順序一定。所以代碼就寫的老長。調試的時候也不斷出錯。總之,我太急了,還沒在草稿紙上大號草稿就開始寫代碼。這樣子,效率太低了。還有自己寫代碼的能力太弱了。 #include<stdio.h>#include<string.h>#define MAXN 28struct martix{ int row; int col;} Martix[MAXN],temp[MAXN];int
直接代碼吧:/*Hdu 1028 Ignatius and the Princess III 整數劃分 */#include<iostream>#include<cstdio>using namespace std;const int maxn = 150;int f[maxn][maxn];int n;int main(){ while(cin>>n) { for(int i = 0; i <= n; i++)