当前位置:网站首页>[training day15] good name [hash]
[training day15] good name [hash]
2022-07-25 22:30:00 【VL——MOESR】

Ideas :
Direct one hash Just judge whether it appears
c o d e code code
#include<iostream>
#include<cstdio>
#include<cstring>
typedef unsigned long long ull;
using namespace std;
ull pow[400010], has[400010], mod = 127;
char s[400010];
int main() {
scanf("%s", s + 1);
int n = strlen(s + 1);
pow[0] = 1;
for(int i = 1; i <= n; i ++) pow[i] = pow[i - 1] * mod, has[i] = has[i - 1] * mod + ull(s[i] - 'A' + 1);
for(int i = 1; i <= n; i ++) {
ull ha = has[n] - has[n - i] * pow[i];
if(ha == has[i] && ha != 0) printf("%d ", i);
}
return 0;
}
边栏推荐
猜你喜欢

JVM内存区域

【集训DAY13】Out race【数学】【动态规划】

谷歌分析UA怎么转最新版GA4最方便

H5幸运刮刮乐抽奖 免公众号+直运营

Perform Jieba word segmentation on the required content and output EXCEL documents according to word frequency

Pyspark data analysis basis: pyspark.sql.sparksession class method explanation and operation + code display

【集训DAY12】树!树!树!【贪心】【最小生成树】

Xiaobai programmer's seventh day

Build commercial projects based on ruoyi framework

Data quality: the core of data governance
随机推荐
vim用法记录
[leetcode] 502.ipo (difficult)
How to call the size of two numbers with a function--- Xiao Tang
IPv4地址已经完全耗尽,互联网还能正常运转,NAT是最大功臣!
【集训DAY12】Bee GO!【动态规划】【数学】
Method of converting MAPGIS format to ArcGIS
About vscode usage+ Solutions to the problem of tab failure
【Leetcode】502.IPO(困难)
【C语法】void*浅说
力扣解法汇总919-完全二叉树插入器
Xiaobai programmer's fourth day
完啦,上班三个月,变秃了
Minor GC 和 Full GC 有什么不同呢?
Today, I sorted out some problems about high collapse
What is the difference between minor GC and full GC?
Recursive case -c
Gan, why '𠮷 𠮷'.Length== 3 ??
3dslicer import cone beam CT image
Data type conversion
arcgis开发常用源码