POJ1059Glass Beads】的更多相关文章

Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was not interested in the crowds. Her big hobby were beads of any kind. Many bead makers were working fo…
Necklace of Beads Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1817 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 40 ). If…
题目: You have a necklace of N red, white, or blue beads (3<=N<=350) some of which are red, others blue, and others white, arranged at random. Here are two examples for n=29: 1 2 1 2 r b b r b r r b r b b b r r b r r r w r b r w w b b r r b b b b b b…
Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the axis of symmetry ar…
Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7763   Accepted: 3247 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are pro…
  Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the axis of symmetry are…
Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7874   Accepted: 3290 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are pro…
Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7451   Accepted: 3102 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are pro…
Glass Beads Time Limit: 3000MS   Memory Limit: 10000K Total Submissions: 4314   Accepted: 2448 Description Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But s…
Time Limit: 3000MS   Memory Limit: 10000K Total Submissions: 4901   Accepted: 2765 Description Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was not i…
Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the axis of symmetry are all neglec…
[POJ1509]Glass Beads [题目描述]给定字符串S,并规定首尾相连成环,求出最小字典序. [输入]输入有多个数据,第一行只包括正整数N,表示有N组数据.每个数据包括一行,输入该字符串. [输出]对于每个数据,输出一行数据表示从哪一个字母开始为最小字典序排列. [题解思路]暴力是个好东西,咳咳咳 该题为赤果果的最小表示. Q:最小表示是什么? A:看题目描述撒. Q:怎么个表示法呢? A:莫急,往下看哈. 还是从暴力开始讲:依次比较n个以不同位置字符开头的字符串,找到其中字典序最小…
2081: [Poi2010]Beads Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1003  Solved: 334[Submit][Status][Discuss] Description Zxl有一次决定制造一条项链,她以非常便宜的价格买了一长条鲜艳的珊瑚珠子,她现在也有一个机器,能把这条珠子切成很多块(子串),每块有k(k>0)个珠子,如果这条珠子的长度不是k的倍数,最后一块小于k的就不要拉(nc真浪费),保证珠子的长度为正整数. Z…
Necklace of Beads 大意:3种颜色的珠子,n个串在一起,旋转变换跟反转变换假设同样就算是同一种,问会有多少种不同的组合. 思路:正规学Polya的第一道题,在楠神的带领下,理解的还算挺快的.代码没什么好说的,裸的Polya.也不须要优化. /************************************************************************* > File Name: POJ1286.cpp > Author: GLSilence &…
Necklace of Beads Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 630    Accepted Submission(s): 232 Problem Description Beads of red, blue or green colors are connected together into a circular…
Glass Beadshttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1006 Time Limit: 2 Seconds      Memory Limit: 65536 KB Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the peopl…
Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8263   Accepted: 3452 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation…
Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9359   Accepted: 3862 Description Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation…
[BZOJ2081][Poi2010]Beads Description Zxl有一次决定制造一条项链,她以非常便宜的价格买了一长条鲜艳的珊瑚珠子,她现在也有一个机器,能把这条珠子切成很多块(子串),每块有k(k>0)个珠子,如果这条珠子的长度不是k的倍数,最后一块小于k的就不要拉(nc真浪费),保证珠子的长度为正整数. Zxl喜欢多样的项链,为她应该怎样选择数字k来尽可能得到更多的不同的子串感到好奇,子串都是可以反转的,换句话说,子串(1,2,3)和(3,2,1)是一样的.写一个程序,为Zxl…
2123. [HZOI 2015] Glass Beads ★★★   输入文件:MinRepresentations.in   输出文件:MinRepresentations.out   简单对比时间限制:1 s   内存限制:1024 MB [题目描述] 给定长度为n(n<=300000)的循环同构的字符串,定义最小表示为该字符串的字典序最小的同构表示,请输出这个表示. [输入格式] 第一行是串的长度,第二行是字符串. [输出格式] 串的最小表示. [样例输入] 10 helloworld…
Beads 题目描述 Zxl有一次决定制造一条项链,她以非常便宜的价格买了一长条鲜艳的珊瑚珠子,她现在也有一个机器,能把这条珠子切成很多块(子串),每块有k(k>0)个珠子,如果这条珠子的长度不是k的倍数,最后一块小于k的就不要拉(nc真浪费),保证珠子的长度为正整数. Zxl喜欢多样的项链,为她应该怎样选择数字k来尽可能得到更多的不同的子串感到好奇,子串都是可以反转的,换句话说,子串(1,2,3)和 (3,2,1)是一样的. 写一个程序,为Zxl决定最适合的k从而获得最多不同的子串. 例如:…
SPOJ BEADS 给一个字符串(环) 问从哪个字符开始,字典序最小. 可以脑补到很多线性的解法,不过以下这个是最简单的,代码非常简单,就不解释了. #include<iostream> #include<cstdio> #include<cstdlib> #include<string.h> #include<cmath> using namespace std; int smallestRepresation(string& s)…
Glass Beads Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 554564-bit integer IO format: %lld      Java class name: Main   Once upon a time there was a famous actress. As you may expect, she played most…
Necklace of Beads Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1049    Accepted Submission(s): 378 Problem Description Beads of red, blue or green colors are connected together into a circula…
Description 问把n截成每个长度后不同子串个数. Sol 调和极数+Hash. 首先这是一个式子 \(n\sum_{i=1}^n \frac {1}{i}\) . 这东西就是调和极数再乘上 \(n\) ,他趋近于\(nlnn\) 正反哈希一下. Code /************************************************************** Problem: 2081 User: BeiYu Language: C++ Result: Accep…
Description 求字符串的最小循环表示. Sol SAM. 把原串复制一遍,建出SAM,然后每次选最小的一个跑 \(len\) 次,这就是最小循环表示的最后一个节点,然后 \(x-len+1\) 即为答案. Code #include<cstdio> #include<cstring> #include<iostream> using namespace std; const int N = 20005; int n,rt,lst,cnt,l; int s[N]…
这是做的第一道群论题,自然要很水又很裸.注意用long long. 就是用到了两个定理 burnside :不等价方案数=每个置换的不动置换方案数的和 / 置换个数 polya: 一个置换的不动置换方案数=k^(这个置换的循环个数) 先看第一个博客再看第二个 http://cxjyxx.me/?p=198 http://endlesscount.blog.163.com/blog/static/82119787201221324524202/ 这两个蛮好的,上代码: #include <cstd…
题意:求一个字符串的最小表示的开始下标 就当模板题写了 把字符串重复一遍,再建后缀自动机,贪心的选最小字典序在上面走len步 因为走出来的一定是子串,长度又是len,所以一定是原来的字符串旋转得到的,就解决了 const maxn=; type node=record go:..]of longint; step,fa:longint; end; var sam:..maxn]of node; s,ans:ansistring; len,tot,last,t:longint; procedure…
链接 这个东东是新知识 let's 从头学起吧 这篇文库讲的不错 至少把各种概念学了一遍 然后再看此题 共有两种类型的置换 一种是旋转之后相同算一种 一种是翻转之后相同算一种 对于旋转 共有N次置换 转1下到转N下 对于每一次的循环节  各大牛给出了结论 为gcd(n,i) 这个我也不会证  姑且记住吧 对于翻转 这个从图中可以看出来 找对称轴 分2种情况 if n%2==0 也分两种情况 若以两个相对的珠子为对称轴 那循环节为(n-2)/2+2 若以 其它不含珠子的线为对称轴 循环节为n/2…
题目:http://poj.org/problem?id=2409 题意:用k种不同的颜色给长度为n的项链染色 网上大神的题解: 1.旋转置换:一个有n个旋转置换,依次为旋转0,1,2,```n-1.对每一个旋转置换,它循环分解之后得到的循环因子个数为gcd(n,i). 2.翻转置换:分奇偶讨论. 奇数的时候 翻转轴 = (顶点+对边终点的连线),一共有n个顶点,故有n个置换,且每个置换分解之后的因子个数为n/2+1; 偶数的时候 翻转轴 = (顶点+顶点的连线),一共有n个顶点,故有n/2个置…