这场并没有做,做的赛后的,太晚了时间,中午做了两题,稍微贴一下,剩余的题目本周争取补完

A题:

链接:http://codeforces.com/contest/554/problem/A

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;
string s;
int main()
{
while(cin>>s)
{
int n=s.length();
cout<<n*+<<endl;
}
return ;
}

B题:

链接:http://codeforces.com/contest/554/problem/B

其实就是判相等的行数

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=;
string s[maxn];
int main()
{
int n;
while(cin>>n)
{
for(int i=;i<n;i++)
cin>>s[i];
int mx=;
int cnt;
for(int i=;i<n;i++)
{
cnt=;
for(int j=;j<n;j++) //找到一样的行就行了
if(s[i]==s[j])
cnt++;
if(cnt>mx)
mx=cnt;
}
cout<<mx<<endl;
}
return ;
}

剩余的题目本周末一定争取补完

继续补题中,今天补得是C题,这题非常有意思,经典的组合计数,很有数学的味道,开始完全没思路,后来跟王远立和李大神讨论,王远立给我了思路,启发了我,之后晚上又参看了一下题解,终于A了,还学会了求组合数一个比较好的办法,不用阶乘,用公式:,非常好

题目链接:http://codeforces.com/contest/554/problem/C

贴一下神牛的思路,非常清晰易懂:http://blog.csdn.net/libin56842/article/details/46650209

非常好的插空法

下面是我的代码:

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<stack>
#define mod 1000000007
using namespace std;
const int maxn=+;
int a[maxn];
long long dp[maxn][maxn];
void pre() //很好的求组合数的方法
{
dp[][]=;
for(int i=;i<maxn;i++)
{
dp[i][i]=;
dp[i][]=;
for(int j=;j<i;j++)
dp[i][j]=(dp[i-][j]+dp[i-][j-])%mod;
}
}
int main()
{
int k;
pre();
while(cin>>k)
{
int total=;
for(int i=;i<k;i++)
{
cin>>a[i];
total+=a[i];
}
long long res=;
for(int i=k-;i>;i--)
{
res*=dp[total-][a[i]-];
res%=mod;
total-=a[i];
}
cout<<res<<endl;
}
return ;
}

D题明天在补,这次争取尝试尝试D

D题:

链接:http://codeforces.com/problemset/problem/553/B

先来说说题意吧,就是有一串数p[n],然后1到n分别映射到p[1]到p[n],比如:p = [4, 1, 6, 2, 5, 3]得到(142)(36)(5), 1被4代表, 4被2代表, 2被1代表, 3和6互换,  5保持原来位置不变。然后进行循环左移,将每个周期排序,在将周期之间的第一个元素排序排序,得到如下:(421)(5)(63)。然后求最终变化之后跟原来序列相同的,并且第k种排列

codeforces #309 DIV2的更多相关文章

  1. Codeforces #180 div2 C Parity Game

    // Codeforces #180 div2 C Parity Game // // 这个问题的意思被摄物体没有解释 // // 这个主题是如此的狠一点(对我来说,),不多说了这 // // 解决问 ...

  2. Codeforces #541 (Div2) - E. String Multiplication(动态规划)

    Problem   Codeforces #541 (Div2) - E. String Multiplication Time Limit: 2000 mSec Problem Descriptio ...

  3. Codeforces #541 (Div2) - F. Asya And Kittens(并查集+链表)

    Problem   Codeforces #541 (Div2) - F. Asya And Kittens Time Limit: 2000 mSec Problem Description Inp ...

  4. Codeforces #541 (Div2) - D. Gourmet choice(拓扑排序+并查集)

    Problem   Codeforces #541 (Div2) - D. Gourmet choice Time Limit: 2000 mSec Problem Description Input ...

  5. Codeforces #548 (Div2) - D.Steps to One(概率dp+数论)

    Problem   Codeforces #548 (Div2) - D.Steps to One Time Limit: 2000 mSec Problem Description Input Th ...

  6. 【Codeforces #312 div2 A】Lala Land and Apple Trees

    # [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原 ...

  7. Codeforces #263 div2 解题报告

    比赛链接:http://codeforces.com/contest/462 这次比赛的时候,刚刚注冊的时候非常想好好的做一下,可是网上喝了个小酒之后.也就迷迷糊糊地看了题目,做了几题.一觉醒来发现r ...

  8. codeforces #round363 div2.C-Vacations (DP)

    题目链接:http://codeforces.com/contest/699/problem/C dp[i][j]表示第i天做事情j所得到最小的假期,j=0,1,2. #include<bits ...

  9. codeforces round367 div2.C (DP)

    题目链接:http://codeforces.com/contest/706/problem/C #include<bits/stdc++.h> using namespace std; ...

随机推荐

  1. phpmyadmin配置方式

    简单的说,phpmyadmin就是一种mysql的管理工具,安装该工具后,即可以通过web形式直接管理mysql数据,而不需要通过执行系统命令来管理,非常适合对数据库操作命令不熟悉的数据库管理者,下面 ...

  2. 大并发大数量中的MYSQL瓶颈与NOSQL介绍

    NoSQL在2010年风生水起,大大小小的Web站点在追求高性能高可靠性方面,不由自主都选择了NoSQL技术作为优先考虑的方面.今年伊始,InfoQ中文站有幸邀请到凤凰网的孙立先生,为大家分享他之于N ...

  3. LightOJ 1336 Sigma Function(数论 整数拆分推论)

    --->题意:给一个函数的定义,F(n)代表n的所有约数之和,并且给出了整数拆分公式以及F(n)的计算方法,对于一个给出的N让我们求1 - N之间有多少个数满足F(x)为偶数的情况,输出这个数. ...

  4. Modis 陆地产品格网

    Technorati 标签: Modis,陆地产品,格网

  5. 转:Ant使用指南

    一.概述 ant 是一个将软件编译.测试.部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发.在实际软件开发中,有很多地方可以用到ant. 开发环境: System:Windo ...

  6. Mybatis学习(5)高级映射

    需求: 一.一对一查询 查询订单信息,关联查询创建订单的用户信息: orders--->user:一个订单只由一个用户创建,一对一 orders表 和 user表: 1)使用resultType ...

  7. 后台前台json传递数据的方式两种方式 $.get, $.getJSON

    第一种getJSON方式: 前台调用: <td><input type="text" class="t" id="edutitle& ...

  8. qt博客

    http://blog.csdn.net/foruok/article/category/418962/1

  9. DIV撑开

    引用自:http://radzhang.iteye.com/blog/1678734 在CSS排版中,如果一个层中的层使用了float浮动的话,那么就有可能会出现外层没有被内层撑开的情况,如以下代码所 ...

  10. GridView的RowCreated与RowDataBound事件区别

    在西门子面试时,项目负责人除了道试题关于RowCreated与RowDataBound事件区别,经过google一下,得出结果: GridView的RowCreated与RowDataBound的一个 ...