2018icpc南京/gym101981 I Magic Potion】的更多相关文章

题意: 若干个勇士,每个勇士只能杀特定的怪物.每个勇士只能杀1个怪,但是有一些药,喝了药之后能再杀一个,每个勇士只能喝一瓶药.问你最多杀多少怪. 题解: 按照如下建图套网络流板即可. 网上有题解说套DinicT了,我们队套kuangbin的dinic过了,不得不说kuangbin的板质量真的好. #include<bits/stdc++.h> using namespace std; #define ll long long #define MAXN 1500 //最大点数 #define M…
题解:最大流板题:增加两个源点,一个汇点.第一个源点到第二个源点连边,权为K,然后第一个源点再连其他点(英雄点)边权各为1,然后英雄和怪物之间按照所给连边(边权为1). 每个怪物连终点,边权为1: 参考代码: #include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f ; int n,m,k,s,t,u,v,w,num,num1; struct Edge { int from, to, cap, flow; }; ve…
题意: 数一个金字塔里面有多少个正三角形. 题解: ans[n]=n*(n-1)*(n-2)*(n-3)/24 #include<bits/stdc++.h> using namespace std; typedef long long ll; ; )/; int main() { long long i,j,k,n,m,t; scanf("%lld",&t); while(t--) { scanf("%lld",&n); ll ans=…
题意: 有一个棋盘上,1是空格,0是障碍物,一开始每个空格里都有一只袋鼠,你可以命令所有袋鼠一起向上下左右一个方向走一格,一旦碰到边界或障碍物,袋鼠就不动,如果它后面有袋鼠这两个袋鼠就会挤进一个格子,棋盘最大20*20,要求你在50000步以内让所有的袋鼠挤到一个格子里面. 题解: 这个题真的是全场最佳,不多说了看代码吧. #include<stdio.h> #include<string.h> #include <bits/stdc++.h> using namesp…
题意: n个连续排列的石子,每次只许拿连续的(中间没有空格)的k个,问你谁必胜 题解: 简单博弈,特判总数为0,k=1两种情况,其他情况先拿必胜,方法是拿掉中间的,然后对方怎么拿你镜面拿就行. #include<iostream> using namespace std; int main(){ int n,k; scanf("%d %d",&n,&k); ){ printf("Austin\n"); }){ ==){ printf(&q…
Magic Potion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 488    Accepted Submission(s): 287 Problem Description In a distant magic world, there is a powerful magician aswmtjdsj. One day,aswm…
题目链接:http://codeforces.com/gym/101981/attachments There are n heroes and m monsters living in an island. The monsters became very vicious these days,so the heroes decided to diminish the monsters in the island. However, the i-th hero can only kill on…
2018ICPC南京网络赛 A. An Olympian Math Problem 题目描述:求\(\sum_{i=1}^{n} i\times i! \%n\) solution \[(n-1) \times (n-1)! \% n= (n-2)!(n^2-2n+1) \%n =(n-2)!\] \[(n-2+1)\times (n-2)! \% n= (n-3)!(n^2-3n+2) \%n =(n-3)! \times 2\] 以此类推,最终只剩下\(n-1\) 时间复杂度:\(O(1)\…
Magic Potion http://codeforces.com/gym/101981/attachments/download/7891/20182019-acmicpc-asia-nanjing-regional-contest-en.pdf 从源点到英雄分别拉容量为1和2的边,跑两遍网络流,判断两次的大小和k的大小 #include<iostream> #include<cstring> #include<string> #include<cmath&g…
Problem I. Magic Potion There are n heroes and m monsters living in an island. The monsters became very vicious these days, so the heroes decided to diminish the monsters in the island. However, the i-th hero can only kill one monster belonging to th…