ZJ一下:

挺好,T2打表差点出规律(最近拿PFGYL硬卡提升自己几乎没有的打表水平)

T1竟然……是个××题

T3的Floyd写死了。

T1

简单思考会发现……直接全异或起来就AC

话说T1真叫最大异或和……

#include <iostream>
#include <cstring> using namespace std; int pn;
int main(){
// freopen("xor.in" ,"r",stdin);\
freopen("xor.out","w",stdout);
ios_base::sync_with_stdio(false);
int T;
cin>>T;
while(T--){
int tot=0,b;
cin>>pn;
for(int i=1;i<=pn;i++){
cin>>b;
tot^=b;
}
for(int i=1;i<pn;i++)
cin>>b>>b;
if(tot==0)puts("D");
else puts("Q");
}
}

T2

$$\begin{array}{rl}&\sum\limits_{i=0}^{n}C_{n}^{i} \times C_{m}^{i+1}\\=&C_{n+m}^{n+1}\end{array}$$

结束。

#include <iostream>
#include <cstring>
#include <cstdio>
#define L 222222
#define N 2222
#define LL long long
using namespace std;
const int Mod=1e9+7; char st[L];
LL fac[2*L],inv[2*L];
LL pre[L],aft[L],ans;
LL ppow(LL a,LL b){
LL res=1;
a%=Mod;
while(b){
if(b&1)res=res*a%Mod;
a=a*a%Mod;
b>>=1;
}
return res;
}
LL C(LL n,LL m){
if(n<m)return 0;
return fac[n]*inv[m]%Mod*inv[n-m]%Mod;
}
int main(){
// freopen("easy.in" ,"r",stdin);\
freopen("easy.out","w",stdout);
fac[0]=inv[0]=1;
for(int i=1;i<=400000;i++){
fac[i]=fac[i-1]*i%Mod;
inv[i]=ppow(fac[i],Mod-2);
}
scanf("%s",st+1);
int len=strlen(st+1);
for(int i=1;i<=len;i++){
pre[i]=pre[i-1];
if(st[i]=='(')
pre[i]++;
}
for(int i=len;i>=1;i--){
aft[i]=aft[i+1];
if(st[i]==')')
aft[i]++;
}
for(int i=1;i<=len;i++){
if(st[i]=='('){
// cout<<"The"<<i<<endl;
/*
for(int j=0;j<=pre[i-1];j++){
// cout<<"Pre:in"<<pre[i-1]<<" get:"<<j<<" Ws:"<<C(pre[i-1],j)<<endl\
<<"Aft:in"<<aft[i+1]<<" get:"<<j+1<<" Ws"<<C(aft[i+1],j+1)<<endl;
ans=(ans+C(pre[i-1],j)*C(aft[i+1],j+1)%Mod)%Mod;
}
*/
ans=(ans+C(pre[i-1]+aft[i+1],pre[i-1]+1))%Mod;
}
}
printf("%lld\n",ans);
}

T3

快速幂2套矩阵乘(Floyd)

话说暴力写跪还没调(diao)出来……

19-10-23-L-Mor的更多相关文章

  1. 10.23 正睿停课训练 Day7

    目录 2018.10.23 正睿停课训练 Day7 A 矩形(组合) B 翻转(思路) C 求和(思路 三元环计数) 考试代码 B1 B2 C 2018.10.23 正睿停课训练 Day7 期望得分: ...

  2. 程序员的 Ubuntu 19.10 配置与优化指南

    原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...

  3. 背水一战 Windows 10 (23) - MVVM: 通过 Binding 或 x:Bind 结合 Command 实现,通过 ButtonBase 触发命令

    [源码下载] 背水一战 Windows 10 (23) - MVVM: 通过 Binding 或 x:Bind 结合 Command 实现,通过 ButtonBase 触发命令 作者:webabcd ...

  4. Daily Scrum 10.23

    (写于10.22周四) 说下现在的人员情况: 康家华请假至下周一,刘彦熙至周五18:00,张启东至周六中午. 其他人正常工作. 然后是现在的进度情况: 已经完成服务器数据库搭建,以及基础的注册登陆功能 ...

  5. Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24

    作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...

  6. [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录

    在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...

  7. [Linux] 树莓派 4B 安装 Ubuntu 19.10 (Eoan Ermine) IOT 版

    硬件:Raspberry Pi 4B系统:Ubuntu 19.10 (Eoan Ermine) for IOT官网:https://ubuntu.com/download/iot/raspberry- ...

  8. Ubuntu 19.10 安装 jupyter

    安装pip3 ubuntu 19.10 已经没有python了,取代的是python3. 执行sudo apt install python3-pip安装pip3 安装jupyter 执行sudo p ...

  9. Ubuntu 19.10将使用GCC 9作为默认编译器

    作为我们这一周期一直期待的变化,Ubuntu 19.10升级到GCC 9作为GCC 8的默认系统编译器. Ubuntu 19.10(和Ubuntu 20.04 LTS)将使用GCC 9 stable作 ...

  10. Unix 网络编程卷一源码编译踩坑记录 ubtutu 19.10

    在阅读unpv1时运行源代码的环境配置,这里简单记录一下 源代码里的README 写得挺详细的,但是在Linux 系统的下还没没办法直接编译通过的, 这里我使用的是ubuntu 19.10(在腾讯云1 ...

随机推荐

  1. PAT甲级——A1127 ZigZagging on a Tree【30】

    Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can ...

  2. springboot启动器:spring-boot-starter

    今天想要导入thymeleaf的依赖,但是又不想从其他博复制粘贴,于是去spring官方文档找一找 在idea新建的springbootweb项目中,有一个HELP.md文件,里面包含spring w ...

  3. 12_springmvc拦截器

    一.定义 Spring Web MVC 的处理器拦截器类似于Servlet 开发中的过滤器Filter,用于对处理器进行预处理和后处理. 二.拦截器定义 实现HandlerInterceptor接口, ...

  4. P1736 创意吃鱼法 /// DP

    题目大意: https://www.luogu.org/problemnew/show/P1736 题解 dplr[][] 当前点左边(副对角线时为右边)有多少个连续的0 dpup[][] 当前点上边 ...

  5. wpf Rectangle

    <Rectagle Width="100" Height="100" Stroke="Black" Fill="Blue&q ...

  6. How to use view controller containment

    https://www.hackingwithswift.com/example-code/uikit/how-to-use-view-controller-containment private f ...

  7. iOS开发系列-文件上传

    概述 Http协议对文件上传协议要求的 1. 必须设置请求头Content-Type为multipart/form-data.在iOS中后面需要跟上分隔符比如:boundary=----WebKitF ...

  8. 如果try中有return那么finally中不要有return不然不会执行try中的return

    public class TryExer { public static void main(String[] args) { String test = test(); System.out.pri ...

  9. Java虚拟机性能管理神器 - VisualVM(6) 排查JAVA应用程序内存泄漏【转】

    Java虚拟机性能管理神器 - VisualVM(6) 排查JAVA应用程序内存泄漏[转] 标签: javajvm内存泄漏监控工具 2015-03-11 18:30 1870人阅读 评论(0) 收藏  ...

  10. Linux System命令

    http://blog.csdn.net/cheyo/article/details/6595955 #include <stdio.h> #include <stdlib.h> ...