地址:http://acm.hdu.edu.cn/showproblem.php?pid=1328题意:输入一个字符串,没个字符后移1位后输出。代码:# include <stdio.h>int main (){ int T, i, nCase = 1 ; char str[55] ; scanf ("%d", &T) ; while (T--) { scanf ("%s", str) ; for(i = 0 ; str[i] ; i++) str[i] = (str[i]-'A'+1)%26+'A'
转载
2012-02-16 10:08:00
26阅读
1 2 //坐标精度是int 3 /* 4 圆心位于 5 */ 6 #include <iostream> 7 #include <cstdlib> 8 #include <cstring> 9 #include <cmath>10 using namespace std; 11 12 const int N = 1005;13 typedef struct Part 14 {15 int a, b;16 };17 Part q[N];18 19 typedef struct Node 20 {21 int left, right;22 };23
转载
2013-04-13 23:22:00
57阅读
2评论
主要利用next数组O(n)时间遍历字符串,计算当前以i结尾的字符串有几个和要求字符串匹配的#include#includechar s[100100];
原创
2023-09-15 09:37:51
69阅读
个人博客链接:题目链接http://codeforces.com/contest/1328/problem/A题意ttt组数据,每次给你两个数a,b(1
原创
2022-09-23 10:47:20
55阅读
主要的思路就是将这个题目转换一下去求。题目上面说,雷达只会在x轴上面,那么我们就可以去算一下大致的几种情况:第一种,雷达全面覆盖的到。那么转换一下思路。第二种,存在几个特殊的,比较高的位置,雷达无法覆盖,就是雷达最高为m,但是他的位置高度超过了m,所以直接输出-1.思路就是我们可以把每一个点转换一下,看成一个圆,去思考一下。如果点可以被覆盖的到,那么圆与x轴就会相交或者相切,以半径为雷...
原创
2021-07-13 14:29:10
48阅读
1 class Solution:
2 def breakPalindrome(self, palindrome: str) -> str:
3 n = len(palindrome)
4 if n <= 1:
5 return ''
6 half = n // 2
7 su
转载
2020-01-26 05:12:00
17阅读
KMP算法求循环节
转载
2016-05-09 23:47:00
55阅读
2评论
#include #include #include struct location { double x; double y; bool processed;};struct locationValidXRange { double begin; double end;};bool locationCanR
原创
2023-05-23 15:58:03
30阅读
贪心,区间排序如果区间包含 略过,否则答案+1;Program P1328;var n,d,i,j,k,ans:longint; x:double; tag:boolean; map:array[1..1000,1..2] of double;procedure qsort(l,r:longint);var i,j:longint;
原创
2012-08-16 22:11:26
61阅读
主要的思路就是将这个题目转换一下去求。题目上面说,雷达只会在x轴上面,那么我们就可以去算一下大致的几种情况:第一种,雷达全面覆盖的到。那么转换一下思路。第二种,存在几个特殊的,比较高的位置,雷达无法覆盖,就是雷达最高为m,但是他的位置高度超过了
原创
2022-03-10 16:10:28
19阅读
#include<iostream> #include<cmath> #include<algorithm> using namespace std; int main(){ int n,d,kase=1,r; double p[1005][2],island[1005][2]; while(cin ...
转载
2021-07-27 20:28:00
179阅读
2评论
Radar InstallationTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 51377Accepted: 11527 思路 : 每一个岛都在X轴上有一个区间能够被雷达覆盖,x1
转载
2015-02-26 09:46:00
96阅读
2评论
#include <iostream>#include <math.h>#include<algorithm>using namespace std;struct seg { double left;double right; bool operator<(const seg& a)const { return left<a.left; }}range[1001];int main(){ int n,d,i,t=1;double x,y;bool tag; while(cin>>n>>d) { if(n==0&am
转载
2011-07-18 11:18:00
104阅读
2评论
点击打
原创
2022-06-15 21:52:51
155阅读
把每个岛转换成区间。然后对区间排序。选择区间最右点为站点。最初一直wrong,是因为我排序的方式不对。应该按最后点排序。而不是区间的第一个点。#include#include#include#include#include#includeusing namespace std;pair p[10000+10];bool cmp(const pair &p1,const
原创
2022-08-05 16:00:05
16阅读
in(2∗109,n⋅(n−1)2))n,k(3 \leq n \leq 10^5,1\leq k \leq min(2*10^9,\frac{n⋅(n−1)}{2}))n,k(3≤n≤105,1≤k≤min(2∗109,2n⋅(n...
原创
2022-09-23 10:55:32
40阅读
题意:假设海岸线是一条无限延伸的直线。陆地在海岸线的一侧,而海洋在另一侧。每一个小的岛屿是海洋上的一个点。雷达坐落于海岸线上,只能覆盖d距离,所以如果小岛能够被覆盖到的话,它们之间的距离最多为d。 题目要求计算出能够覆盖给出的所有岛屿的最少雷达数目。 /* 对于每个小岛,按照横坐标从小到大排序,并且
转载
2016-07-06 11:01:00
113阅读
2评论
#include
#include
#include
using namespace std;
int n,d,ans;
struct point
{ int x,y;
}p[1010];
bool operator temp) t=temp; else if(p[i].y*p[i].y+(t-p[i].x)*(t-p[i].x)>n>>d && (n||d)) {ok=1; for(i=0;i>p[i].x>>p[i].y; if(p[i].y>d) ok=0; } ...
转载
2013-05-18 19:41:00
39阅读
2评论
Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating
转载
2017-09-09 15:32:00
46阅读
2评论
【题目链接】 http://poj.org/problem?id=1328 【算法】 每个雷达都位于笛卡尔坐标系的x轴上,因此,对于每个岛屿,我们都可以用勾股定理算出它的有效管辖区域 那么,问题就被转化成了 : 给定若干个区间,要求每个区间内都要有一个点,最小化点的个数 我们将这些区间按左端点排序,
转载
2018-06-28 14:13:00
162阅读
2评论