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

哎,简直不让人活了

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

A

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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string> using namespace std; int n,m,q,len=;
int last[],p[],father[],ans[]; struct node
{
int x;
int y;
int next;
} qwq[]; bool bz[]; void add(int x,int y)
{
qwq[++len].x=x;
qwq[len].y=y;
qwq[len].next=last[x];
last[x]=len;
} int find(int x)
{
if(father[x]!=x)
{
father[x]=find(father[x]);
}
return father[x];
} int main()
{
int x,y;
scanf("%d %d",&n,&m);
for(int i=;i<=n;i++)
{
last[i]=-;
father[i]=i;
}
for(int i=;i<=m;i++)
{
scanf("%d %d",&x,&y);
add(x,y);
add(y,x);
}
scanf("%d",&q);
for(int i=;i<=q;i++)
{
scanf("%d",&p[i]);
bz[p[i]]=true;
}
int tot1=n-q;
m=m<<;
for(int i=;i<=m;i++)
{
int x=qwq[i].x,y=qwq[i].y,t1=find(x),t2=find(y);
if(!bz[x]&&!bz[y]&&t1!=t2)
{
tot1--;
father[t1]=t2;
}
}
ans[q+]=tot1;
for(int k=q;k>=;k--)
{
int x=p[k];
bz[x]=false;
tot1++;
for(int i=last[x];i!=-;i=qwq[i].next)
{
int t1=find(x),y=qwq[i].y,t2=find(y);
if(!bz[y]&&t1!=t2)
{
tot1--;
father[t1]=t2;
}
}
ans[k]=tot1;
}
for(int i=;i<=q+;i++)
{
printf("%d\n",ans[i]);
}
return ;
}

  


B

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

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm> using namespace std; const int Mod=1e9+; int main()
{
string s;
cin>>s;
int xx=;
int sum1=;
int len=s.length();
for(int i=len-;i>=;i--)
{
if(s[i]=='a')
{
sum1=(sum1+xx)%Mod;
xx=xx*%Mod;
}
else if(s[i]=='b')
{
xx++;
}
}
cout<<sum1<<endl;
return ;
}

  


C

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

#include<iostream>
#include<cstdio>
#include<cmath> using namespace std; int gcd(int x,int y)
{
if(y==)
{
return x;
}
else
{
return gcd(y,x%y);
}
} int a[]; int main()
{
int n;
cin>>n;
for(int i=;i<n;i++)
{
cin>>a[i];
}
int xx=;
int ans=;
int t;
for(int i=;i<n;i++)
{
xx=gcd(xx,a[i]);
}
if(xx>)
{
cout<<"Yes"<<endl<<""<<endl;
}
else
{
for(int i=;i<n-;i++)
{
while(abs(a[i])%==)
{
ans++;
t=a[i];
a[i]=a[i]-a[i+];
a[i+]=t+a[i+];
}
}
while(abs(a[n-])%==)
{
ans++;
t=a[n-];
a[n-]=a[n-]-a[n-];
a[n-]=t+a[n-];
}
if(ans)
{
cout<<"YES"<<endl<<ans<<endl;
}
else
{
cout<<"NO"<<-<<endl;
}
}
return ;
}

  

  

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. VS 安装resharper 后 无法进行UnitTest

    Vs安装 Resharper后,无法进行单元测试,发现报错提示信息如下: ignored test-case is missing. rebuild the project and try again ...

  2. https相关知识总结

    从园子里看到很多讲解不错的文章,将链接放到这里,备忘 浅析数字证书:https://www.cnblogs.com/hyddd/archive/2009/01/07/1371292.html

  3. Qt Graphics-View的打印功能实现

    本文来研究一下Qt Graphics-View的打印功能实现. 在Qt的官方文档中介绍了Graphics-View的打印相关内容. Qt中对打印的支持是有一个独立的printsupport模块来完成的 ...

  4. Spring Boot加载application.properties配置文件顺序规则

    SpringApplication会从以下路径加载所有的application.properties文件: 1.file:./config/(当前目录下的config文件夹) 2.file:./(当前 ...

  5. react的事件处理为什么要bind this 改变this的指向?

    react的事件处理会丢失this,所以需要绑定,为什么会丢失this? 首先来看摘自官方的一句话: You have to be careful about the meaning of this ...

  6. 利用 AWS DMS 在线迁移 MongoDB 到 Amazon Aurora

    将数据从一种数据库迁移到另一种数据库通常都非常具有挑战性,特别是考虑到数据一致性.应用停机时间.以及源和目标数据库在设计上的差异性等因素.这个过程中,运维人员通常都希望借助于专门的数据迁移(复制)工具 ...

  7. prometheus学习系列五: Prometheus配置文件

    在prometheus监控系统,prometheus的职责是采集,查询和存储和推送报警到alertmanager.本文主要介绍下prometheus的配置文件. 全局配置文件简介 默认配置文件 [ro ...

  8. Odoo中的记录集

    转载请注明原文地址:https://www.cnblogs.com/ygj0930/p/10826218.html 一:record set 1:获取记录集 1)在@api.multi修饰器修饰的函数 ...

  9. Istio技术与实践06:史上最全!Istio安装参数介绍

    一. CertManage Istio-1.0版本新加入的组件,利用ACME为Istio签发证书 Key Default Value Description certmanager.enabled T ...

  10. centos 启动 oracle

    source .bash_profile su - oracle //切换到自己的oracle账户   lsnrctl start //启动oracle监听   sqlplus /nolog //登录 ...