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 ...
随机推荐
- hibernate_02_hibernate的入门
1.什么是Hibernate框架? Hibernate是一种ORM框架,全称为 Object_Relative DateBase-Mapping,在Java对象与关系数据库之间建立某种映射,以实现直接 ...
- UVA-108-Maximum Sum-子矩阵最大和(最大连续子序列的变形)+降维处理+dp
A problem that is simple to solve in one dimension is often much more difficult to solve in more tha ...
- 4_4.springboot之Web开发登录和拦截器
1.登录处理 1).禁用模板引擎的缓存 # 禁用缓存 spring.thymeleaf.cache=false 2).页面修改完用ctrl+f9:重新编译: LoginController @Cont ...
- python调用scikit-learn机器学习
不支持深度学习和强化学习 numpy介绍: np.eye(n)生成一个n维单元数组 数据预处理: iris数据加载 from sklearn import datasetsiris = dataset ...
- js 获取指定字符串个数
参考:https://blog.csdn.net/maqinqin/article/details/5323824 function getStrCount(scrstr,armstr) { //sc ...
- css 图片波浪效果
参考:https://blog.csdn.net/zhichaosong/article/details/80944924#_99 效果: wave2.png html: <!DOCTYPE h ...
- netty http 服务器
HttpFileServer package com.zhaowb.netty.ch10_1; import io.netty.bootstrap.ServerBootstrap; import io ...
- Java开发系列-时间转换
获取当前时间戳 // 获取当前的时间戳 long time = new Date().getTime(); 将字符串时间戳转成格式的时间字符串 Long timestrap = Long.parseL ...
- SPOJ694 New Distinct Substrings
New Distinct Substrings 题目大意 给定一个字符串,求本质不同的子串个数 题解 SA常见思想:每一个子串都是某个后缀的前缀 考虑每一个后缀的贡献,首先他拥有n - sa[i]个( ...
- Android开发 ExpandableListView 可折叠列表详解
前言 在需要实现一个List的item需要包含列表的时候,我们就可以选择ExpandableListView. 其实这个View的原始设计还是ListView的那套.就是增加2层的ListView而已 ...