DescriptionSome of Farmer John’s N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see t...
分类:
其他好文 时间:
2015-05-07 22:16:34
阅读次数:
168
O - Treats for the Cows
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Practice POJ 3186
Description
FJ has purchased N (1
The treats are interesting for ...
分类:
其他好文 时间:
2015-05-07 22:12:19
阅读次数:
199
一开始想到的是,用一个标志位记录取第i个数的时间,但后来发现这个方法不行,可能性太多,没办法推
然后就看了解题报告的思路,说是用区间dp,状态是设出来了,但受固有思维影响,老想着怎么顺着推。
最后实在想不出了,看了代码,才发现要逆着推,从结束状态开始推起,这样公式就出来了
为了保证每一层循环要用到的值都已经被计算出来了,按区间长度进行枚举
/*
dp[i][j]:剩下第i个至第j个物品时,...
分类:
其他好文 时间:
2015-05-06 22:59:06
阅读次数:
152
http://poj.org/problem?id=2393Yogurt factoryTime Limit:1000MSMemory Limit:65536KTotal Submissions:7341Accepted:3757DescriptionThe cows have purchased ...
分类:
其他好文 时间:
2015-05-06 22:49:00
阅读次数:
284
Treats for the Cows
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 4375
Accepted: 2226
Description
FJ has purchased N (1
The treats are interesting...
分类:
其他好文 时间:
2015-05-06 21:16:03
阅读次数:
136
题目的意思是求解从路标N到路标1的最短路径,简单的最短路径题目,Dijkstra或者Bellman_Ford算法都可以过。
题目有一个坑:输入有重边,所以要选择最小的长度。
下面是AC的代码:
#include
#include
using namespace std;
int cost[1005][1005];
bool vis[1005];
int dis[1005];
c...
分类:
其他好文 时间:
2015-05-06 17:55:23
阅读次数:
120
Farmer John has just given the cows a program to play with! The program contains two integer variables, x and y, and performs the following operations on a sequence a1,?a2,?…,?an of positive integers:I...
分类:
其他好文 时间:
2015-05-06 17:55:05
阅读次数:
187
3314: [Usaco2013 Nov]Crowded CowsTime Limit:1 SecMemory Limit:128 MBSubmit:111Solved:79[Submit][Status][Discuss]DescriptionFarmer John's N cows (1 y t...
分类:
其他好文 时间:
2015-05-05 23:51:00
阅读次数:
166
Eating TogetherTime Limit:1000MSMemory Limit:65536KTotal Submissions:5579Accepted:2713DescriptionThe cows are so very silly about their dinner partner...
分类:
其他好文 时间:
2015-05-05 23:48:38
阅读次数:
158
Dining CowsTime Limit:1000MSMemory Limit:65536KTotal Submissions:7584Accepted:3201DescriptionThe cows are so very silly about their dinner partners. T...
分类:
其他好文 时间:
2015-05-05 23:39:51
阅读次数:
203