当前位置: 首页 > news >正文

wordpress域名网站搬家怎样做才能发布你的网站

wordpress域名网站搬家,怎样做才能发布你的网站,侧边栏jquery网站后台,2022年大连黄页题意#xff1a; 给n个小朋友分发糖果#xff0c;但小朋友们之间有嫉妒心。接下来m行#xff0c;每行三个数#xff0c;分别表示小朋友A希望B得到的糖果不能比他多x个。要求你计算在满足所有小朋友的条件的情况下最多需要准备多少颗糖。 题目#xff1a; During the ki…题意 给n个小朋友分发糖果但小朋友们之间有嫉妒心。接下来m行每行三个数分别表示小朋友A希望B得到的糖果不能比他多x个。要求你计算在满足所有小朋友的条件的情况下最多需要准备多少颗糖。 题目 During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the kids loved candies very much and often compared the numbers of candies they got with others. A kid A could had the idea that though it might be the case that another kid B was better than him in some aspect and therefore had a reason for deserving more candies than he did, he should never get a certain number of candies fewer than B did no matter how many candies he actually got, otherwise he would feel dissatisfied and go to the head-teacher to complain about flymouse’s biased distribution. snoopy shared class with flymouse at that time. flymouse always compared the number of his candies with that of snoopy’s. He wanted to make the difference between the numbers as large as possible while keeping every kid satisfied. Now he had just got another bag of candies from the head-teacher, what was the largest difference he could make out of it? Input The input contains a single test cases. The test cases starts with a line with two integers N and M not exceeding 30 000 and 150 000 respectively. N is the number of kids in the class and the kids were numbered 1 through N. snoopy and flymouse were always numbered 1 and N. Then follow M lines each holding three integers A, B and c in order, meaning that kid A believed that kid B should never get over c candies more than he did. Output Output one line with only the largest difference desired. The difference is guaranteed to be finite. Sample Input 2 2 1 2 5 2 1 4 Sample Output 5 Hint 32-bit signed integer type is capable of doing all arithmetic. 分析 1.这道题目是典型的差分约束系统小于等于是最短路 大于等于是最长路核心在于xj-xibk会发现它类似最短路中的三角不等式d[v]d[u]w[u,v]即d[v]-d[u]w[u,v]即从u指向v建边num[B]num[A]x。求最大值的话就是跑1-n的最短路对应求最小值就是跑1-n的最长路。此题用队列的话会T掉可以改成栈或者想办法优化。 2.关于差分约束选择队列还是堆栈当存在回路SPFA的队列实现会超时堆栈实现可以堆栈实现SPFA有时候堆栈确实比较快 都大三的老阿姨了差分约束还不熟练加油吧查缺补漏中。。。。 AC代码 #includestdio.h #includestring.h #includealgorithm using namespace std; const int inf0x3f3f3f3f; const int M3e410; const int N15e410; int n,m,k,a,b,c; int vis[M]/**在队列标志*/; int head[M]/**每个结点的头指针(或者编号)*/; int q[M]/**堆栈*/,dis[M]; struct node {int b;int c;int next; }edge[N];void add(int a,int b,int c)//加边 {edge[k].bb;edge[k].cc;edge[k].nexthead[a];head[a]k; } void SPFA(int start,int n) {int top0;for(int i1;in;i)//初始化{if(istart){q[top]i;//入栈vis[i]true;dis[i]0;}else{vis[i]false;dis[i]inf;}}while(top!0){int aq[--top];vis[a]false;for(int ihead[a];i!-1;iedge[i].next){int bedge[i].b;if(dis[b]dis[a]edge[i].c){dis[b]dis[a]edge[i].c;if(!vis[b]){vis[b]true;q[top]b;}}}} } int main() {while(~scanf(%d%d,n,m)){k0;//加边计数这个不要忘memset(head,-1,sizeof(head));for(int i0;im;i){scanf(%d%d%d,a,b,c);add(a,b,c);}SPFA(1,n);//printf(*****\n);printf(%d\n,dis[n]);//此处求n比1最多多多少糖果}return 0; } /**给n个人派糖果给出m组数据每组数据包含A、B、c 三个数 意思是A的糖果数比B少的个数不多于c,即B的糖果数 - A的糖果数 c 。 最后求n 比 1 最多多多少糖果。*/
http://wiki.neutronadmin.com/news/55562/

相关文章:

  • 网站建设和邮箱的关联福州企业网站模板建站
  • 石家庄网站制作建设网络营销公司怎么赚钱的
  • 营销网站制作企业做旅游网站的写手
  • 做地税电子签章的网站wordpress 登录评论
  • 广州市建设局官方网站旅游网站建设成本核算
  • 网站开发支持多个币种理财网站模板免费下载
  • 城乡建设招投标网站百度帐号登录
  • 苏州企业网站开发正规的网站制作开发
  • 厦门网站制作网页软文写作营销
  • 网站建设一般多少钱比较合适哈尔滨网站建设工作室
  • 上海企业网站开发游戏开发公司招聘
  • 化州+网站建设跨境网络专线多少钱一年
  • 深圳建设造价信息网站做旅行攻略的网站
  • 广告在线设计网站天津做网站建设的公司
  • 建网站的公司价格青岛网站建设平台
  • 体育 网站建设询价函格式模版网站好吗
  • 长沙市门户网站建设工业设计是干嘛的
  • 宁波三优互动网站建设公司怎么样早教类网站模板
  • 上海网站建设模板seo网站优化软件
  • 企业网站建设的目的有哪些怎样用ps做网站首页图
  • 昆山网站建设哪家好仓库管理erp系统使用
  • 风铃微网站怎么做无锡网站制作怎么样
  • c 网站开发用的人多吗cdn wordpress 登录
  • 番禺附近网站建设推广如何上传网站模板
  • 网站经营性质学生登录注册入口
  • 重庆做网站设计网络营销赚钱
  • 企业网站价格花济南定制网站制作公司
  • 北京企业制作网站网站建设学生作业成品
  • 重庆百度竞价排名做网站需求 后期方便优化
  • 免费建设网站怎么样沣东新城开发建设集团有限公司网站