hdu 6077多校签到】的更多相关文章

#include <iostream> #include <cstdio> using namespace std; ][]; int f(int pos) { ; ;i<;i++) { ;j++) { if(mp[i][j]=='X') ret++; } } ) ; ) ; ) ; ) ; ) { ][pos+]==; ][pos+]==; ][pos]==; } ][pos]==; ][pos+]==; ; } int main() { int t; scanf(&quo…
http://acm.hdu.edu.cn/showproblem.php?pid=6045 题解:遍历一遍,求出两个人答案中相同的个数,用wa表示.然后我从大的数入手,当wa的数都尽可能在两个人答案的相同部分时,另一个人的答案中对的个数最小:当wa的数尽可能在两者答案不同的部分的时候,另一个人的答案对的个数最多. ac代码: #include <cstdio> #include <iostream> #include <queue> using namespace s…
Problem Description Little Q's clock is alarming! It's time to get up now! However, after reading the time on the clock, Little Q lies down and starts sleeping again. Well, he has 5 alarms, and it's just the first one, he can continue sleeping for a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5753 Sample Input Sample Output 6.000000 52.833333 分析:??? #include<stdio.h> #include<string.h> #include<math.h> #include<queue> #include<algorithm> #include<time.h> using n…
快速幂百度百科:快速幂就是快速算底数的n次幂.其时间复杂度为 O(log₂N), 与朴素的O(N)相比效率有了极大的提高. HDU - 1061 代码实现如下: import java.util.Scanner; public class Main { public static void main(String []args) { Scanner cin = new Scanner(System.in); int T = cin.nextInt(); for(int i = 0; i < T;…
A.Character Encoding 简单计数 m个非负数和等于k的方案数为$\binom{m+k-1}{k}$, 但题目还要求每个数小于n, 容斥一下即可 即$ans = \sum\limits_{0\le i \le m}(-1)^i\binom{m}{i}\binom{m+k-1-ni}{k}$ B.Pizza Hub 计算几何 贪心可以知道最优情况三角形一定有一个顶点与矩形顶点重合, 暴力枚举判断一下即可 C. 不会 D.Parentheses Matrix 贪心 假设行列都为偶数,…
2018 Multi-University Training Contest 2 6312.Game 博弈,直接官方题解,懒了. 考虑将游戏变成初始时只有2~n,如果先手必胜的话,那么先手第一步按这样取就获胜了:如果后手必胜的话,那 么先手第一步取走1就获胜了.所以全输出Yes就行了. 代码: //1004-6312-博弈-真签到题 #include<iostream> #include<cstdio> #include<cstring> #include<alg…
First One Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 672    Accepted Submission(s): 193 Problem Description soda has an integer array a1,a2,-,an. Let S(i,j) be the sum of ai,ai+1,-,aj. N…
1.打表找规律,下面是打表程序: #include <iostream> #include <cstdio> #define ll long long #define N 100005 using namespace std; ll n,m,b[N],ans,num; ll sqr(ll x) { return x*x; } void dfs(ll r){ if(r==0){ num++; for(int i=1;i<=m;i++) ans+=sqr(b[i]); retur…
用两个栈模拟,并保存每个点的时间戳.每次合并的时候记录合并时的时间戳mcnt和此时的topa和topb记做ta.tb. 每次pop的时候,如果栈的top的时间戳大于mcnt,则普通地pop,否则就在两个栈ta和tb下面找时间戳最大且还没pop掉的.然后用bj[时间戳]来标记已经pop了. #include <cstdio> #include <cstring> #define N 100005 using namespace std; struct node{ int id,v;…