果然abc都是手速场。

倒序开的qwq。

D题因为忘记1e12二进制几位上界爆了一发。

A - Entrance Examination

就是除一下就行了。。。

看样例猜题意系列。

#include<cstdio>
#include<algorithm>
#include<cstring>
int main(){
double t,x;
scanf("%lf%lf",&t,&x);
printf("%lf",t/x);
return 0;
}

B - Polygon

他都把定理给你了。。。

你直接按他的意思模拟就好,数组都不用开

#include <bits/stdc++.h>

int main() {
int n, sum = 0, mx = 0;
scanf("%d", &n);
for(int x, i = 1; i <= n; ++i) {
scanf("%d", &x);
sum += x;
mx = std::max(mx, x);
}
if(mx < sum - mx) puts("Yes");
else puts("No");
}

C - Streamline

直接贪心就好了。

我们把序列先排序然后差分一下。

显然中间那些长的间隔我们不要走。

所以把间隔排序。

然后再间隔的右边放一个棋子就好了。

也就是说前m大的间隔我们都不用走。这个想了挺久的。。。

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <map>
#include <set> #define ll long long
#define inf 0x3f3f3f3f
#define il inline namespace io { #define in(a) a=read()
#define out(a) write(a)
#define outn(a) out(a),putchar('\n') #define I_int ll
inline I_int read() {
I_int x = 0 , f = 1 ; char c = getchar() ;
while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
return x * f ;
}
char F[ 200 ] ;
inline void write( I_int x ) {
if( x == 0 ) { putchar( '0' ) ; return ; }
I_int tmp = x > 0 ? x : -x ;
if( x < 0 ) putchar( '-' ) ;
int cnt = 0 ;
while( tmp > 0 ) {
F[ cnt ++ ] = tmp % 10 + '0' ;
tmp /= 10 ;
}
while( cnt > 0 ) putchar( F[ -- cnt ] ) ;
}
#undef I_int }
using namespace io ; using namespace std ; #define N 100010 int m = read(), n = read();
int a[N], f[N]; bool cmp(int a, int b) {
return a > b;
} int main() {
for(int i = 1; i <= n; ++i) a[i] = read();
sort(a + 1, a + n + 1);
if(m >= n) return puts("0"), 0;
int cnt = 0;
for(int i = 2; i <= n; ++i) {
f[++cnt] = a[i] - a[i - 1];
}
sort(f + 1, f + n + 1, cmp);
ll ans = 0;
for(int i = m; i <= n; ++i) ans += f[i];
printf("%lld\n", ans);
}

D - XXOR

据说样例锅了?

反正我记错位运算+上界算错这题卡了半小时。。。

因为是XOR所以我们按位来考虑,从高位往低位贪心。

XOR是不进位的加法,我们从这个角度来考虑。

统计该位上0个数和1个数。

如果0的个数多显然题面里的那个x这一位就必须有1(在x不超过k的情况下)。

注意开1ll,以及不要记错取出一个数的第k位的位运算是长啥样的。。。

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <deque>
#include <map>
#include <set> #define ll long long
#define inf 0x3f3f3f3f
#define il inline namespace io { #define in(a) a=read()
#define out(a) write(a)
#define outn(a) out(a),putchar('\n') #define I_int ll
inline I_int read() {
I_int x = 0 , f = 1 ; char c = getchar() ;
while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
return x * f ;
}
char F[ 200 ] ;
inline void write( I_int x ) {
if( x == 0 ) { putchar( '0' ) ; return ; }
I_int tmp = x > 0 ? x : -x ;
if( x < 0 ) putchar( '-' ) ;
int cnt = 0 ;
while( tmp > 0 ) {
F[ cnt ++ ] = tmp % 10 + '0' ;
tmp /= 10 ;
}
while( cnt > 0 ) putchar( F[ -- cnt ] ) ;
}
#undef I_int }
using namespace io ; using namespace std ; #define N 100010 ll n = read(), K = read();
ll a[N], cnt[2]; bool cmp(int a, int b) {
return a > b;
} int main() {
for(int i = 1; i <= n; ++i) a[i] = read();
ll ans = 0;
for(ll k = 42; k >= 0; --k) {
cnt[0] = cnt[1] = 0;
for(int i = 1; i <= n; ++i) {
cnt[(a[i]>>k)&1ll]++;
}
if(cnt[0] > cnt[1] && ans + (1ll << k) <= K) ans += (1ll << k);
}
ll sum = 0;
for(int i = 1; i <= n; ++i) {
sum += ans ^ a[i];
}
printf("%lld\n", sum);
return 0;
}

AtCoder Beginner Contest 117 解题报告的更多相关文章

  1. AtCoder Beginner Contest 122 解题报告

    手速选手成功混进rated only里面的前30名,但是总排名就到110+了... A - Double Helix #include <bits/stdc++.h> #define ll ...

  2. AtCoder Beginner Contest 146解题报告

    题目地址 https://atcoder.jp/contests/abc146/tasks 感觉没有什么有意思的题... 题解 A #include <bits/stdc++.h> usi ...

  3. Atcoder Beginner Contest 124 解题报告

    心态爆炸.本来能全做出来的.但是由于双开了Comet oj一个比赛,写了ABC就去搞那个的B题 还被搞死了. 回来写了一会D就过了.可惜比赛已经结束了.真的是作死. A - Buttons #incl ...

  4. AtCoder Beginner Contest 118 解题报告

    A - B +/- A #include <bits/stdc++.h> int main() { int a, b; std::cin >> a >> b; b ...

  5. AtCoder Beginner Contest 120 解题报告

    为啥最近都没有arc啊... A - Favorite Sound #include <algorithm> #include <iostream> #include < ...

  6. AtCoder Beginner Contest 132 解题报告

    前四题都好水.后面两道题好难. C Divide the Problems #include <cstdio> #include <algorithm> using names ...

  7. AtCoder Beginner Contest 129 解题报告

    传送门 写了四个题就跑去打球了.第五题应该能肝出来的. A - Airplane #include <bits/stdc++.h> using namespace std; inline ...

  8. AtCoder Beginner Contest 127 解题报告

    传送门 非常遗憾.当天晚上错过这一场.不过感觉也会掉分的吧.后面两题偏结论题,打了的话应该想不出来. A - Ferris Wheel #include <bits/stdc++.h> u ...

  9. AtCoder Beginner Contest 126 解题报告

    突然6道题.有点慌.比赛写了五个.罚时爆炸.最后一个时间不太够+没敢写就放弃了. 两道题奇奇怪怪的WJ和20/20.今天的评测机是怎么了. A Changing a Character #includ ...

随机推荐

  1. 4.无监督学习--K-means聚类

    K-means方法及其应用 1.K-means聚类算法简介: k-means算法以k为参数,把n个对象分成k个簇,使簇内具有较高的相似度,而簇间的相似度较低.主要处理过程包括: 1.随机选择k个点作为 ...

  2. html5-fieldset和legend和keygen元素的用法

    <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8&qu ...

  3. 师大校赛D coloring Game 并查集

    这题说的是 在一个 森林中 两个人在这棵树上涂颜色,黑色或者白色,第一次只能在1 号节点上涂色 第二次 只能在2上涂,以此类推, 在每个节点上只能涂黑色或者白色,并且相邻的点不能有相同的颜色,最后求不 ...

  4. 【Linux学习五】文本处理

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 一.cut:显示切割的行数据f:选择显示的列s:不显示没有分隔符的行d ...

  5. Qt & VS2013 报错:There's no Qt version assigned to this project for platform Win32

    如果你想了解关于Qt与VS2013开发环境搭建,可以至此翻页. 这里主要分享环境已搭建成功,在构建项目时遇到的报错解决方案. [1]Qt 与 VS2013开发环境构建时报错 报错界面如下: 注意:对话 ...

  6. mouseTracking

    [1]mouseTracking 追踪鼠标的标志位 作用:保存窗口部件默认是否接收鼠标移动事件.此成员变量在QWidget类中. [2]Qt Assistant 解释 翻译如下: 这个属性保存部件窗口 ...

  7. Spring boot FastJson

    介绍:FastJson 是ailibaba 的一款解析Json的开源框架 使用方式1 引入jar 包 <dependency>    <groupId>com.alibaba& ...

  8. Django之真正创建一个django项目

    真正创建一个django项目 1 创建Django项目     :new-project 2 创建APP :  python manager.py startapp app01 3 setting 配 ...

  9. 使用Flask-CKEditor集成富文本编辑框

    使用Flask-CKEditor集成富文本编辑框 富文本编辑器即所见即所得编辑器,类似于文本编辑软件.它提供一系列按钮和下拉列表来为文本设置格式,编辑状态的文本样式即最终呈现出来的样式.在Web程序中 ...

  10. 校正PHP服务器时间不准的问题

    关于怎样解决PHP服务器时间不准的问题,得针对不同的情况进行不同的处理. 下面是经常遇到的情况,及应对办法. 1.PHP服务器时区不对,使用下面代码修正: <?php $timezone = & ...