![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
新手上路
各种题
斯文~
努力搬砖 低调潜水
展开
-
2851: 小A的通勤系列一
http://acm.zzuli.edu.cn/problem.php?id=2851#include<iostream>#include<algorithm>using namespace std;int main(){ int m,h,n,k,d; char c; cin>>h>>c>>m>>n>>d>>k; int t=n/k; if(t*k==n) { int ans=(t-1)原创 2021-11-17 19:56:39 · 191 阅读 · 0 评论 -
2849: 小A的游戏任务系列一
http://acm.zzuli.edu.cn/problem.php?id=2849#include<iostream>#include<algorithm>using namespace std;typedef long long ll;const int N=1e6+10;const int INX=1e9+10;int n,m,d,t,k;int a[N];ll ans;int main(){ ios::sync_with_stdio(false);原创 2021-11-17 19:55:29 · 2428 阅读 · 0 评论 -
2834: 小凯的书架
http://acm.zzuli.edu.cn/problem.php?id=2834应该注意到k大于n的情况#include<iostream>#include<algorithm>#include<cstring>using namespace std;typedef long long ll;const int N=1e5+10;int T,n,k;ll a[N];int main(){ ios::sync_with_stdio(fal原创 2021-11-03 22:51:34 · 293 阅读 · 0 评论 -
Xu Xiake in Henan Province
https://vjudge.net/problem/Gym-102028A刷水题是在浪费生命????#include<iostream>#include<algorithm>using namespace std;int main(){ int T; cin>>T; while(T--) { int a,b,c,d; cin>>a>>b>>c>>d; int sum=0; if(a>原创 2021-10-29 17:17:43 · 364 阅读 · 0 评论 -
2690: 班委竞选
http://acm.zzuli.edu.cn/problem.php?id=2690#include<iostream>using namespace std;const int N=20;struct node{ int id,sum=0;}a[N];int main(){ int n,m,c,t; cin>>n>>m; for(int i=1;i<=n;i++) { cin>>c>>t; if(a[c].原创 2021-10-23 14:51:58 · 98 阅读 · 0 评论 -
ZOJ - 4036 Lucky 7
https://vjudge.net/problem/ZOJ-4036#include<iostream>#include<algorithm>using namespace std;int main(){ int n; cin>>n; while(n--) { int a,b,t; cin>>a>>b; int f=0; for(int i=0;i<a;i++) { cin>>t原创 2021-10-21 18:09:09 · 79 阅读 · 0 评论 -
ZOJ - 4025 King of Karaoke
https://vjudge.net/problem/ZOJ-4025#include<iostream>#include<map>using namespace std;const int N=1e5+10;int h[N];int main(){ int m,n; cin>>m; while(m--) { map<int,int> q; cin>>n; for(int i=0;i<n;i++) sc原创 2021-10-21 17:59:46 · 78 阅读 · 0 评论 -
ZOJ-4024 Peak
https://vjudge.net/problem/ZOJ-4024#include<iostream>#include<algorithm>using namespace std;const int N=1e5+10;int h[N];int main(){ int T,n; cin>>T; while(T--) { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&原创 2021-10-21 17:57:43 · 142 阅读 · 0 评论 -
HDU - 1506 Largest Rectangle in a Histogram
https://vjudge.net/problem/HDU-1506https://www.acwing.com/problem/content/133/#include<iostream>#include<algorithm>using namespace std;const int N=100010;int h[N],q[N],l[N],r[N];typedef long long LL;int main(){ int n; while(cin>&g原创 2021-08-22 21:35:19 · 59 阅读 · 0 评论 -
POJ - 1426 Find The Multiple (BFS、打表)
https://vjudge.net/problem/POJ-1426POJ - 1426 Find The Multiple题目分析AC代码题目Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greate原创 2021-07-20 15:22:38 · 102 阅读 · 0 评论 -
POJ - 3080 Blue Jeans
https://vjudge.net/problem/POJ-3080POJ - 3080 Blue Jeans题目AC代码题目The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was p原创 2021-07-19 16:47:01 · 90 阅读 · 0 评论 -
HDU1870 愚人节的礼物
HDU1870 愚人节的礼物原创 2021-07-12 17:28:16 · 95 阅读 · 0 评论 -
Birthday Cake
Birthday Cake - UVA 10167 - Virtual Judge解析●由题可知,蛋糕上有2n个樱桃。蛋糕是以坐标原点为圆心,半径为100的圆,因此坐标范围为[-100,100]。本题要求 求得一个直线Ax+By=0,使其过原点并均分蛋糕上的草 莓,且不能有草莓在直线上。输出A和B。范围是[-500,500];•数据不是很大可采用枚举法。在[-500, 500]的范围内枚举A和B,将樱桃坐标代入直线方程Ax+By,如果Ax+By大于0,则樱桃在直线上方;小于0,则樱...原创 2021-02-25 22:07:48 · 151 阅读 · 0 评论 -
POJ - 1350 Cabric Number Problem
Cabric Number ProblemIf we input a number formed by 4 digits and these digits are not all of one same value, then it obeys the following law. Let us operate the number in the following way:(1) Arrange the digits in the way from bigger to smaller, such th原创 2021-02-26 14:31:04 · 125 阅读 · 0 评论 -
HDU - 2553 N皇后问题
HDU - 2553 N皇后问题在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample Input1850Sample Output19210方案·深搜+打表AC代原创 2021-03-06 19:30:35 · 94 阅读 · 0 评论 -
第十三届河南省大学生程序设计大赛 题目
原创 2021-05-25 16:58:28 · 176 阅读 · 0 评论 -
问题 B: 反着来
思路既然给出的都是最短路,那么使用floyd算法扫描整个图,不应该出现有新的更短路情况AC代码#include<bits/stdc++.h>using namespace std;int g[110][110];int main(){ int c,t; cin>>c; for(int i=1;i<=c;i++) { int n; memset(g,0,sizeof g); cin>>n; for(int j=1;j<=n;.原创 2021-05-20 16:29:34 · 78 阅读 · 0 评论 -
E - 产生冠军 HDU - 2094
有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。球赛的规则如下:如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。根据这个规则,无需循环较量,或许就能确定冠军。你的任务就是面对一群比赛选手,在经过了若干场撕杀之后,确定是否已经实际上产生了冠军。Input输入含有一些选手群,每群选手都以一个整数n(n<1000)开头,后跟n对选手的比赛结果,比赛结果以一原创 2021-05-18 15:21:23 · 89 阅读 · 0 评论 -
问题 D: 最强单身狗
解析:使用位运算快速向最大值逼近AC代码#include<iostream>#include<algorithm>using namespace std;int main(){ long long t,a,b; scanf("%lld",&t); while(t--) { scanf("%lld %lld",&a,&b); while( (a|(a+1)) <= b) { a=a|(a+1); } pr.原创 2021-05-17 18:03:48 · 61 阅读 · 0 评论 -
Inversion HDU - 4911
AC代码#include<iostream>#include<algorithm>#include<cstring>using namespace std;const int N=1e5+10;typedef long long ll;ll a[N],t[N],ans;void merge_sort(int left,int right){ if(left>=right) return; int mid=(left+ri.原创 2021-05-16 17:44:05 · 67 阅读 · 0 评论 -
I - Problem I (HDU - 2612)
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the countryside, but Merceki’s home is in the center of city. S原创 2021-05-15 17:27:23 · 65 阅读 · 0 评论 -
Turing equation (河南省第七届大学生程序设计竞赛)
题目描述The fight goes on, whether to store numbers starting with their most significant digit or their least significant digit. Sometimes this is also called the “Endian War”. The battleground dates far back into the early days of computer science. J原创 2021-05-10 18:20:43 · 76 阅读 · 0 评论 -
问题 A: 物资调度 (河南省第七届大学生程序设计竞赛)
AC代码#include<bits/stdc++.h>using namespace std;int e[1100];int k,n,m,sum,c=0;void dfs(int i){ if(sum==m) { c++;return; } if(i==n) return; if(sum>m) return; sum+=e[i]; dfs(i+1); sum-=e[i]; dfs(i+1);}int main(){ cin>>k; .原创 2021-05-10 17:57:22 · 80 阅读 · 0 评论 -
五子棋
题目描述五子棋是起源于中国古代的传统黑白棋种之一。现代五子棋日文称之为"连珠",音译为"Renju",英文称之为"Gobang"或"FIR"(Five in a Row的缩写),亦有"连五子"、“五子连”、“串珠”、“五目”、“五目碰”、"五格"等多种称谓。其规则简单,在15*15的棋盘上黑棋先行,其中一方有五枚棋子连成一线即可获胜(这里不考虑专业比赛中的禁手等规则)。不过在很多情况下,当一方出现“活四”,就是四子连在一起,并且两端都可以再放一粒己方的棋子的时候,对方就会主动认输(如图中10,6,12,原创 2021-05-09 19:25:13 · 90 阅读 · 0 评论 -
卡片游戏
题目描述小明最近宅在家里无聊,于是他发明了一种有趣的游戏,游戏道具是N张叠在一起的卡片,每张卡片上都有一个数字,数字的范围是0~9,游戏规则如下: 首先取最上方的卡片放到桌子上,然后每次取最上方的卡片,放到桌子上已有卡片序列的最右边或者最左边。当N张卡片全部都放到桌子上后,桌子上的N张卡片构成了一个数。这个数不能有前导0,也就是说最左边的卡片上的数字不能是0。游戏的目标是使这个数最小。 现在你的任务是帮小明写段程序,求出这个最小数。Input第一行是一个数T,表示有T组测试数据;然后下面有T原创 2021-05-09 19:20:37 · 74 阅读 · 0 评论 -
常用STL
vector有迭代器 可随机访问vector x; int t;x.push_back(t); //把t插入到x的尾部x.pop(); // 删除x的最后一个元素x,empty(); // x是否为空 是返回true 否返回flasex.clear(); //清空xx.size(); //x的长度(元素个数)x.begin(); //返回第一个元素的迭代器x.end(); //返回最后一个元素下一个位置的迭代器即二者是一个前闭后开区间x.f原创 2021-05-07 20:14:56 · 74 阅读 · 0 评论 -
问题 A: 序号互换
题目描述Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来。单元格的行坐标是由数字编号的数字序号,而列坐标使用字母序号。观察字母序号,发现第1列到第26列的字母序号分别为A,B,…,Z,接着,第27列序号为AA,第28列为AB,依此类推。若给Dr.Kong的机器人卡多一个数字序号(比如32),它能很快算出等价的字母序号(即AF),若给机器人一个字母序号(比如AA)),它也能很快算出等价的数字序号(27),你能不能与卡多比试比试,看谁能算得更快更准确。输入第一行: N原创 2021-05-07 19:12:39 · 60 阅读 · 0 评论 -
问题 C: 表达式求值 (第四届河南省大学生程序设计竞赛)
题目描述Dr.Kong设计的机器人卡多掌握了加减法运算以后,最近又学会了一些简单的函数求值,比如,它知道函数min(20,23)的值是20 ,add(10,98) 的值是108等等。经过训练,Dr.Kong设计的机器人卡多甚至会计算一种嵌套的更复杂的表达式。假设表达式可以简单定义为:一个正的十进制数 x 是一个表达式。如果 x 和 y 是 表达式,则 函数min(x,y )也是表达式,其值为x,y 中的最小数。如果 x 和 y 是 表达式,则 函数max(x,y )也是表达式,其值为x原创 2021-05-07 17:57:43 · 138 阅读 · 0 评论 -
问题 F: SUBSTRING
题目描述You are given a string input. You are to find the longest substring of input such that the reversal of thesubstring is also a substring of input. In case of a tie, return the string that occurs earliest in input.Note well: The substring and its reve原创 2021-05-07 16:32:02 · 101 阅读 · 0 评论 -
问题 C: 试 制 品
题目描述ZZ大学的Dr.Kong最近发现实验室的很多试制品都已经用完。由于项目经费有限,为了节省,Dr.Kong决定利用实验室现有的试制品来生成所缺的试制品。为此,Dr.Kong连续几天通宵达旦整理出一份研究资料并让研究生Bill去实验并统计能产生多少种所缺的试制品。Bill从头到尾翻完所有的资料,发现资料上写满了一大堆的化学方程式,上面除了大小写英文字母、数字、加号、等号外,再也没有其他的符号了。其中,每个方程式都是A1+A2+……+Ap=B1+B2+……+Bq的形式, 表示试制品A1,A2,……和A原创 2021-05-07 15:08:30 · 86 阅读 · 0 评论 -
问题 F: Card Trick
题目描述The magician shuffles a small pack of cards, holds it face down and performs the following procedure:The top card is moved to the bottom of the pack. The new top card is dealt face up onto the table. It is the Ace of Spades.Two cards are moved o原创 2021-05-06 20:38:21 · 87 阅读 · 0 评论 -
HDU - 1263 水果
题目描述夏天来了好开心啊,呵呵,好多好多水果Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了.Input第一行正整数N(0<N<=10)表示有N组测试数据.每组测试数据的第一行是一个整数M(0<M<=100),表示工有M次成功的交易.其后有M行数据,每行表示一次交易,由水果名称(小写字母组成,长度不超过80),水果产地(小写字母组成,长度不超过80)和交易的水果数目(正原创 2021-05-06 20:37:10 · 98 阅读 · 0 评论 -
L2-4 哲哲打游戏 (25 分)
题目描述哲哲是一位硬核游戏玩家。最近一款名叫《达诺达诺》的新游戏刚刚上市,哲哲自然要快速攻略游戏,守护硬核游戏玩家的一切!为简化模型,我们不妨假设游戏有 N 个剧情点,通过游戏里不同的操作或选择可以从某个剧情点去往另外一个剧情点。此外,游戏还设置了一些存档,在某个剧情点可以将玩家的游戏进度保存在一个档位上,读取存档后可以回到剧情点,重新进行操作或者选择,到达不同的剧情点。为了追踪硬核游戏玩家哲哲的攻略进度,你打算写一个程序来完成这个工作。假设你已经知道了游戏的全部剧情点和流程,以及哲哲的游戏操作,请你原创 2021-05-03 20:02:29 · 227 阅读 · 0 评论 -
L2-1 包装机 (2021天梯赛)
题目描述一种自动包装机的结构如图 1 所示。首先机器中有 N 条轨道,放置了一些物品。轨道下面有一个筐。当某条轨道的按钮被按下时,活塞向左推动,将轨道尽头的一件物品推落筐中。当 0 号按钮被按下时,机械手将抓取筐顶部的一件物品,放到流水线上。图 2 显示了顺序按下按钮 3、2、3、0、1、2、0 后包装机的状态。图1 自动包装机的结构图 2 顺序按下按钮 3、2、3、0、1、2、0 后包装机的状态一种特殊情况是,因为筐的容量是有限的,当筐已经满了,但仍然有某条轨道的按钮被按下时,系统应强制启动原创 2021-05-03 19:50:07 · 426 阅读 · 0 评论 -
问题 F. Distribution
题目描述One day , Wang and Dong in the Dubai desert expedition, discovered an ancient castle. Fortunately, they found a map of the castle.The map marks the location of treasures.They agreed to distribute the treasures according to the following rules:Wang dr原创 2021-05-03 17:56:25 · 59 阅读 · 0 评论 -
问题 G. Interference Signal
题目描述Dr.Kong’s laboratory monitor some interference signals. The interference signals can be digitized into a series of positive integer. May be, there are N integers a1,a2,…,an.Dr.Kong wants to know the average strength of a contiguous interference signa原创 2021-05-03 17:36:08 · 76 阅读 · 0 评论 -
问题 B.最大岛屿
题目描述神秘的海洋,惊险的探险之路,打捞海底宝藏,激烈的海战,海盗劫富等等。加勒比海盗,你知道吧?杰克船长驾驶着自己的的战船黑珍珠1号要征服各个海岛的海盜,最后成为海盗王。 这是一个由海洋、岛屿和海盗组成的危险世界。面对危险重重的海洋与诡谲的对手,如何凭借智慧与运气,建立起一个强大的海盗帝国。杰克船长手头有一张整个海域的海图,上面密密麻麻分布着各个海屿的位置及面积。他想尽快知道整个海域共有多少岛屿以及最大岛屿的面积。【约束条件】①若一个陆地八个方向之一(上、下、左、右、左上、右上、左下、右下)的位原创 2021-05-03 17:06:11 · 46 阅读 · 0 评论 -
二进制中1的个数 (位运算)
题目:https://www.acwing.com/problem/content/description/25/输入一个 32 位整数,输出该数二进制表示中 1 的个数。注意:负数在计算机中用其绝对值的补码来表示。样例1输入:9输出:2解释:9的二进制表示是1001,一共有2个1。样例2输入:-2输出:31解释:-2在计算机里会被表示成11111111111111111111111111111110,一共有31个1。代码class Solution {public:原创 2021-04-16 17:26:36 · 119 阅读 · 0 评论 -
试题 历届试题 回文日期
代码#include<stdio.h>int main(){ int n,i; int y,m,d,f,lc,lb; char a[8],b[8],c[8]; int x[13][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}}; scanf("%d",&n); n++; while(1) { sprintf(a,"%d",n); ss.原创 2021-04-16 15:34:45 · 73 阅读 · 0 评论 -
鬼谷子的钱袋
题目描述鬼谷子非常聪明,正因为这样,他非常繁忙,经常有各诸侯车的特派员前来向他咨询时政。有一天,他在咸阳游历的时候,朋友告诉他在咸阳最大的拍卖行(聚宝商行)将要举行一场拍卖会,其中有一件宝物引起了他极大的兴趣,那就是无 字天书。但是,他的行程安排得很满,他他已经买好了去邯郸的长途马车标,不 巧的是出发时间是在拍卖会快要结束的时候。于是,他决定事先做好准备,将自 己的金币数好并用一个个的小钱袋装好,以便在他现有金币的支付能力下,任何数目的金币他都能用这些封闭好的小钱的组合来付账。鬼谷子也是一个非常节俭的人,原创 2021-04-16 15:27:46 · 136 阅读 · 0 评论