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

哎,简直不让人活了

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

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. Linux学习笔记之CentOS 7系统使用firewalld管理防火墙端口

    0x00 firewalld的基本使用 # 启动: systemctl start firewalld # 查看状态: systemctl status firewalld # 停止: systemc ...

  2. Lombok简介、使用、工作原理、优缺点

    1.Lombok简介官方介绍 Project Lombok is a java library that automatically plugs into your editor and build ...

  3. React 父/子窗体参数传递

    1.父窗体 import Modal from './Modal' onModalRef = ref => { this.modal = ref } onCallback = msg => ...

  4. C#中如何禁止WindowsMediaPlayer双击全屏显示

    问题描述:在项目中使用WindowsMediaPlayer播放视频时,双击会出现视频全屏的效果,而且视频恢复后会暂停,除非再次双击返回后才能正常播放.那么如何禁止WindowsMediaPlayer的 ...

  5. C#汉字转为Unicode编码

    主要用于生成json格式时,将汉字转成Unicoude编码,防止页面乱码. protected string GetUnicode(string text) { string result = &qu ...

  6. Java的Annnotation (注解)

    注解是什么呢? 其实就像商场的商品上都贴有自己的标签一样,它提供了关于这个商品的许多额外信息.你可以根据这些信息对其进行附加的处理. (Java的语法糖果然比较差劲), 这个name()方法太累赘了, ...

  7. C#文件操作之把一个文件复制到另外一个文件夹下

    一.文件复制例子如下,具体情况,根据需求扩展. /// <summary> /// /// </summary> /// <param name="srcFol ...

  8. SpringMVC中的400错误,The request sent by the client was syntactically incorrect.

    在其他对象属性类型一样情况下,只需要创建一个类,再在springmvc.xml中添加配置: package com.ujiuye.common; import org.springframework. ...

  9. The Xor-longest Path(trie树)

    题目: #10056. 「一本通 2.3 练习 5」The XOR-longest Path 解析: 做完#10051后就不是很难了 继续利用异或的性质有\(dis(u,v) = dis(1,u)\o ...

  10. Java之路---Day12(多态)

    2019-10-26-22:40:09 目录: 1.多态的概念 2.多态的分类 3.实现多态的三个必要条件 4.多态的格式 5.多态成员变量的使用特点 6.多态成员方法的使用特点 7.多态的好处 8. ...