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

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. VMI

    在虚拟机外部监控虚拟机内部运行状态的方法被称为虚拟机自省(Virtual Machine Introspection,VMI).VMI允许特权域查看非特权域的运行状态,并能获得被监控虚拟机运行状况相关 ...

  2. NPAPI简介

    原文出处:http://blog.csdn.net/wwwsq/article/details/8254911 NPAPI是电脑上大部分非ie浏览器都支持的一种浏览器扩展,类似ie的activex技术 ...

  3. Note over Chinese Encodings

    I been confused years ago. Till recently I collected my thoughts together, and now I am clear about ...

  4. Smoke Testing(冒烟测试)

    Smoke Testing 的概念最早源于制造业,用于测试管道.测试时,用鼓风机往管道里灌烟,看管壁外面是否有烟冒出来,以便检验管道是否有缝隙.这一测试显然比较初级,更深层一点的测试至少要进行渗油测试 ...

  5. 浅谈C# 多态的魅力(虚方法,抽象,接口实现)

    前言:我们都知道面向对象的三大特性:封装,继承,多态.封装和继承对于初学者而言比较好理解,但要理解多态,尤其是深入理解,初学者往往存在有很多困惑,为什么这样就可以?有时候感觉很不可思议,由此,面向对象 ...

  6. js框架——angular.js(4)

    1. angular中的对象 其实也不用多说的,前台是可以提取后台定义的对象的—— <body ng-app="MyApp"> <div ng-controlle ...

  7. AngularJS继续中

    <html ng-app>//全局中引用对应于PhoneListCtrl 模板 <head> <script src="js/angular.js"& ...

  8. Ubuntu下安装Reids

    安装 官网  http://redis.io/    下载安装包 redis-3.0.5.tar.gz 解压 tar -zxvf redis-3.0.5.tar.gz cd redis-3.0.5 安 ...

  9. YII2 随笔 视图最佳实践

    yii\base\Controller::render(): 渲染一个 视图名 并使用一个 布局 返回到渲染结果. yii\base\Controller::renderPartial(): 渲染一个 ...

  10. 块和内嵌总结,以及各个标签的应用。其中的ul ol dl特殊定义为auto,使得里面的内容展开

    <!doctype html> <html> <head> <meta charset="UTF-8"/> <title> ...