地址: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阅读
主要利用next数组O(n)时间遍历字符串,计算当前以i结尾的字符串有几个和要求字符串匹配的#include#includechar s[100100];
原创
2023-09-15 09:37:51
69阅读
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评论
个人博客链接:题目链接http://codeforces.com/contest/1328/problem/A题意ttt组数据,每次给你两个数a,b(1
原创
2022-09-23 10:47:20
55阅读
主要的思路就是将这个题目转换一下去求。题目上面说,雷达只会在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评论
主要的思路就是将这个题目转换一下去求。题目上面说,雷达只会在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阅读
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阅读
UVA 1328 - Period
题意:给定一个字符串,求出有几个位置的前缀串是由个数大于1的串循环得到的。求出位置和循环次数
思路:利用kmp的next数组的性质,i - next[i]就是循环长度,然后推断一下是不是正好是倍数就可以
代码:#include <cstdio>#include <cstring>const int N = 1000005;int n
原创
2022-01-12 11:44:34
48阅读
一、内容假定海岸线是无限长的直线。陆地位于海岸线的一侧,海洋位于另一侧。每个小岛是位于海洋中的一个点。对于任何一个雷达的安装 (均位于海岸线上),只能覆盖 d 距离,因此海洋中的小岛被雷达安装所覆盖的条件是两者间的距离不超过 d 。我们使用卡笛尔坐标系,将海岸线定义为 x 轴。海洋的一侧位于 x 轴上方,陆地的一侧位于下方。给定海洋中每个小岛的位置,并给定雷达安装的覆盖距离,您的任务是写一个...
原创
2022-02-03 10:03:09
187阅读
个人博客链接:https://blog.nuoyanli.com/2020/03/27/cf1328d/题目链接http://codeforces.com/contest/1328/problem
原创
2022-09-23 10:46:58
34阅读
个人博客链接:https://blog.nuoyanli.com/2020/03/27/cf1328c/题目链接http://codeforces.com/contest/1
原创
2022-09-23 10:47:16
44阅读
Radar InstallationTime Limit: 1000MS Memory Limit: 10000KTotal Sg is an infinite straight line. Land
原创
2022-11-18 16:11:12
61阅读