博客
关于我
纪中2020.4.4普及C组模拟赛总结
阅读量:339 次
发布时间:2019-03-04

本文共 2983 字,大约阅读时间需要 9 分钟。

题太难了,唉

T1

本题我打了个暴力,错了。

正解:暴力

每次调换位置,不用管此时在这个位置上的数,只要得出进行 M 次操作后第 i 位会换到的位置并标记,每一轮结束后就只用调位置就行了。

A C   C o d e AC~Code AC Code

#include
#include
#include
#include
#include
using namespace std;int l,r,a[100010],b[100010],c[100010];int n,m,k;int main(){ freopen("swap.in","r",stdin); freopen("swap.out","w",stdout); cin>>n>>m>>k; for(int i=1; i<=n; i++) a[i]=i; for(int i=1; i<=m; i++) { scanf("%d %d",&l,&r); for(int i=l; i<=r; i++) //存l~r的a[i]的取反 b[i]=a[l+r-i]; for(int i=l; i<=r; i++) //取反 a[i]=b[i]; } for(int i=1; i<=n; i++) //赋初值 { c[i]=a[i]; a[i]=i; } while(k>0) { if(k&1) { for(int i=1; i<=n; i++) a[i]=c[a[i]]; } for(int i=1; i<=n; i++) //按位置放 b[i]=c[c[i]]; for(int i=1; i<=n; i++) c[i]=b[i]; k/=2; } for(int i=1; i<=n; i++) printf("%d\n",a[i]); return 0;}

T2

在这里插入图片描述

A C   C o d e AC~Code AC Code

#include
#include
#include
#include
#include
using namespace std;long long he[100010],js[100010],v[100010];long long s[100010],y[100010],x[100010];long long ans,n;struct node{ long long x,y;}a[100010];bool cmp1(const node&l,const node&r){ if(l.x!=r.x) return l.x
r.x; return l.y>r.y;}bool cmp3(const node&l,const node&r){ if(l.x!=r.x) return l.x
r.y;}bool cmp4(const node&l,const node&r){ if(l.x!=r.x) return l.x>r.x; return l.y
>n; for(int i=1; i<=n; i++) { cin>>a[i].x>>a[i].y; a[i].x+=10005; a[i].y+=10005; } sort(a+1,a+1+n,cmp1); //同样的事情做四次 pd(); sort(a+1,a+1+n,cmp2); pd(); sort(a+1,a+1+n,cmp3); pd(); sort(a+1,a+1+n,cmp4); pd(); cout<

T3

此题枚举

我们枚举每一个房间,找与它相连的房间。
不停地在房间来回走,
直到除了枚举的房间以外其余房间都是 12 12 12
根(就是枚举的第一个房间) 正好是 12 12 12或是 1 1 1的时候就证明这条路是可以的,
那为啥 1 1 1可以呢?
因为可以在根的最后一个孩子停下,不走回来。
这时候根和最后一个孩子的时间会差一个

A C   C o d e AC~Code AC Code

#include
#include
#include
#include
#include
using namespace std;int n,x,y,ans,a[10010],t[10010];int head[10010],tot;struct node{ int x,y,next;}e[10010];void ljb(int x,int y){ e[++tot].x=x; e[tot].y=y; e[tot].next=head[x]; head[x]=tot;}void dfs(int x,int y){ for(int i=head[x]; i; i=e[i].next) { if(e[i].y==y) //防止死循环 continue; dfs(e[i].y,x); t[x]=(t[x]-t[e[i].y]+12)%12; //钟表+1(因为我们是这样枚举的,所以12就是0) } }int main(){ freopen("clocktree.in","r",stdin); freopen("clocktree.out","w",stdout); cin>>n; for(int i=1; i<=n; i++) scanf("%d",&a[i]),a[i]%=12; for(int i=1; i<=n-1; i++) { scanf("%d%d",&x,&y); ljb(x,y); ljb(y,x); } for(int i=1; i<=n; i++) { memcpy(t,a,sizeof(t)); dfs(i,0); if(t[i]==0||t[i]==1) //判断是否可以(这里0就是12) ans++; } cout<

总分

0 + 10 + 6.7 = 16.7 p t s 0+10+6.7=16.7pts 0+10+6.7=16.7pts

抽空学一学新知识吧!

(纪六三人 A K AK AK我佛了)

现已全对

转载地址:http://file.baihongyu.com/

你可能感兴趣的文章
Liunx百宝箱(Centos补充)
查看>>
Python存储系统(Redis)
查看>>
C语言指针收藏
查看>>
.net 4种单例模式
查看>>
T4 生成数据库实体类
查看>>
C#搞个跨平台的桌面NES游戏模拟器
查看>>
手把手教你安装Eclipse最新版本的详细教程 (非常详细,非常实用)
查看>>
《带你装B,带你飞》pytest成魔之路4 - fixture 之大解剖
查看>>
互联网App应用程序测试流程及测试总结
查看>>
根据轨迹分析出用户家在哪
查看>>
PostgreSQL查询表名称及表结构
查看>>
是什么?评估分类器的常用概念----准确率,精确率,召回率
查看>>
linux中使用awk命令
查看>>
LAB2 内核的内存管理
查看>>
如何使用google搜索?
查看>>
Redis分布式锁的正确实现方式
查看>>
设计模式-抽象工厂模式
查看>>
MySQL Explain查看执行计划详解
查看>>
IntelliJ IDEA 中,项目文件右键菜单没有svn选项解决办法
查看>>
Spring 动态绑定多实现类实例综述
查看>>