Codeforces Round #525 Div. 2 自闭记
A:签到。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int n;
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
n=read();
for (int i=;i<=n;i++)
for (int j=;j<=n;j++)
if (i%j==&&i*j>n&&i/j<n) {cout<<i<<' '<<j;return ;}
cout<<-;
return ;
}
B:sort+unique。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define N 100010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int n,m,a[N];
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
n=read(),m=read();
for (int i=;i<=n;i++) a[i]=read();
sort(a+,a+n+);n=unique(a+,a+n+)-a-;
for (int i=;i<=min(n,m);i++) printf("%d\n",a[i]-a[i-]);
for (int i=min(n,m)+;i<=m;i++) printf("0\n");
return ;
}
C:开始时将所有数+inf。然后将ai变成i。每次对前缀i把取模当成减法用即可,只会影响到第i位。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define N 2010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int n,a[N];
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
n=read();
for (int i=;i<=n;i++) a[i]=read()+;
cout<<n+<<endl;
cout<<<<' '<<n<<' '<<<<endl;
for (int i=;i<=n;i++)
printf("%d %d %d\n",,i,a[i]-i);
return ;
}
D:先判一下a和b的大小,即令c=d=0。不妨令a>b。从高到低考虑各位。对最高位查询c=0 d=1<<29和c=1<<29 d=0。如果是>>或<<,则该位上a为1,b为0;若为><,则该位上a、b均为1;若为<>,则该位上a、b均为0。同时可以据此得到忽略已查询位后a和b的大小关系,即若为<<则ab大小关系取反。下次查询时将已得的ab的高位异或掉消除影响即可,得到一个子问题并且不再需要查询ab大小。共查询1+30*2=61次。=应该怎么处理都差不多。
E:首先要使比值最大,只选一个连通块是最优的,比较显然。这个瞎dp就完了。然后再求最多能选几个这样的连通块。还是瞎dp就完了。讲道理啊我带个log精度爆炸也就算了,T是怎么回事啊跟CCF换机子了?
F:没看懂题。
整场都不知道在干啥。感觉心态很有问题。
小号打的。result:rank 547 rating -45
Codeforces Round #525 Div. 2 自闭记的更多相关文章
- Educational Codeforces Round 58 Div. 2 自闭记
明明多个几秒就能场上AK了.自闭. A:签到. #include<iostream> #include<cstdio> #include<cmath> #inclu ...
- Codeforces Round #554 (Div. 2)自闭记
A 签到 #include<bits/stdc++.h> using namespace std; ],t[],ans; int main() { scanf("%d%d&quo ...
- Codeforces Round #545 Div. 1自闭记
A:求出该行该列各有多少个比其小的取max,该行该列各有多少个比其大的取max,加起来即可. #include<iostream> #include<cstdio> #incl ...
- Codeforces Round #528 Div. 1 自闭记
整天自闭. A:有各种讨论方式.我按横坐标排了下然后讨论了下纵坐标单调和不单调两种情况.写了15min也就算了,谁能告诉我printf和cout输出不一样是咋回事啊?又调了10min啊?upd:突然想 ...
- Codeforces Round #526 Div. 1 自闭记
日常猝死. A:f[i]表示子树内包含根且可以继续向上延伸的路径的最大价值,统计答案考虑合并两条路径即可. #include<iostream> #include<cstdio> ...
- Codeforces Round #567 (Div. 2)自闭记
嘿嘿嘿,第一篇文章,感觉代码可以缩起来简直不要太爽 打个div2发挥都这么差... 平均一题fail一次,还调不出错,自闭了 又一次跳A开B,又一次B傻逼错误调不出来 罚时上天,E还傻逼了..本来这场 ...
- Codeforces Round #530 Div. 1 自闭记
A:显然应该让未确定的大小尽量大.不知道写了啥就wa了一发. #include<iostream> #include<cstdio> #include<cmath> ...
- Codeforces Round #525 (Div. 2)
Codeforces Round #525 (Div. 2) 哎,忍不住想吐槽一下,又要准备训练,又要做些无聊的事,弄得我都想退出了. 好好的训练不好么???? 只能做出两道水题,其实C题,感觉做出来 ...
- Codeforces Round #525 (Div. 2)题解
Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...
随机推荐
- python 多线程笔记(5)-- 生产者/消费者模式
我们已经知道,对公共资源进行互斥访问,可以使用Lock上锁,或者使用RLock去重入锁. 但是这些都只是方便于处理简单的同步现象,我们甚至还不能很合理的去解决使用Lock锁带来的死锁问题. 要解决更复 ...
- swift3.0通过响应链获取当前试图的控制器
func parentViewController() -> UIViewController? { let n = next while n != nil { let controller = ...
- MYSQL查看当前正在使用的数据库命令
select database();
- git clone、git pull和git fetch的用法及区别
声明:码字不易,转载请注明出处,欢迎文章下方讨论交流.Git 常用命令速查表 最近在一个学习小组里学习AI的课程,我们所有的学习资料和homework都放在gitlab上.今天一个小队友从gitlab ...
- Bug 级别定义标准
缺陷种类 缺陷级别 详细说明 功能缺陷 Urgent (V级) 1.操作系统无法正常使用,死机,出现致命错误 2.数据丢失 3.被测试系统频繁崩溃,程序出错,使功能不能继续使用 4.性能与需求不一致 ...
- 高可用Kubernetes集群-4. kubectl客户端工具
六.部署kubectl客户端工具 1. 下载 [root@kubenode1 ~]# cd /usr/local/src/ [root@kubenode1 src]# wget https://sto ...
- 天马行空-Ops平台建设概述
1 概述 什么是Ops平台,Ops平台的目标是什么,建设的考虑点有哪些?本章节以实际生活中医院的例子来进行各形象的阐述. 医院包含各种诊断治疗设备,病历库,医生.一个孕妇需要到医院 ...
- leetcode27_C++Remove Element
给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度. 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成 ...
- POJ 3579 Median 二分加判断
Median Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12453 Accepted: 4357 Descripti ...
- Professional Books
Machine Learning: Pattern Recognition and Machine Learning(PRML) https://mqshen.gitbooks.io/p ...