http://acm.hdu.edu.cn/showproblem.php?pid=5104 Primes Problem Description Given a number n, please count how many tuple$(p_1, p_2, p_3)$ satisfied that $p_1 \leq p_2 \leq p_3, $ $p_1,p_2,p_3$ are primes and $p_1 + p_2 + p_3 = n$. Input Multiple test cases(...
pid=3284 思路,简单dp题,开始想歪了,然后想通了 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 #include <cstdio> #include <cstring> usingnamespacestd; constintN = 101; in...
int main(){ int m,n,a,b,c,t[12]={31,28,31,30,31,30,31,31,30,31,30,31};while(scanf("%d/%d/%d",&a,&b,&c)!=EOF){ t[1]=28; // 缺乏初始化 if(a%4==0){ if(a%100==0){ if(a%400==0)t[1]=29;} else // 缺else t[1]=29;} n=0;for(m=0;m...
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6330 题目: 题意:给你长宽高,让你画出一个正方体。 思路:模拟即可,湘潭邀请赛热身赛原题,不过比那个容易很多,湘潭那个没写==,这个模拟还是很难受的,写了好久…… 代码实现如下: #include<set> #include #include<queue> #include<stack> #include<c...
1:-1; } void make_set() { FOR(i,1,n) father[i]=i; } int find_set(int a) { while(a!=father[a]) a=father[a]; return a; } void Kursal() { int sum=0,ans=0; bool flag=false; FOR(i,1,m) { int x=find_set(map[i].x); int y=find_set(map[i].y); if(x!=y...
set<int> S; set<int>::iterator it; structedge{ intu, id; }b[MAXN]; boolcmp(edge i, edge j) { returni.u > j.u; } voidinti() { memset(p, 0,sizeof(p)); memset(aa, -1,sizeof(aa)); for(inti = 1; i <= n; i++) ...
HDU 5105 Math Problem http://acm.hdu.edu.cn/showproblem.php?pid=5105 题意就是给出一条三次函数,f(x)=|a*x^3+b*x^2+c+d|。和给定一个区间[L,R],问你这个函数在这个区间里面的最大值。 刚开始做的时候,想到是三分答案的,不久前做个一题二次函数的,固定一个点p求最短距离,...
hdu.edu.cn/diy/contest_showproblem.php?pid=1002&cid=34750 Problem Description A...; H,W <= 100 Sample Input Sample Output BFS模板题,遇到#,将#能走到的位置变成点,看有多少块区域被隔开 HDU Oil Deposits跟这题一样,只是 HDU-1001 Sum Problem 水题 HDU-1001 Sum Problem 题目链接:杭电1001 ...
hdu_2604Queuing(快速幂矩阵) 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2604 Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4428 &nbs... HDU - 2601 An easy problem ...
HDU 5974 A Simple Math Problem 数学题 http://acm.hdu.edu.cn/showproblem.php?pid=5974 遇到数学题真的跪。。 题目要求 X + Y = a lcm(X, Y) = b 设c = gcd(x, y); 那么可以表达出x和y了,就是x = i * c; y = j * c;...