一来到夏令营,第一天上机就考试,

哎,简直不让人活了

这难道是给我们的见面礼???

A

https://www.luogu.org/problemnew/show/P1197

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<algorithm>
  4. #include<cmath>
  5. #include<cstring>
  6. #include<string>
  7.  
  8. using namespace std;
  9.  
  10. int n,m,q,len=;
  11. int last[],p[],father[],ans[];
  12.  
  13. struct node
  14. {
  15. int x;
  16. int y;
  17. int next;
  18. } qwq[];
  19.  
  20. bool bz[];
  21.  
  22. void add(int x,int y)
  23. {
  24. qwq[++len].x=x;
  25. qwq[len].y=y;
  26. qwq[len].next=last[x];
  27. last[x]=len;
  28. }
  29.  
  30. int find(int x)
  31. {
  32. if(father[x]!=x)
  33. {
  34. father[x]=find(father[x]);
  35. }
  36. return father[x];
  37. }
  38.  
  39. int main()
  40. {
  41. int x,y;
  42. scanf("%d %d",&n,&m);
  43. for(int i=;i<=n;i++)
  44. {
  45. last[i]=-;
  46. father[i]=i;
  47. }
  48. for(int i=;i<=m;i++)
  49. {
  50. scanf("%d %d",&x,&y);
  51. add(x,y);
  52. add(y,x);
  53. }
  54. scanf("%d",&q);
  55. for(int i=;i<=q;i++)
  56. {
  57. scanf("%d",&p[i]);
  58. bz[p[i]]=true;
  59. }
  60. int tot1=n-q;
  61. m=m<<;
  62. for(int i=;i<=m;i++)
  63. {
  64. int x=qwq[i].x,y=qwq[i].y,t1=find(x),t2=find(y);
  65. if(!bz[x]&&!bz[y]&&t1!=t2)
  66. {
  67. tot1--;
  68. father[t1]=t2;
  69. }
  70. }
  71. ans[q+]=tot1;
  72. for(int k=q;k>=;k--)
  73. {
  74. int x=p[k];
  75. bz[x]=false;
  76. tot1++;
  77. for(int i=last[x];i!=-;i=qwq[i].next)
  78. {
  79. int t1=find(x),y=qwq[i].y,t2=find(y);
  80. if(!bz[y]&&t1!=t2)
  81. {
  82. tot1--;
  83. father[t1]=t2;
  84. }
  85. }
  86. ans[k]=tot1;
  87. }
  88. for(int i=;i<=q+;i++)
  89. {
  90. printf("%d\n",ans[i]);
  91. }
  92. return ;
  93. }

  


B

https://www.luogu.org/problemnew/show/CF804B

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<algorithm>
  5.  
  6. using namespace std;
  7.  
  8. const int Mod=1e9+;
  9.  
  10. int main()
  11. {
  12. string s;
  13. cin>>s;
  14. int xx=;
  15. int sum1=;
  16. int len=s.length();
  17. for(int i=len-;i>=;i--)
  18. {
  19. if(s[i]=='a')
  20. {
  21. sum1=(sum1+xx)%Mod;
  22. xx=xx*%Mod;
  23. }
  24. else if(s[i]=='b')
  25. {
  26. xx++;
  27. }
  28. }
  29. cout<<sum1<<endl;
  30. return ;
  31. }

  


C

https://www.luogu.org/problemnew/show/CF798C

  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cmath>
  4.  
  5. using namespace std;
  6.  
  7. int gcd(int x,int y)
  8. {
  9. if(y==)
  10. {
  11. return x;
  12. }
  13. else
  14. {
  15. return gcd(y,x%y);
  16. }
  17. }
  18.  
  19. int a[];
  20.  
  21. int main()
  22. {
  23. int n;
  24. cin>>n;
  25. for(int i=;i<n;i++)
  26. {
  27. cin>>a[i];
  28. }
  29. int xx=;
  30. int ans=;
  31. int t;
  32. for(int i=;i<n;i++)
  33. {
  34. xx=gcd(xx,a[i]);
  35. }
  36. if(xx>)
  37. {
  38. cout<<"Yes"<<endl<<""<<endl;
  39. }
  40. else
  41. {
  42. for(int i=;i<n-;i++)
  43. {
  44. while(abs(a[i])%==)
  45. {
  46. ans++;
  47. t=a[i];
  48. a[i]=a[i]-a[i+];
  49. a[i+]=t+a[i+];
  50. }
  51. }
  52. while(abs(a[n-])%==)
  53. {
  54. ans++;
  55. t=a[n-];
  56. a[n-]=a[n-]-a[n-];
  57. a[n-]=t+a[n-];
  58. }
  59. if(ans)
  60. {
  61. cout<<"YES"<<endl<<ans<<endl;
  62. }
  63. else
  64. {
  65. cout<<"NO"<<-<<endl;
  66. }
  67. }
  68. return ;
  69. }

  

  

2019 NOIP 夏令营(模拟赛1)的更多相关文章

  1. NOIP前模拟赛总结

    NOIP前模拟赛总结 from 2018.10.7 to ??? Date Name Score(Rank) Problems 2018.10.7 McfXH AK Contest 42(?) 期望得 ...

  2. NOIP一系列模拟赛小结

    NOIP越发接近了,于是自己也跟着机房的几位师兄一起做了几次NOIP模拟赛,收获颇多. #1-T1:求点集中的点能否只用三条与坐标轴平行的直线就能全部被经过,其实只要将横纵坐标排序后逐个点检查下就行. ...

  3. NOIP欢乐模拟赛 T1 解题报告

    小澳的方阵 (matrix.cpp/c/pas) [题目描述] 小澳最近迷上了考古,他发现秦始皇的兵马俑布局十分有特点,热爱钻研的小澳打算在电脑上还原这个伟大的布局. 他努力钻研,发现秦始皇布置兵马俑 ...

  4. 2019.11.11 模拟赛 T2 乘积求和

    昨天 ych 的膜你赛,这道题我 O ( n4 ) 暴力拿了 60 pts. 这道题的做法还挺妙的,我搞了将近一天呢qwq 题解 60 pts 根据题目给出的式子,四层 for 循环暴力枚举统计答案即 ...

  5. LUOGU NOIP 2018 模拟赛 DAY1

    T1 传送门 解题思路 这似乎是小学数学知识???mod 9就相当于各位之和mod 9,打表求了个逆元,等差数列求和公式就行了. #include<iostream> #include&l ...

  6. 【NOIP考前模拟赛】纯数学方法推导——旅行者问题

    一.写在前面 这题似乎是一道原创题目(不是博主原创),所以并不能在任何OJ上评测,博主在网盘上上传了数据(网盘地址:http://pan.baidu.com/s/1mibdMXi),诸位看官需者自取. ...

  7. NOIP欢乐模拟赛 T3 解题报告

    3.小澳的葫芦 (calabash.cpp/c/pas) [题目描述] 小澳最喜欢的歌曲就是<葫芦娃>. 一日表演唱歌,他尽了洪荒之力,唱响心中圣歌. 随之,小澳进入了葫芦世界. 葫芦世界 ...

  8. NOIP欢乐模拟赛 T2 解题报告

    小澳的坐标系 (coordinate.cpp/c/pas) [题目描述] 小澳者表也,数学者景也,表动则景随矣. 小澳不喜欢数学,可数学却待小澳如初恋,小澳睡觉的时候也不放过. 小澳的梦境中出现了一个 ...

  9. [luogu#2019/03/10模拟赛][LnOI2019]长脖子鹿省选模拟赛赛后总结

    t1-快速多项式变换(FPT) 题解 看到这个\(f(x)=a_0+a_1x+a_2x^2+a_3x^3+ \cdots + a_nx^n\)式子,我们会想到我们学习进制转换中学到的,那么我们就只需要 ...

随机推荐

  1. mysql 事务的实现原理

    开篇 相信大家都用过事务以及了解他的特点,如原子性(Atomicity),一致性(Consistency),隔离型(Isolation)以及持久性(Durability)等.今天想跟大家一起研究下事务 ...

  2. Google Guava Cache 全解析

    Google guava工具类的介绍和使用https://blog.csdn.net/wwwdc1012/article/details/82228458 LoadingCache缓存使用(Loadi ...

  3. 2019 吉比特java面试笔试题 (含面试题解析)

      本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.吉比特等公司offer,岗位是Java后端开发,因为发展原因最终选择去了吉比特,入职一年时间了,也成为了面试官 ...

  4. localStorage、sessionStorage、Cookie的区别及用法

    1.webstorage 本地存储,存储在客户端,包括localStorage和sessionStorage. (1)localStorage:生命周期是永久,这意味着除非用户显示在浏览器提供的UI上 ...

  5. 阿里熔断限流Sentinel研究

    1. 阿里熔断限流Sentinel研究 1.1. 功能特点 丰富的应用场景:例如秒杀(即突发流量控制在系统容量可以承受的范围).消息削峰填谷.集群流量控制.实时熔断下游不可用应用等 完备的实时监控:S ...

  6. 13、vue如何解决跨域问题

    开发环境:配置config文件夹中index.js文件: proxyTable: { '/api': { target: 'http://10.10.1.242:8245',//后端地址 // sec ...

  7. 英文INSURAUNCE保险INSURAUNCE词汇

    世界保险INSURAUNCE 人类社会从开始就面临着自然灾害和意外事故的侵扰,在与大自然抗争的过程中,古代人们就萌生了对付灾害事故的保险思想和原始形态的保险方法.公元前2500年前后,古巴比伦王国国王 ...

  8. MySQL导入数据报错Got a packet bigger than‘max_allowed_packet’bytes错误的解决方法

    由于max_allowed_packet的值设置过小的原因,只需要将max_allowed_packet值设置大一点就OK了.通过终端进入mysql控制台,输入如下命令可以查看max_allowed_ ...

  9. C语言深入学习

    计算机存储篇 1.计算机对数据类型的辨别: 编译器在编译C程序时将其转变为汇编指令,其中指明了数据类型.此外,每种数据类型都有固定的存储长度,计算机运行程序时,会根据具体类型 读出相应长度的数据进行计 ...

  10. NIO与网络编程系统化学习

    1.背景 数据在网络中传输,必然回遇到读写问题.... 2.比较NIO与IO 3.案例演示 3.1.缓冲区演示 package com.wfd360.nio; import org.junit.Tes ...