CodeForces 152C Pocket Book(找规律+哈希)
来源:互联网 发布:js 提交表单 jquery 编辑:程序博客网 时间:2024/06/06 03:29
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i < j ≤ n, 1 ≤ k ≤ m), then he took names number i and j and swapped their prefixes of length k. For example, if we take names "CBDAD" and "AABRD" and swap their prefixes with the length of 3, the result will be names "AABAD" and "CBDRD".
You wonder how many different names Vasya can write instead of name number 1, if Vasya is allowed to perform any number of the described actions. As Vasya performs each action, he chooses numbers i, j, k independently from the previous moves and his choice is based entirely on his will. The sought number can be very large, so you should only find it modulo 1000000007 (109 + 7).
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
2 3AABBAA
4
4 5ABABABCGDGAAAAAYABSA
216
In the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
题解:
找规律不难发现每一列的字母种数相乘就是答案,要用哈希
- CodeForces 152C Pocket Book(找规律+哈希)
- CodeForces 152C Pocket Book
- Codeforces 152C Pocket Book 思维
- CodeForces 631C Report(找规律)
- codeforces 24C 找规律
- Codeforce-152C-Pocket Book(排列组合+思维)
- code forces 152C Pocket Book
- Codeforces Round #264 (Div. 2)C(找规律)
- codeforces 560C Gerald's Hexagon(找规律)
- Codeforces - 337C(div2) - Harmony Analysis(找规律)
- CodeForces - 368C Sereja and Algorithm (找规律&模拟)
- CodeForces - 584C Marina and Vasya (模拟)找规律
- codeforces-57C Array(找规律+逆元)
- CodeForces 337C Quiz(1等比数列找规律)
- CodeForces - 202C Clear Symmetry (预处理模拟+找规律)
- Codeforces 520C. DNA Alignment 找规律
- CodeForces 337C 找规律 ,等比数列求和
- codeforces-141【B找规律】【C思维】
- python环境搭建
- 解决:QWidget: Must construct a QApplication before a QWidget
- android屏幕分辨率
- 1039. 到底买不买(20)
- Win7下搭建FTP服务器,实现文件共享
- CodeForces 152C Pocket Book(找规律+哈希)
- Linux flash 文件系统剖析
- 关于Flask的request属性
- tensorflow(6) mnist.train.next_batch()函数解析
- kinect v2 + gpd + ubuntu 14.04.5
- spring boot activeMQ 配置
- event-bus
- 【lightoj1028】求因子个数
- react中使用switch-case语句