自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

booty

不想要平淡的生活,就要用心去折腾。

  • 博客(40)
  • 收藏
  • 关注

原创 【无标题】

ceil(7/4)比如这个算式,结果为什么是1而不是2呐,这个是因为7/4是整数除法结果为1,ceil向上取整只能是1,那怎么才能另这个算式等2呐。答案就是这样写ceil(7.0/4.0)这样计算结果就是2,浮点数相除是有小数的,这样的话ceil可以向上取整,即答案为2。

2023-09-21 08:19:11 74

原创 猴子吃包子

资源限制时间限制:1.0s 内存限制:256.0MB问题描述从前,有一只吃包子很厉害的猴子,它可以吃无数个包子,但是,它吃不同的包子速度也不同;肉包每秒钟吃x个;韭菜包每秒钟吃y个;没有馅的包子每秒钟吃z个;现在有x1个肉包,y1个韭菜包,z1个没有馅的包子;问:猴子吃完这些包子要多久?结果保留p位小数。输入格式输入1行,包含7个整数,分别表示吃不同包子的速度和不同包子的个数和保留的位数。输出格式输出一行,包含1个实数,表示吃完所有包子的时间样例输入4 3 2 20 30 15 2

2020-11-08 10:14:44 156

原创 UCF Local Programming Contest 2014

A读写一个字符串用2个变量记录元音和辅音的数量即可#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll inf = 0x3f3f3f3f;const ll maxn= 1e5+10;int main(){ int n; cin>>n; while(n--){ string str; cin>>str; int cunt=0; int flag=0

2020-05-31 17:09:50 365

原创 2019/11/23

Increasing by Modulo 解题思路题意就是给一组数据a,给一个m,可以进行这个a[i]=(a[i]+1)%m操作,每个数据一循环可以进行一次。问最少用几次循环可以使这组数据不递减。可以二分这个最小的次数循环,最大的次数是m次(当是m时每个数都可以变成0)。#include<bits/stdc++.h>using namespace std;typedef lo...

2019-11-27 22:10:09 153

原创 Nick and Array

Nick had received an awesome array of integers a=[a1,a2,…,an] as a gift for his 5 birthday from his mother. He was already going to explore its various properties but after unpacking he was disappoint...

2019-11-26 22:13:19 146

原创 Dominated Subarray

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=2e5+10;const int inf=0x3f3f3f3f;int vis[maxn],was[maxn],ww[maxn];int main(){ int T; cin>>T; while(T-...

2019-11-21 21:49:08 200

原创 Traffic

Avin is observing the cars at a crossroads. He finds that there are n cars running in the east-west direction with the i-th car passing the intersection at time ai . There are another m cars running i...

2019-11-14 22:05:29 170

原创 没写完

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e6+10;ll lcm(ll x,ll y){ return (1LL*x*y)/__gcd(x,y);}int main(){ int n,m; cin>>n>>m; ll a[...

2019-11-14 21:59:56 108

原创 数据结构上机实验

第一次实验日期:2019年10月24、25日实验要求: Status initlist(sqlist &L)Status listinsert( sqlist &L, int i, int e )Status listindele( sqlist &L, int i, int &e )Status listinprint( sqlist L...

2019-11-14 12:42:43 2717 2

原创 Budget

Avin’s company has many ongoing projects with different budgets. His company records the budgets using numbers rounded to 3 digits after the decimal place. However, the company is updating the system ...

2019-11-11 21:00:48 223

原创 Crossing River 贪心

A group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the boat back and f...

2019-09-24 23:01:10 258

原创 湫湫系列故事——消灭兔子

湫湫减肥  越减越肥!    最近,减肥失败的湫湫为发泄心中郁闷,在玩一个消灭免子的游戏。  游戏规则很简单,用箭杀死免子即可。  箭是一种消耗品,已知有M种不同类型的箭可以选择,并且每种箭都会对兔子造成伤害,对应的伤害值分别为Di(1 <= i <= M),每种箭需要一定的QQ币购买。  假设每种箭只能使用一次,每只免子也只能被射一次,请计算要消灭地图上的所有兔子最少需要...

2019-09-07 21:02:03 173

原创 Best Cow Line

FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.The contest organ...

2019-09-04 22:14:47 158

原创 Tom爬楼梯

Jerry 跑到了二楼,现在Tom面临的是一个n阶的楼梯,由于Tom的腿比较短,因此它一次只能爬1阶或2阶,机智的Jerry破坏掉了m阶楼梯,也就是说Tom无法踩在这m阶楼梯上,现在Tom想知道他有多少种方案能爬到第n阶楼梯。由于答案很大,输出方案数对109+7取模的结果。输入格式第一行输入一个T代表有T组输入,对于每组输入:第一行输入n,m,第二行输入m个数,第i个数ai代表第ai阶楼梯被...

2019-08-29 17:20:32 156

原创 模板

字符串1.kmp#include<iostream>#include<vector>#include<stdio.h>using namespace std;const int maxn=1e6+10;string s;vector<int> getnxt(string t){ int len= t.size(); vector...

2019-08-19 16:29:35 120

原创 差异的可分割性(整除问题)

现在有n个整数,在这n个数中找出k个数,保证这k个数中任意两个数差的绝对值可以被m整除。Input第一行输入三个整数n,k,m(2<=k<=n<=100000,1<=m<=100000)。第二行包含n个整数a1,a2,…,  an(0 <= ai <= 10^9 )。Output如果不存在这样的k个数,输出"No";否则输出"Yes"后,在下一行...

2019-08-18 16:39:34 199

原创 Steve's Shortest Path(跳跃最短路)

Alex 和 Steve 来到了一个神奇的国度,这个国家有 n 个城市和 m 条道路。这 m 条道路都是双向的,而且这个国家的客车有个特点,每辆客车除出发城市和到达城市外有且仅可经过一个城市。假设u城市到v有一条道路并且 v 到 p 有一条道路,那么客车从 u 出发不能到达 v 但是能到达 p,Steve 和 Alex 在编号为 1 的城市,他们想知道能不能到达编号为 n 的城市,如果能,最少需...

2019-08-17 23:42:28 137

原创 Period(KMP)

For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 ...

2019-08-16 23:16:22 142

原创 Oulipo(KMP&&哈希)

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s’a...

2019-08-16 23:06:00 204

原创 Seek the Name, Seek the Fame(哈希)

The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek th...

2019-08-16 22:13:35 572

原创 Candy Distribution(扩展欧几里得)

Kids like candies, so much that they start beating each other if the candies are not fairly distributed. So on your next party, you better start thinking before you buy the candies.If there are K kid...

2019-08-15 21:55:36 448

原创 吃糖果(鸽巢原理)

HOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input第一行有一个整数T,接下来T组数据,每组数据占2行,第一行是一个整数N(0<N<=1000000),第二行是N个...

2019-08-15 18:00:58 310

原创 How many integers can you find(容斥定理)

Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-integer s...

2019-08-15 17:54:00 416

原创 Teacher Bo(鸽巢原理)

Teacher BoBo is a geography teacher in the school.One day in his class,he marked N points in the map,the i-th point is at (Xi,Yi).He wonders,whether there is a tetrad (A,B,C,D)(A<B,C<D,A≠CorB≠D)...

2019-08-15 17:27:20 233

原创 跳蚤(容斥定理)

Z城市居住着很多只跳蚤。在Z城市周六生活频道有一个娱乐节目。一只跳蚤将被请上一个高空钢丝的正中央。钢丝很长,可以看作是无限长。节目主持人会给该跳蚤发一张卡片。卡片上写有N+1个自然数。其中最后一个是M,而前N个数都不超过M,卡片上允许有相同的数字。跳蚤每次可以从卡片上任意选择一个自然数S,然后向左,或向右跳S个单位长度。而他最终的任务是跳到距离他左边一个单位长度的地方,并捡起位于那里的礼物。比如...

2019-08-15 17:06:56 769

原创 青蛙的约会(扩展欧几里得)

两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,...

2019-08-15 08:56:15 94

原创 Problem A(逆元)

度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到:H(s)=∏i≤len(s)i=1(Si−28) (mod 9973)Si代表 S[i] 字符的 ASCII 码。请帮助度熊计算大字符串中任意一段的哈希值是多少。Input多组测试...

2019-08-14 18:01:54 173

原创 Fansblog(逆元)

Farmer John keeps a website called ‘FansBlog’ .Everyday , there are many people visited this blog.One day, he find the visits has reached P , which is a prime number.He thinks it is a interesting fact...

2019-08-14 17:42:04 187

原创 小L的区间求和(map,)

在给定的一个整数序列中,小L希望找到一个连续的区间,这个区间的和能够被k整除,请你帮小L算一下满足条件的最长的区间长度是多少。输入第一行输入两个整数n、k。(1 <= n <= 105,1<=k<100)接下来一行输入n个整数,表示序列中的数。输出输出一个整数,满足条件区间的最长长度,如果不存在,输出0样例输入5 71 2 4 1 1样例输出3解题思路...

2019-08-13 23:08:17 331

原创 小L的试卷(经典二分)

小L期末考试结束,高高兴兴放假回家了,可是那么多试卷,老师还要加班批改,有n份试卷由k个老师批改,n份试卷进行了密封编号,由于试卷上的做题情况和书写的规范程序不一样,批改不同的试卷用时也可能不一样,每个老师批改试卷的编号顺序是连续的,每位老师批改完分配给自己的试卷就可以离开,问最后离开的老师,最短可能的用时是多少,假定一份试卷让任何一位老师批改用时都是一样的。现在请你设计一种分配方案,使得最后离开...

2019-08-13 22:40:34 86

原创 平行线(set , map)

今天好伤心,以前弄的题没有做出来,现在来分享一下。“大猩猩为什么不喜欢平行线?”“因为平行线没有相交”哈哈哈哈哈哈哈哈哈为了管理动物园不听话的大猩猩们,动物管理员Boctorio 决定去远方的ACM之城找一些平行线,当他逛到一个神奇的店铺时,他发现了一副黑色的图,上面依稀可见一些白色的点。Boctorio 询问店铺老板这幅画是什么,老板说:“天机不可泄露”。等Boctorio仔细端详了一会...

2019-08-13 16:38:41 211

原创 Sum of Consecutive Integers(有些数学思想)

Given an integer N, you have to find the number of ways you can express N as sum of consecutive integers. You have to use at least two integers.For example, N = 15 has three solutions, (1+2+3+4+5), (...

2019-08-12 22:29:11 713

原创 Aladdin and the Flying Carpet(算数基本定理,求和)

It’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a magic...

2019-08-12 21:51:33 108

原创 Smith Numbers(算数基本定理)

While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: ...

2019-08-12 12:49:37 389

原创 Summer Vacation(map)

Problem StatementThere areNone-off jobs available. If you take thei-th job and complete it, you will earn the reward ofBiafterAidays from the day you do it.You can take and complete at mos...

2019-08-11 21:40:21 129

原创 Knight Moves(bfs)

A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboa...

2019-08-11 17:41:48 92

原创 幸运素数

跳皮筋 我第一,马兰开花二十一;二五六 二五七,二八二九三十一;三五六 三五七,三八三九四十一;…童谣《马兰花》作为建国以来最大的数学难题,里面数字的含义困扰了全国人民几十年,并且一直未解难道这些数字真的只是为了押韵生搬硬凑的数字吗?并!不!是!经过wzy的多年研究,他发现了里面潜藏的惊天大秘密(并没有):28=256,而257是离256最近的素数28是第二个完美数,29是离28...

2019-08-11 16:04:55 1603 1

原创 MaratonIME plays Nim(括号配对问题)

Speed down, Colombooo!!!rowing coach, GabiAs common sense tells us, competitive programmers excel at rowing. The olympic lane is a wonderful place to row, run and work out. What few take their time ...

2019-08-11 15:51:31 207

原创 最短路径 输出路径 Dijkstra算法

这个问题难受了半天终于搞懂了,来给分享一下先弄个例子看看;B.wzy的大冒险——出发咯QAQwzy踏上了冒险的旅程。现在他从地精手里买了一份地图,地图上有n个城镇。他从第一个城镇出发,走向(没钱只能走)第n个城镇,现在,请你帮wzy找到一条最短的路径,并倒序(从n到1)输出一条最短路径。地精小提示:路是单向的QAQ。输入格式第一行两个数n,m ,(1≤n≤103,1≤m≤103)...

2019-08-11 09:52:00 1345

原创 阶乘尾零和二分

河南理工大学算法协会暑期集训积分赛(四)C. wzy的大冒险——数学王国单点时限: 2.0 sec内存限制: 512 MBwzy这一次来到了数学王国,加号国王为了考验他,找来了一个数字n,告诉了wzy这个数字的阶乘的末尾零的个数Q,猜错的话就要把wzy赶出去。现在请你帮帮wzy求这个数最小为多少。若不存在输出"impossible"(输出不带引号)。输入格式输入数据包含T组(1≤T≤...

2019-08-10 18:38:24 236

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除