ZJ一下:

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

T1竟然……是个××题

T3的Floyd写死了。

T1

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

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

  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int pn;
  7. int main(){
  8. // freopen("xor.in" ,"r",stdin);\
  9. freopen("xor.out","w",stdout);
  10. ios_base::sync_with_stdio(false);
  11. int T;
  12. cin>>T;
  13. while(T--){
  14. int tot=0,b;
  15. cin>>pn;
  16. for(int i=1;i<=pn;i++){
  17. cin>>b;
  18. tot^=b;
  19. }
  20. for(int i=1;i<pn;i++)
  21. cin>>b>>b;
  22. if(tot==0)puts("D");
  23. else puts("Q");
  24. }
  25. }

T2

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

结束。

  1. #include <iostream>
  2. #include <cstring>
  3. #include <cstdio>
  4. #define L 222222
  5. #define N 2222
  6. #define LL long long
  7. using namespace std;
  8. const int Mod=1e9+7;
  9.  
  10. char st[L];
  11. LL fac[2*L],inv[2*L];
  12. LL pre[L],aft[L],ans;
  13. LL ppow(LL a,LL b){
  14. LL res=1;
  15. a%=Mod;
  16. while(b){
  17. if(b&1)res=res*a%Mod;
  18. a=a*a%Mod;
  19. b>>=1;
  20. }
  21. return res;
  22. }
  23. LL C(LL n,LL m){
  24. if(n<m)return 0;
  25. return fac[n]*inv[m]%Mod*inv[n-m]%Mod;
  26. }
  27. int main(){
  28. // freopen("easy.in" ,"r",stdin);\
  29. freopen("easy.out","w",stdout);
  30. fac[0]=inv[0]=1;
  31. for(int i=1;i<=400000;i++){
  32. fac[i]=fac[i-1]*i%Mod;
  33. inv[i]=ppow(fac[i],Mod-2);
  34. }
  35. scanf("%s",st+1);
  36. int len=strlen(st+1);
  37. for(int i=1;i<=len;i++){
  38. pre[i]=pre[i-1];
  39. if(st[i]=='(')
  40. pre[i]++;
  41. }
  42. for(int i=len;i>=1;i--){
  43. aft[i]=aft[i+1];
  44. if(st[i]==')')
  45. aft[i]++;
  46. }
  47. for(int i=1;i<=len;i++){
  48. if(st[i]=='('){
  49. // cout<<"The"<<i<<endl;
  50. /*
  51. for(int j=0;j<=pre[i-1];j++){
  52. // cout<<"Pre:in"<<pre[i-1]<<" get:"<<j<<" Ws:"<<C(pre[i-1],j)<<endl\
  53. <<"Aft:in"<<aft[i+1]<<" get:"<<j+1<<" Ws"<<C(aft[i+1],j+1)<<endl;
  54. ans=(ans+C(pre[i-1],j)*C(aft[i+1],j+1)%Mod)%Mod;
  55. }
  56. */
  57. ans=(ans+C(pre[i-1]+aft[i+1],pre[i-1]+1))%Mod;
  58. }
  59. }
  60. printf("%lld\n",ans);
  61. }

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. hibernate_02_hibernate的入门

    1.什么是Hibernate框架? Hibernate是一种ORM框架,全称为 Object_Relative DateBase-Mapping,在Java对象与关系数据库之间建立某种映射,以实现直接 ...

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

  3. 4_4.springboot之Web开发登录和拦截器

    1.登录处理 1).禁用模板引擎的缓存 # 禁用缓存 spring.thymeleaf.cache=false 2).页面修改完用ctrl+f9:重新编译: LoginController @Cont ...

  4. python调用scikit-learn机器学习

    不支持深度学习和强化学习 numpy介绍: np.eye(n)生成一个n维单元数组 数据预处理: iris数据加载 from sklearn import datasetsiris = dataset ...

  5. js 获取指定字符串个数

    参考:https://blog.csdn.net/maqinqin/article/details/5323824 function getStrCount(scrstr,armstr) { //sc ...

  6. css 图片波浪效果

    参考:https://blog.csdn.net/zhichaosong/article/details/80944924#_99 效果: wave2.png html: <!DOCTYPE h ...

  7. netty http 服务器

    HttpFileServer package com.zhaowb.netty.ch10_1; import io.netty.bootstrap.ServerBootstrap; import io ...

  8. Java开发系列-时间转换

    获取当前时间戳 // 获取当前的时间戳 long time = new Date().getTime(); 将字符串时间戳转成格式的时间字符串 Long timestrap = Long.parseL ...

  9. SPOJ694 New Distinct Substrings

    New Distinct Substrings 题目大意 给定一个字符串,求本质不同的子串个数 题解 SA常见思想:每一个子串都是某个后缀的前缀 考虑每一个后缀的贡献,首先他拥有n - sa[i]个( ...

  10. Android开发 ExpandableListView 可折叠列表详解

    前言 在需要实现一个List的item需要包含列表的时候,我们就可以选择ExpandableListView. 其实这个View的原始设计还是ListView的那套.就是增加2层的ListView而已 ...