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 ...
随机推荐
- 1003CSP-S模拟测试赛后总结
我是垃圾……我只会骗分. 拿到题目通读一遍,感觉T3(暴力)是个树剖+线段树. 刚学了树刨我这个兴奋啊.然而手懒决定最后再说. 对着T1一顿yyxjb码了个60pts的测试点分治就失去梦想了.(顺便围 ...
- elasticsearch+filebeat+kibana提取多行日志
filebeat的配置文件filebeat.yml以下三行去掉注释 multiline.pattern: ^\[ multiline.negate: true //false改为true multil ...
- SQLite wrapper
SQLiteWrapper is a C++ wrapper for SQLite. There are some test programs that demonstrate how the SQL ...
- springboot跨域问题解决
package com.qif.xdqdm.config; import org.springframework.context.annotation.Bean; import org.springf ...
- linxu(centos)安装nginx
安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc-c++ 下面正式开始 ---- ...
- PostMan授权认证使用
Authorization 对于很多应用,出于安全考虑我们的接口并不希望对外公开.这个时候就需要使用授权(Authorization)机制. 授权过程验证您是否具有访问服务器所需数据的权限. 当发送请 ...
- Map、可变参数、静态导入、Collections、Arrays、集合嵌套
Map双列集合 key 键 value 值 方法: put(K, V) //判断key值是否相等,相等,覆盖元素,不相等,存储 remove(K) Map集合的遍历(不要看到java提供了很多方法做一 ...
- 微信小程序(mpvue框架) 购物车
效果图: 说明:全选/全不选, 1.数据: products:[{checked:true,code:"4",echecked:false,hasPromotions:true,i ...
- 在core2.0中实现按程序集注入依赖
前言:在Autofac的使用中,提供了个种注入的API其中GetAssemblies()用着特别的舒坦. 1.core2.0也可以使用Autofac的包,但框架自身也提供了默认的注入Api,IServ ...
- 用星星画菱形--Java
用星星画菱形 public class Hello{ public static void main(String[] args) { char star = '\u2605'; System.out ...