摘要:
在网上看的解题报告,推到了一会,终于想明白了这个过程,先写出c关于b的关系式,通过枚举b看是否符合c是整数的条件,然后确定界的问题,根据式子首先可确定b>a,因为b和c在关系式中具有对称性,那么可让b永远都<=c(b和c的关系就三种),通过b-c<=0确定上界,然后通过f=c+b求导可知,在枚举b的范围内f是递减的,所以从大到小枚举得到的第一个满足的,f就是最小,注意a*a比较大,要用unsigned long来定义a#include <iostream>
#include <cmath>
using namespace std;
int main() 阅读全文
摘要:
最小费用,最大流的思想,也不知道怎么稀里糊涂就ac啦#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
const int maxn=102;
const int inf=2<<20;
int cost[maxn][maxn],flow[maxn][maxn],cap[maxn][maxn],d[maxn];
int n,m;
int solve()
{ queue<int> q; int i,vis[maxn],p[maxn],to 阅读全文