#include <cstdio>#include <cstring>int f[1001];int max(int a,int b){ return (a>b?a:b);}void swap(int &a,int &b)//原文swap函數疑有誤,此處做了改正{ int c = a; a = b; b = c;}int main(){ int i,j,m,n,x,v[1001],big=1,total,tmp;
題目: http://poj.org/problem?id=3714 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27048#problem/DRaidTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 7355 Accepted: 2185DescriptionAfter successive failures in the battles against the
轉載來源:http://blog.csdn.net/lyy289065406/article/details/6661449這道題比較特殊,用DFS也是對的,而且可以進行最佳化,即使直接n[i]--也是對的.解釋見注釋.//Memory Time //440K 16MS /*DFS*/ #include<iostream> using namespace std; int n[7]; //價值為i的物品的個數 int SumValue;
連結:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3203http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28708#problem/ALight BulbTime Limit: 1 Second Memory Limit: 32768 KBCompared to wildleopard's wealthiness, his brother
經典搜尋題。自己寫了個DFS非遞迴實現。其實還是遞迴實現比較科學。BFS用函數也比較好。主要是return方便,遞迴是進入方便。總之都是停止多重迴圈中的某一個狀態。/*This Code is Submitted by Iris for Problem 1797 at 2013-07-24 13:31:26*///DFS Stack#include <stack>#include <cstdio>using namespace std;int move[4][2] = {
這道題和1860有點像啊。就是求正環啊、、、但是有一點不一樣的是,這個題初始化的時候要初始化為1.0不是0否則乘以利率之後就會變成零了啊、、竟然沒發現啊、、這個腦子啊,進水了啊、、、、ArbitrageTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13270 Accepted: 5585DescriptionArbitrage is the use of discrepancies in currency exchange
題目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3716來源:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26644#problem/ARibbon GymnasticsTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeRobert is a gymnastics
連結:http://poj.org/problem?id=2240http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/FArbitrageTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13067 Accepted: 5493DescriptionArbitrage is the use of discrepancies in currency
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 26435 Accepted: 12401Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John
#include <stdio.h>#include <cstring>#include <iostream>#define mod 10000000using namespace std;typedef long long LL;LL a[4][4],tmp[4][4],ans[4][4];//0.00 s 1260 K/**構造矩陣 列向量