随笔分类 - algorithm
摘要:题目1008:最短路径问题 时间限制:1 秒内存限制:32 兆特殊判题:否提交:3219解决:963题目描述:给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。输入:输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点t。n和m为0时输入结束。(1#include#include#includeusingnamespacestd;#defineMAX1010#defineinf100000000
阅读全文
摘要:#include#include#include#includeusingnamespacestd;#defineMAX110#defineinf100000000structnode{intdt;intid;booloperatorq;structedge{intv;intw;intnext;}E[2*MAX*MAX];inthead[MAX];intnum;intdist[MAX];boolvis[MAX];intn;intsrc,des;voidinit(){memset(head,-1,sizeof(head));num=0;inti;for(i=1;idist[u]+E[i].w){
阅读全文
摘要:Jersey PoliticsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4231Accepted: 1022Special JudgeDescriptionIn the newest census of Jersey Cows and Holstein Cows, Wisconsin cows have earned three stalls in the Barn of Representatives. The Jersey Cows currently control the state's redistric
阅读全文
摘要:A - WatermelonCrawling in process...Crawling failedTime Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionOne hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the waterm
阅读全文
摘要:Get Many Persimmon TreesTime Limit:1000MSMemory Limit:30000KTotal Submissions:2821Accepted:1836DescriptionSeiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Kat
阅读全文
摘要:SudokuTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 10849Accepted: 5414Special JudgeDescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. Th
阅读全文
摘要:Curling 2.0Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7490Accepted: 3127DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked.
阅读全文
摘要:A Round Peg in a Ground HoleTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4098Accepted: 1246DescriptionThe DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to one another using a wooden peg that fits into pre-cut holes in
阅读全文
摘要:Contestants DivisionTime Limit:2000MSMemory Limit:65536KTotal Submissions:6947Accepted:1961DescriptionIn the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one problem. Due to t
阅读全文
摘要:Crazy ThairsTime Limit:3000MSMemory Limit:65536KTotal Submissions:6092Accepted:1478DescriptionThese days, Sempr is crazed on one problem named Crazy Thair. GivenN(1 ≤N≤ 50000) numbers, which are no more than 109, Crazy Thair is a group of 5 numbers {i,j,k,l,m} satisfying:1. 1 ≤i#include#include#incl
阅读全文
摘要:Number SequenceTime Limit:1000MSMemory Limit:10000KTotal Submissions:28810Accepted:8003DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive integer num
阅读全文
摘要:Monthly ExpenseTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 9302Accepted: 3823DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤moneyi ≤ 10,000) that h
阅读全文
摘要:Communication SystemTime Limit:1000MSMemory Limit:10000KTotal Submissions:19377Accepted:6851DescriptionWe have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufacture
阅读全文
摘要:Lake CountingTime Limit:1000MSMemory Limit:65536KTotal Submissions:14776Accepted:7496DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 #include#include#define MAX 110char map[MAX][MAX];bool vis[MAX][MAX];int
阅读全文
摘要:Tree CuttingTime Limit:1000MSMemory Limit:65536KTotal Submissions:3022Accepted:1767DescriptionAfter Farmer John realized that Bessie had installed a "tree-shaped" network among his N (1 #include#include#includeusing namespace std;#define MAX 10010bool vis[MAX];vector list[MAX];int sum[MAX]
阅读全文