HDU
这条街上最靓的妞儿
这个作者很懒,什么都没留下…
展开
-
HDU CCPC网络选拔赛 6441 Find Integer(数学)
费马大定理只只有n=1或n=2时候才会有解 当n=2时,即满足勾股定理 一, 直角三角形a^2+b^2=c^2的a值奇偶数列法则: 定理1. 如a^2+b^2=c^2是直角三角形的三个整数边长,则必有如下a值的奇数列、偶数列关系成立; (一) 直角三角形a^2+b^2=c^2奇数列a法则: 若a表为2n+1型奇数(n=1、2、3 …), 则a为奇数...原创 2018-08-25 17:36:07 · 225 阅读 · 0 评论 -
HDU 1049 Climbing Worm(数学)
思路:我们可以求出每两分钟爬虫在井壁上上升的距离sub,还有要特殊注意的是最后一次爬升是不需要休息的,时间只要一分钟就行。 知道了每两分钟上升的距离,我们只需要推断出cnt次爬行,并且爬行总距离小于n的这个cnt次数。怎么推断呢?用n/sub得到一个整数,既然最后一次爬行特殊,不需休息,我们就用n/sub减去1,得到n/sub-1,用他乘以sub得到一个n/sub-1次爬行上升的总距离,n-...原创 2018-08-22 11:26:59 · 142 阅读 · 0 评论 -
HDU 2007 平方和与立方和
坑。。题目中并没有说输入的两个数一定是从小到大,所以简单题并没有一遍AC。。#include<bits/stdc++.h>using namespace std;int main(){ int n,m; while(cin>>n>>m) { if(n>m) { ...原创 2018-08-19 11:11:00 · 137 阅读 · 0 评论 -
HDU 2010 水仙花数
#include<bits/stdc++.h>using namespace std;bool del(int a){ int temp=a; int x=a%10;a/=10; int y=a%10;a/=10; int z=a%10; if(temp==pow(x,3)+pow(y,3)+pow(z,3)) re...原创 2018-08-19 09:30:26 · 125 阅读 · 0 评论 -
HDU 1062 Text Reverse
将单词正序输出组成句子。#include<bits/stdc++.h>using namespace std;char str[1005];char s[1000][1000];int main(){ int t;cin>>t;getchar(); while(t--) { int ansi=0,ansj=0;...原创 2018-08-15 20:53:05 · 124 阅读 · 0 评论 -
HDU 1106 排序
#include&amp;lt;bits/stdc++.h&amp;gt;using namespace std;int main(){ char s[1005]; while(scanf(&quot;%s&quot;,s)!=EOF) { int len=strlen(s); int ans=0;int num[1005]; int flag=1...原创 2018-08-15 20:29:04 · 106 阅读 · 0 评论 -
HDU 1028 Ignatius and the Princess III(找规律、母函数)
#include<bits/stdc++.h>using namespace std;int main(){ int dp[150]; memset(dp,0,sizeof(dp)); dp[0]=1; for(int i=1;i<122;i++) { for(int j=i;j<122;j++){ ...原创 2018-08-15 19:20:51 · 125 阅读 · 0 评论 -
百度之星 degree(HDU 6380)
degree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 148 Accepted Submission(s): 86Problem Description 度度熊最近似乎在研究图论。给定一个有 N 个点 (ver...原创 2018-08-12 21:20:10 · 203 阅读 · 0 评论 -
百度之星 rect(HDU 6385)
rect Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 81 Accepted Submission(s): 50Problem Description 度度熊有一个大小为 MX×MY 的矩形,左下角坐标为 (0,0...原创 2018-08-12 19:06:59 · 217 阅读 · 0 评论 -
HDU 1014Uniform Generator
这一题主要是理解模拟公式的计算,在一个就是注意输出的格式。#include<bits/stdc++.h>using namespace std;int main(){ int step,mod; while(scanf("%d %d",&step,&mod)!=EOF) { int num[mod]; ...原创 2018-08-14 19:35:10 · 169 阅读 · 0 评论 -
HDU 2012 素数判定
#include<bits/stdc++.h>using namespace std;int prime[3000];void IsPrime(){ memset(prime,1,sizeof(prime)); for(int i=2;i<sqrt(3000);i++) { if(prime[i]) { ...原创 2018-08-19 16:16:52 · 180 阅读 · 0 评论 -
HDU 1071 The area(数学积分)
思路:ax^2+bx+c=y; kx+m=y; ∫(ax^2+bx+c-kx-m)dx;x2<=x<=x3; 用x1,y1,x2,y2,x3,y3表示里面的未知量。#include<bits/stdc++.h>using namespace std;int main(){ i...原创 2018-08-22 16:03:12 · 231 阅读 · 0 评论 -
HDU 1003 Max Sum(Java)
这道题目利用C的思路解决即可,但是要注意最后的格式输出,换行要么用println,要么用printf(“……%n”)输出。import java.util.*;public class Main { private static final int M = -0x3f3f3f3f; private static Scanner in; public stati...原创 2018-08-29 19:34:42 · 432 阅读 · 0 评论 -
HDU 1001(Java)
1)注意格式的输出,换行用printf中的%n输出。 2)结果在32-bit signed integer中,但是n*(n-1)不一定在这个范围之内。import java.util.*;public class Main { private static Scanner in; public static void main(String[] args) { ...原创 2018-08-29 18:48:06 · 432 阅读 · 0 评论 -
HDU 1024 Max Sum Plus Plus(DP动态规划)
解析:大神详解#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;int dp[1000005];int pre[1000005];int a[1000005];int main(){ int n,m; while(cin>>m>>n) ...原创 2018-08-20 11:44:09 · 142 阅读 · 0 评论 -
HDU 1170 Balloon Comes!
#include<bits/stdc++.h>using namespace std;int main(){ int t;cin>>t; while(t--) { char s; double a,b; cin>>s>>a>>b; dou...原创 2018-08-17 11:34:36 · 136 阅读 · 0 评论 -
HDU 1076 A Easy Task(枚举)
找第N个闰年 因为闰年会在上个闰年之后的4年或8年出现,所以只能边枚举边判断#include<bits/stdc++.h>using namespace std;int main(){ int t;cin>>t; while(t--) { int y,n; cin>>y>>n;...原创 2018-08-17 11:24:12 · 185 阅读 · 0 评论 -
HDU 1097 A hard puzzle(找规律)
乍看,以为是道大数的题目,其实计算结果是呈现周期性的#include<bits/stdc++.h>#define LL long longusing namespace std;int main(){ LL a,b; while(scanf("%lld %lld",&a,&b)!=EOF) { a=a%10; ...原创 2018-08-17 09:57:36 · 142 阅读 · 0 评论 -
HDU 2035 人见人爱A^B(快速矩阵幂)
#include<bits/stdc++.h>#define M 1000using namespace std;int del(int a,int b,int c){ int ans=1; a=a%c; while(b>0) { if(b%2==1) ans=(ans*a)%c; b=b/2; ...原创 2018-08-22 17:10:08 · 175 阅读 · 0 评论 -
HDU 1425 sort
1.本题为多组输入,虽然题目没说 2.百万+的数组定义成全局变量 3.用scanf 、printf 代替cin、cout 4.注意最终结果的输出格式#include<bits/stdc++.h>using namespace std;int num[1000005];bool cmp(int a,int b){ return a>b;}int...原创 2018-08-22 16:33:05 · 175 阅读 · 0 评论 -
HDU 1010 Tempter of the Bone(DFS+奇偶剪枝)
这道目虽然DFS,剪枝了,但还是超时,最后修改了循环里的运算步骤,险过!!T_T#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;int disx[4]={1,0,-1,0};int disy[4]={0,1,0,-1};int Map[10][10];int cnt,a,b,Min...原创 2018-08-14 17:02:38 · 143 阅读 · 0 评论 -
HDU 1016 Prime Ring Problem(DFS)
这道题目暴力模拟会超时,另一种方法就是DFS,当n=20的时候虽然也会运行输出好长时间。这道题在提交的时候PE了好多次,输出格式一定要注意!!(有关Presentation Error错误原因的分析)#include<bits/stdc++.h>using namespace std;int num[25];int vis[25];int prime[40];in...原创 2018-08-14 15:15:08 · 205 阅读 · 0 评论 -
HDU 1008 Elevator
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 84065 Accepted Submission(s): 46079Problem Description The highest building in...原创 2018-07-29 20:52:01 · 126 阅读 · 0 评论 -
HDU 1004 Let the Balloon Rise (map STL)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 145560 Accepted Submission(s): 57744Problem Description Contest ti...原创 2018-07-29 20:38:04 · 149 阅读 · 0 评论 -
HDU 1000 A + B Problem
A + B Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 777294 Accepted Submission(s): 237796 Problem Description ...原创 2018-07-28 09:27:44 · 171 阅读 · 0 评论 -
HDU 1001 Sum Problem
这里写代码片# 欢迎使用Markdown编辑器写博客 Sum Problem Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 557602 Accepted Submission(s): 141334 Pro...原创 2018-07-28 09:59:16 · 124 阅读 · 0 评论 -
HDU 1002 A + B Problem II(大数加法)
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 426436 Accepted Submission(s): 82818Problem Description I have a very ...原创 2018-07-28 11:15:21 · 152 阅读 · 0 评论 -
HDU 1003 Max Sum(简单动态规划)
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 291739 Accepted Submission(s): 69186Problem Description Given a sequence a[1],a...原创 2018-07-28 14:58:55 · 153 阅读 · 0 评论 -
HDU 1176 免费馅饼(DP)
免费馅饼 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 62521 Accepted Submission(s): 21884Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的...原创 2018-07-28 16:52:01 · 109 阅读 · 0 评论 -
HDU 1087 Super Jumping! Jumping! Jumping!(DP)
Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 48655 Accepted Submission(s): 22531Problem Description ...原创 2018-07-28 19:39:41 · 142 阅读 · 0 评论 -
HDU 1069 Monkey and Banana(DP)
Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19462 Accepted Submission(s): 10348Problem Description A group of res...原创 2018-07-29 10:22:14 · 131 阅读 · 0 评论 -
HDU 1021Fibonacci Again(数学公式)
Fibonacci Again Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 71520 Accepted Submission(s): 32722Problem Description There are anothe...原创 2018-07-30 14:00:03 · 145 阅读 · 0 评论 -
HDU 1019 Least Common Multiple(数学 多个数求LCM)
Least Common Multiple Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 62154 Accepted Submission(s): 23735Problem Description The least ...原创 2018-07-30 14:32:07 · 213 阅读 · 0 评论 -
HDU 1060Leftmost Digit(数学公式解决大数计算)
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20477 Accepted Submission(s): 7936Problem Description Given a positive i...原创 2018-08-06 20:45:18 · 286 阅读 · 0 评论 -
HDU1061 Rightmost Digit(矩阵快速幂)
Rightmost Digit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 66486 Accepted Submission(s): 24925Problem Description Given a positive...原创 2018-08-06 19:58:46 · 150 阅读 · 0 评论 -
HDU 1020 Encoding(字符统计)
Encoding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 54048 Accepted Submission(s): 24021Problem Description Given a string containi...原创 2018-08-06 17:17:32 · 151 阅读 · 0 评论 -
HDU 1018 Big Number(数学、斯特林近似)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 43068 Accepted Submission(s): 21049Problem Description In many applications ...原创 2018-08-06 10:22:02 · 155 阅读 · 0 评论 -
HDU 1251 统计难题(字典树)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 55187 Accepted Submission(s): 19275Problem Description Ignatius最近遇到一个难题,老师交给他很多单词...原创 2018-08-10 09:14:34 · 112 阅读 · 0 评论 -
HDU 1017 A Mathematical Curiosity(枚举)
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 48038 Accepted Submission(s): 15415Problem Description Given t...原创 2018-07-31 20:24:41 · 151 阅读 · 0 评论 -
HDU 1013 Digital Roots(数学规律)
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 91066 Accepted Submission(s): 28337Problem Description The digital root o...原创 2018-07-31 11:02:07 · 164 阅读 · 0 评论