A - 口算训练 题意:询问 $[L, R]$区间内 的所有数的乘积是否是D的倍数 思路:考虑分解质因数 显然,一个数$x > \sqrt{x} 的质因子只有一个$ 那么我们考虑将小于$\sqrt {x}$ 的质因子用线段树维护 其他质因子用vector 维护存在性 #include <bits/stdc++.h> using namespace std; #define N 100010 #define block 317 vector <]; int t, n, q; int…
口算训练 #include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <string> #include <map> #include <cmath> #include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0) #d…
Deleting Edges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 567    Accepted Submission(s): 210 Problem Description Little Q is crazy about graph theory, and now he creates a game about grap…
Happy Necklace Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1146    Accepted Submission(s): 491 Problem Description Little Q wants to buy a necklace for his girlfriend. Necklaces are single…
Graph Theory Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1796    Accepted Submission(s): 750 Problem Description Little Q loves playing with different kinds of graphs very much. One day he…
Building Shops Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 701 Accepted Submission(s): 265 Problem Description HDU’s n classrooms are on a line ,which can be considered as a number line. Eac…
Combine String #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #include<queue> #include<vector> #include<map> using namespace std; typedef unsigned long long LL; #de…
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5705 题意:给你一个时间和一个角度,问你下一个时针和分针形成给出的角度是什么时候 题解:我们可以将这个问题看成追及问题,考虑时针:每小时30°,每分钟1/2°,每秒1/120°,考虑分针:没分钟6°,每秒1/10°,如果我把全部同时乘一个120,不就能避免精度造成的问题了吗!现在再来考虑时针和分针的位置情况:这里我们以分针按顺时针的方向到时针 1:当时针和分针的θ∠大于180*120时(1)当(36…
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5707 题意:给你三个字符串 a,b,c,问你 c能否拆成a,b,a,b串的每一个字符在c中不能变 题解:当时打再现赛的时候没根据题目的特殊性而在哪xjb搜,艹,设dp[i][j]表示为c的前i个字符可由a的前j个字符与b的前i-j个字符组合,dp[i][j]=0表示行不通,dp[i][j]=1,表示能行 ,然后判断是否存在dp[lenc][lena]这个状态,如果lenc!=lena+lenb,那么…
A - Buy and Resell 题意:给出n个交易点,每次能够选择买或者卖,求获得最大利润 思路:维护两个优先队列,一个是卖,一个是替换,当价格差相同时,优先替换,因为次数要最少 #include <bits/stdc++.h> using namespace std; #define ll long long #define N 100010 int t, n; ll arr[N]; priority_queue <ll, vector <ll>, greater &…