05 2020 档案

摘要:A - Sorted Adjacent Differences 题意:对一组数重新排序,使得相邻两数的差的绝对值不减小 思路:我一开始不会做,后来看别人的,找到中位数。所以讲述从大到小排列,后从中位数开始向两头找,因为相差越远差值越大 #include<iostream> #include<algo 阅读全文
posted @ 2020-05-30 20:03 CHUNIN 阅读(125) 评论(0) 推荐(0)
摘要:A - Candies 题意:求出x,x满足 x+2x+4x+⋯+2^(k−1)x=n 思路:提取x,后面构成等比数列,求和,然后暴力求解 代码: #include<bits/stdc++.h> using namespace std; #define ll long long ll pai(int 阅读全文
posted @ 2020-05-25 19:01 CHUNIN 阅读(108) 评论(0) 推荐(0)
摘要:A - Phoenix and Balance 题意:给你一个n(n为偶数),将从2^1到2^n平均分为两份,是差的绝对值最小 思路:1.错误思路:(这题做过)我最开始我想将首尾相加,在分一半; 代码: #include<iostream>#include<cstdio>#include<cmath 阅读全文
posted @ 2020-05-20 22:02 CHUNIN 阅读(100) 评论(0) 推荐(0)
摘要:D. Dividing by Two 题意:偶数除二,奇数加一,直到两数相等,需要多少次 ac代码: #include<iostream> using namespace std; #define ll long long int main(){ ll a,b,sum=0; cin>>a>>b; w 阅读全文
posted @ 2020-05-08 17:02 CHUNIN 阅读(106) 评论(0) 推荐(0)
摘要:B 随机序列 题意:算方差和极差,超简单 ac代码: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; #define ll long long #define N 10004 int main( 阅读全文
posted @ 2020-05-08 12:52 CHUNIN 阅读(78) 评论(0) 推荐(0)