#include <iostream> #include <vector> #include<algorithm> //包含sort函数 using namespace std; int main() { int n, m; ], b[]; ]; while (cin >> n >> m && (m || n)) { ; ; i <= n; i++) { cin >> a[i]; } ; i <= n; i…
Escape from Tetris Time Limit: 12000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1103 Accepted Submission(s): 280 Problem Description 由于整日整夜地对着这个棋盘,Lele终于走火入魔.每天一睡觉,他就会梦到自己会被人被扔进一个棋盘中,一直找不到出路,然后从梦中惊醒.久而久之…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1533 解题心得: 第一次写最小费用流的题,去hdoj上找了一个入门级题目,建图比较简单,用了spfa和Dij两种写法. //spfa#include <bits/stdc++.h> using namespace std; *; struct edge{ int to, cap, dis, rev; edge(int To, int Cap, int Dis, int Rev): to(To),…
核反应堆 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15706 Accepted Submission(s): 7036 Problem Description 某核反应堆有两类事件发生:高能质点碰击核子时,质点被吸收,放出3个高能质点和1个低能质点:低能质点碰击核子时,质点被吸收,放出2个高能质点和1个低能质点.假定开始的时…
数塔 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 39043 Accepted Submission(s): 23246 Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已…
单词数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 46381 Accepted Submission(s): 11369 Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数.下面你的任务是帮助xiaoou333解决这个问题. I…
Max Num Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22270 Accepted Submission(s): 13029 Problem Description There are some students in a class, Can you help teacher find the highest stude…
Fibbonacci Number Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22530 Accepted Submission(s): 10375 Problem Description Your objective for this question is to develop a program which will g…
Coin Change Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18271 Accepted Submission(s): 6291 Problem Description Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1…
根据公式计算卡特兰数,始终出现越界,自己无法解决 #include <iostream> using namespace std; long long Catalan(int num) { ; ; i <= num; i++) result *= (i + num); ; i <= num; i++) result /= i; result /= (num + ); return (long long)result; } int main() { int num; ; ) { pr…
#include <iostream> #include <cmath> #include <vector> using namespace std; struct node{ int left; int right; }; int main() { long N, M; ; vector<node> nodes; while (cin >> N >> M) { && M == ) break; ; n--) {…
#include <iostream> #include <string> using namespace std; int main() { int n, m; while (cin >> m >> n) { ; i <= n+; i++) { || i == n+) { cout << "+"; ; j <= m; j++) cout << "-"; cout <<…
#include <iostream> using namespace std; long long fib(int n) { ; ; ) ; ) { long long f2 = f0 + f1; f0 = f1; f1 = f2; n--; } return f1; } int main() { int n; while (cin >> n) { while (n--) { int a, b; cin >> a >> b; cout << f…