19-10-23-L-Mor
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的更多相关文章
- 10.23 正睿停课训练 Day7
目录 2018.10.23 正睿停课训练 Day7 A 矩形(组合) B 翻转(思路) C 求和(思路 三元环计数) 考试代码 B1 B2 C 2018.10.23 正睿停课训练 Day7 期望得分: ...
- 程序员的 Ubuntu 19.10 配置与优化指南
原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...
- 背水一战 Windows 10 (23) - MVVM: 通过 Binding 或 x:Bind 结合 Command 实现,通过 ButtonBase 触发命令
[源码下载] 背水一战 Windows 10 (23) - MVVM: 通过 Binding 或 x:Bind 结合 Command 实现,通过 ButtonBase 触发命令 作者:webabcd ...
- Daily Scrum 10.23
(写于10.22周四) 说下现在的人员情况: 康家华请假至下周一,刘彦熙至周五18:00,张启东至周六中午. 其他人正常工作. 然后是现在的进度情况: 已经完成服务器数据库搭建,以及基础的注册登陆功能 ...
- Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24
作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...
- [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录
在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...
- [Linux] 树莓派 4B 安装 Ubuntu 19.10 (Eoan Ermine) IOT 版
硬件:Raspberry Pi 4B系统:Ubuntu 19.10 (Eoan Ermine) for IOT官网:https://ubuntu.com/download/iot/raspberry- ...
- Ubuntu 19.10 安装 jupyter
安装pip3 ubuntu 19.10 已经没有python了,取代的是python3. 执行sudo apt install python3-pip安装pip3 安装jupyter 执行sudo p ...
- Ubuntu 19.10将使用GCC 9作为默认编译器
作为我们这一周期一直期待的变化,Ubuntu 19.10升级到GCC 9作为GCC 8的默认系统编译器. Ubuntu 19.10(和Ubuntu 20.04 LTS)将使用GCC 9 stable作 ...
- Unix 网络编程卷一源码编译踩坑记录 ubtutu 19.10
在阅读unpv1时运行源代码的环境配置,这里简单记录一下 源代码里的README 写得挺详细的,但是在Linux 系统的下还没没办法直接编译通过的, 这里我使用的是ubuntu 19.10(在腾讯云1 ...
随机推荐
- 爬虫-Requests 使用入门
requests 的底层实现其实就是 urllib json在线解析工具 ---------------------------------------------- Linux alias命令用于设 ...
- LUOGU P3048 [USACO12FEB]牛的IDCow IDs(组合数)
传送门 解题思路 组合数学.首先肯定是要先枚举位数,假如枚举到第\(i\)位.我们可以把第一位固定,然后那么后面的随意放\(1\),个数就为\(C_{i-1}^{k-1}\).然后每次枚举时如果方案\ ...
- LUOGU P4159 [SCOI2009]迷路(矩阵乘法)
传送门 解题思路 以前bpw讲过的一道题,顺便复习一下矩阵乘法.做法就是拆点,把每个点拆成\(9\)个点,然后挨个连边.之后若\(i\)与\(j\)之间的边长度为\(x\),就让\(i\)的第\(x\ ...
- 实时检测网络状态及是否可以连接Internet
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- System.Web.Mvc.RouteAttribute.cs
ylbtech-System.Web.Mvc.RouteAttribute.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutral, Pub ...
- PAT甲级——A1109 Group Photo【25】
Formation is very important when taking a group photo. Given the rules of forming K rows with Npeopl ...
- requests 返回 521
网页端抓数据免不了要跟JavaScript打交道,尤其是JS代码有混淆,对cookie做了手脚.找到cookie生成的地方要费一点时间. 那天碰到这样一个网页,用浏览器打开很正常.然而用request ...
- 7_2.springboot2.x启动配置原理_2.运行run方法
当创建完SpringApplication对象之后运行run方法 public ConfigurableApplicationContext run(String... args) { StopWat ...
- Python调用DLL动态链接库——ctypes使用
最近要使用python调用C++编译生成的DLL动态链接库,因此学习了一下ctypes库的基本使用. ctypes是一个用于Python的外部函数库,它提供C兼容的数据类型,并允许在DLL或共享库中调 ...
- js 实现加载百分比效果
效果: html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> < ...