题目传送门

 /*
题意:每一次任选i,j行字符串进行任意长度前缀交换,然后不断重复这个过程,问在过程中,第一行字符串不同的个数
组合数学题:每一列不同的字母都有可能到第一行,所以每列的可能值相乘取模就行了。这题主要坑在题意理解上。。。
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
using namespace std; typedef long long ll;
const int MAXN = 1e2 + ;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + ;
char s[MAXN][MAXN];
int a[MAXN];
map<char, int> cnt[MAXN]; int main(void) //Codeforces Round #108 (Div. 2) C. Pocket Book
{
// freopen ("D.in", "r", stdin); int n, m;
while (scanf ("%d%d", &n, &m) == )
{
memset (a, , sizeof (a));
for (int i=; i<=m; ++i) cnt[i].clear ();
scanf ("%s", s[] + );
for (int i=; i<=n; ++i)
{
scanf ("%s", s[i] + );
} for (int j=; j<=m; ++j)
{
for (int i=; i<=n; ++i)
{
if (cnt[j][s[i][j]] == )
{
cnt[j][s[i][j]] = ; a[j]++;
}
}
} ll ans = ;
for (int i=; i<=m; ++i)
{
ans = (ans * a[i]) % MOD;
}
printf ("%I64d\n", ans);
} return ;
}

组合数学题 Codeforces Round #108 (Div. 2) C. Pocket Book的更多相关文章

  1. Codeforces Round #108 (Div. 2)

    Codeforces Round #108 (Div. 2) C. Pocket Book 题意 给定\(N(N \le 100)\)个字符串,每个字符串长为\(M(M \le 100)\). 每次选 ...

  2. Educational Codeforces Round 108 (Div. 2), C map套vector存储

    地址  Problem - C - Codeforces 题目 题意 一个学校有n个人参加比赛,他们分别属于ui队,每个人的能力值为si 当每个队需要1~n个人的时候,这个学校能参加的人的能力值和最大 ...

  3. Codeforces Round #804 (Div. 2) C(组合 + mex)

    Codeforces Round #804 (Div. 2) C(组合 + mex) 本萌新的第一篇题解qwq 题目链接: 传送门QAQ 题意: 给定一个\(\left [0,n-1 \right ] ...

  4. Codeforces Round #160 (Div. 1) 题解【ABCD】

    Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...

  5. Codeforces Round #257 (Div. 1)A~C(DIV.2-C~E)题解

    今天老师(orz sansirowaltz)让我们做了很久之前的一场Codeforces Round #257 (Div. 1),这里给出A~C的题解,对应DIV2的C~E. A.Jzzhu and ...

  6. CF922 CodeForces Round #461(Div.2)

    CF922 CodeForces Round #461(Div.2) 这场比赛很晚呀 果断滚去睡了 现在来做一下 A CF922 A 翻译: 一开始有一个初始版本的玩具 每次有两种操作: 放一个初始版 ...

  7. Codeforces Round #469 (Div. 2)

    Codeforces Round #469 (Div. 2) 难得的下午场,又掉分了.... Problem A: 怎么暴力怎么写. #include<bits/stdc++.h> #de ...

  8. Codeforces Round #499 (Div. 1)部分题解(B,C,D)

    Codeforces Round #499 (Div. 1) 这场本来想和同学一起打\(\rm virtual\ contest\)的,结果有事耽搁了,之后又陆陆续续写了些,就综合起来发一篇题解. B ...

  9. Codeforces Round #246 (Div. 2) D. Prefixes and Suffixes

                                                        D. Prefixes and Suffixes You have a string s = s ...

随机推荐

  1. 【JZOJ4857】Tourist Attractions(Bitset)

    题意:给定一个n个点的无向图,求这个图中有多少条长度为4的简单路径. n<=1500 思路: #include<map> #include<set> #include&l ...

  2. P1605 迷宫 洛谷

    https://www.luogu.org/problem/show?pid=1605 题目背景 迷宫 [问题描述] 给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过.给定起点坐标和 终点坐 ...

  3. JVM(一):源文件的转变

    JVM(一):源文件的转变 本文讲述一个.java源文件是如何经过javac编译器的一系列操作变为.class文件的. 编译 说到编译,大家都能想到是编译器经过一系列方法将源代码转变为目标机器代码,但 ...

  4. 洛谷 P2237 [USACO14FEB]自动完成Auto-complete

    P2237 [USACO14FEB]自动完成Auto-complete 题目描述 Bessie the cow has a new cell phone and enjoys sending text ...

  5. spring-boot上传文件MultiPartFile获取不到文件问题解决

    1.现象是在spring-boot里加入commons-fileupload jar并且配置了mutilPart的bean,在upload的POST请求后,发现 multipartRequest.ge ...

  6. Centos系统备份

    使用root用户切换到根目录 然后,使用下面的命令备份完整的系统: tar cvpzf backup.tgz / --exclude=/proc --exclude=/lost+found --exc ...

  7. [GraphQL] Query Local and Remote Data in Apollo Link State

    In this lesson, you will learn how to query local and remote data in Apollo Link State in the same c ...

  8. 关于jQuery写插件及其演示

    关于写jQuery插件是非常有必要的.这是前端学习其中必须经过的一个过程 对于初次写插件先想清楚原理       (function($){  $.fn.yourName = function(opt ...

  9. Java算法-奇怪的分式

    题目: 上小学的时候,小明常常自己发明新算法.一次,老师出的题目是: 1/4 乘以 8/5 小明竟然把分子拼接在一起,分母拼接在一起,答案是:18/45 老师刚想批评他.转念一想.这个答案凑巧也对啊, ...

  10. Python3标准库(二) re模块

    正则表达式(Regular Expression)是字符串处理的常用工具,通常被用来检索.替换那些符合某个模式(Pattern)的文本.很多程序设计语言都支持正则表达式,像Perl.Java.C/C+ ...