题目: To encourage visitors active movement among the attractions, a circular path with ice cream stands was built in the park some time ago. A discount system common for all stands was also introduced. When a customer buys ice cream at some stand, he…
题目&题意: 倒着找处于最后位置的等差数列的开头的位置. 例: 1 5 3 4 5 6 3 4 5 6是等差数列,它的开头的位置是3 PS: 读题真的很重要!!!!多组输入,上来就读错了!! 代码: #include <bits/stdc++.h> #define inf 0x3f3f3f3f #define FRE() freopen("in.txt","r",stdin) using namespace std; typedef long l…
题目&题意:(有点难读...) 给出一个数字序列,找出一个区间,当删除这个区间中的两个相同的数字后,只保留这两个数字之间的序列,然后继续删除相同的数字,问最多可以实行多少次删除操作. 例如: 所以执行两次删除操作. 思路: 区间dp,关键在于确定大的区间是由哪些小的区间转化来的. 当a[l] == a[r]的时候,dp[l][r] = dp[l+1][r-1]+1(因为要得到最多的删除次数,大的区间的次数在相等的情况下肯定是由内部小的区间加一得来的): 当a[l] != a[r]的时候,dp[l…
题目: https://cn.vjudge.net/problem/1451310/origin 题意&思路: 纯粹模拟. 大体题意是这样的: 1.有人要在一个10-9<=x<=109,10-9<=y<=109,这么大的一张纸上去画图,而我们只需要打印输出最大为0<=x<=100,0<=y<=100范围内的图案就ok了. 2.如果s==0的话就在给出的坐标处画一个“_o_”( ASCII codes 95, 111, 95)的图案,表示a tree…
题目:链接 思路: 多画出几个情况就可以找出规律来了 Knight (当大于2的时候只要两种颜色相间出现就可以了) King(当大于等于3的时候,总可以用四种形式来补色,具体如下)  Bishop(斜率为一的斜着的一行要不能相同,那只能是一列一个颜色了) Rook(要想水平竖直的颜色不一样,那只能是斜着的一行的颜色是一样的) 代码: #include <bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; typedef long…
题目: The cascade of water slides has been installed in the park recently and it has to be tested. The cascade consists of some number of reservoirs, or “ponds” for short, which are linked into a single sequence connected by water slides. Visitors are…
题目: The park management finally decided to install some popular boxing machines at various strategic places in the park. In fact, to compensate for the previous lack of machines, they decided to install as many machines as possible. Surprisingly enou…
被一道数位DP折磨得欲仙欲死之后,再做这道题真是如同吃了ice cream一样舒畅啊 #include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<=b;++i) #define ms(arr,a) memset(arr,a,sizeof arr) #define debug(x) cout<<"< "#x" = "<<x&l…
题目:题目链接 思路:比赛中读错了题,题目要求选一个连续区间,却读成了随便选取几个柜台,英语要好好学啊,读懂题就很简单了,扫一遍就出结果了 AC代码: #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <algorithm> #include <cstring> #include <vector> #incl…
题目大意: 给定n k 接下来n行 给定n个摊位的冰淇淋信息 首先给一个t 表示这个摊位有t个冰淇淋 接下来t个数表示对应冰淇淋的品种 走到连续的几个摊位 会买下走过的摊位的所有的冰淇淋 求 要买下所有k个品种的冰淇淋 最少需要买下多少冰淇淋 尺取法 L R指针移动 表示走过L~R的摊位 利用cnt[]记录品种信息 #include <bits/stdc++.h> using namespace std; #define LL long long #define INF 0x3f3f3f3f…