![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
简单
爱篮球爱IT
这个作者很懒,什么都没留下…
展开
-
hdu1205-鸽巢原理
思路:听说这要用鸽巢原理,其实我根本不晓得这是什么,这道题很容易看出来解法。 如果我们要把这些全部都吃完,肯定是和最大值有关系的,先来看几个例子, 4 1 1最大值为4,最后4还会剩下2。4 2 1最大值为 4,经过相互相减后,全部为0。 其实我们可以将这个数组分成两部分,一部分为最大值一个,另外一部分为剩下的数值,原创 2016-11-07 11:30:19 · 1473 阅读 · 1 评论 -
zcmu1571——Subarray GCD
DescriptionGiven an array A1,A2...AN, you have to print the size of the largest contiguous subarray such thatGCD of all integers in that subarray is 1.Formally,For a subarray Ai,Ai+1...Aj原创 2017-07-18 21:53:49 · 402 阅读 · 0 评论 -
zcmu1567——Good Joke!
DescriptionVadim and Roman like discussing challenging problems with each other. One day Vadim told his friend following problem:Given N points on a plane. Each point p is defined by it's two原创 2017-07-18 21:46:09 · 711 阅读 · 0 评论 -
hdu5776——sum
Problem DescriptionGiven a sequence, you're asked whether there exists a consecutive subsequence whose sum is divisible by m. output YES, otherwise output NO InputThe first line of the input原创 2017-07-17 22:41:44 · 243 阅读 · 0 评论 -
蓝桥杯——带分数
标题:带分数 100 可以表示为带分数的形式:100 = 3 + 69258 / 714 还可以表示为:100 = 82 + 3546 / 197 注意特征:带分数中,数字1~9分别出现且只出现一次(不包含0)。 类似这样的带分数,100 有 11 种表示法。题目要求:从标准输入读入一个正整数N (N程序输出该数字用数码1~9原创 2017-04-03 14:56:53 · 282 阅读 · 0 评论 -
hdu1326-简单数学题
Problem DescriptionLittle Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. ``Look, I've built a wall!'', he tells his older sist原创 2016-11-09 19:17:33 · 393 阅读 · 0 评论 -
hdu1323
没什么算法,直接暴力,ac#include #include #include using namespace std;int main(){ int a[110],x,i; for(i=0;;i++){ scanf("%d",&x); if(x==0) break; a[i]=x;原创 2016-11-09 18:33:36 · 291 阅读 · 0 评论 -
hdu1303
题意:给你2~15个数,让你求出这些数里面中有几对一个数恰好是另外一个数的两倍。思路:直接暴力。#include #include #include using namespace std;int main(){ int a[20],n; while(~scanf("%d",&n)&&n!=-1) { a[0]=n; i原创 2016-11-09 16:12:02 · 408 阅读 · 0 评论 -
hdu1283
水题!!#include #include #include #include using namespace std;int main(){ int r1,r2,r3,m1,m2; char str[205]; while(~scanf("%d%d",&m1,&m2)) { getchar(); r1=r2=原创 2016-11-09 15:28:51 · 267 阅读 · 0 评论 -
hdu1282-回文数猜想
思路:起初我准备用字符串写的,因为这样比较容易获得每一位的数字,但马上就否定这种想法,因为想加太麻烦了。后来分析了下,回文数反过来的数也是相同的,可以直接从个位到高位再求一次余,然后再求和。代码:#include #include #include using namespace std;int sum(int num){ int n=0; while(nu原创 2016-11-09 14:55:58 · 472 阅读 · 0 评论 -
hdu1248-完全背包
有一个参考博客,这个博客讲的比较仔细点击打开链接#include #include #include #include #define N 10005using namespace std;int a[3]={150,200,350};int dp[N];int main(){ int t,c; scanf("%d",&t); while(t--)原创 2016-11-07 22:38:29 · 310 阅读 · 0 评论 -
hdu1234-sort函数的应用
题意:题目的要求是找到每天来机房时间最早的和离开机房最晚的人思路:做一个结构体,该结构体包含三个元素,分别是id,进来的时间stime,离开的时间etime,然后变下两个cmp函数就可以了code:#include #include #include #include using namespace std;struct Node{ string id;原创 2016-11-07 16:27:48 · 344 阅读 · 0 评论 -
hdu1219-map的简单运用
哈哈!!水题!!!#include #include #include #include #define N 100005using namespace std;map m;char str[N];int main(){ while(gets(str)) { m.clear(); int len=strlen(str);原创 2016-11-07 15:58:18 · 384 阅读 · 0 评论 -
zcmu1575——Decreasing String
DescriptionYou need to find a string which has exactly K positions in it such that the character at that position comes alphabetically later than the character immediately after it. If there are m原创 2017-07-18 22:00:07 · 309 阅读 · 0 评论