Codeforces Round #666 (Div. 2) 题解报告
https://codeforces.com/contest/1397/problem/A

题意:
给定n个字符串,问重新组合以后是否能构成相同的n个字符串
思路:
直接判断所给的字符串的每种字母是否能被n整除即可。
//稍微写复杂了
#include<bits/stdc++.h>
#define ms(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
const int N = 1e5 + 100;
ll n, m, a[N], i, j;
void solve() {
ms(a, 0);
cin >> n;
string s; ll cnt = 0;
for (int i = 0; i < n; ++i) {
cin >> s; for (int j = 0; j < s.length(); ++j) {
a[s[j] - 'a']++;
}
cnt += s.length();
}
if (cnt % n != 0)cout << "NO" << endl;
else {
for(int i = 0;i < 26;++i)
if (a[i] % n != 0) {
cout << "NO" << endl;
return;
}
cout << "YES" << endl;
}
}
int main() {
//freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t; cin >> t;
while (t--) solve();
}
https://codeforces.com/contest/1397/problem/B

题意:
利用每次代价都为1的\(a_i + 1\) or \(a_i - 1\) 构建幂序列。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100100], n;
ll ans = 0x3f3f3f3f3f3f3f3f;
int main() {
//freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n; for (int i = 1; i <= n; ++i)cin >> a[i];
int lim = pow(1e18, 1.0 / n);
sort(a + 1, a + 1 + n);
for (int i = 1; i <= lim; i++) {
ll now = 0, k = 1;
for (int j = 1; j <= n; ++j) {
now += abs(k - a[j]);
k *= i;
}
ans = min(ans, now);
}
cout << ans << endl;
}
https://codeforces.com/contest/1397/problem/C

没有做出,先贴一下dalao代码
#include<iostream>
using namespace std;
int main(){
long long n; cin >> n;
long long a[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i];
cout << "1 1" << endl << a[1] * (n - 1) << endl;
(n == 1) ? cout << "1 1" << endl << "0" : cout << "2 " << n << endl;
for (int i = 2; i <= n; i++)
cout << a[i] * (n - 1) << " ";
cout << endl << "1 " << n << endl;
for (int i = 1; i <= n; i++)
cout << -a[i] * n << " ";
}
https://codeforces.com/contest/1397/problem/D
题意:
T和HL玩游戏,再给定的石堆中选择一个(但不能是上一个人取的那堆)取一个石子。一旦有一方不能取石头则判输
思路:
博弈问题,先统计所有石头数,如果sum小于mx(最多石头的一堆)的两倍或者sum为奇数则必然是T能赢,不然就是HL赢
#include<bits/stdc++.h>
using namespace std;
int main() {
//freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t; cin >> t;
while (t--) {
int n; cin >> n;
int sum = 0, mx = 0;
while (n--) {
int x; cin >> x;
sum += x;
if (x > mx)mx = x;
}
if (sum - mx < mx || sum % 2 == 1)cout << "T\n";
else cout << "HL\n";
}
}
Codeforces Round #666 (Div. 2) 题解报告的更多相关文章
- Codeforces Round #182 (Div. 1)题解【ABCD】
Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...
- Codeforces Round #608 (Div. 2) 题解
目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...
- Codeforces Round #525 (Div. 2)题解
Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...
- Codeforces Round #528 (Div. 2)题解
Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...
- Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F
Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...
- Codeforces Round #677 (Div. 3) 题解
Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...
- Codeforces Round #665 (Div. 2) 题解
Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...
- Codeforces Round #532 (Div. 2) 题解
Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出 ...
- Codeforces Round #160 (Div. 1) 题解【ABCD】
Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...
- Codeforces Round #383 (Div. 2) 题解【ABCDE】
Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接 ...
随机推荐
- 总结---Django部分(二)
Django中model的SlugField类型字段有什么用途? SlugField字段是将输入的内容中的空格都替换成'-'之后保存,Slug 是一个新闻术语,通常是某些东西的短标签.一个slug只能 ...
- 【uniapp】【外包杯】学习笔记day08 | 初具雏形+后期任务
总的来说就是BBQ了,基本上前后端都有了阶段性成果,但是问题在于是否符合我们题目的要求,所以也需要进行很详细的改动,其次就是小程序的支付功能以及登录功能1还有具体配置还是不太行. 然后下载的sprin ...
- SpringBoot接口开发
依赖的jar包<dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...
- python的列表、元组
列表(list):是Python中最常用的数据类型之一,字符串里面包含元素的是 一个个的字符,并且字符串是不可能更改的,然而列表不一样,他的每个元素都 可以是任何python类型,而且是可以被更改的 ...
- 【matlab混沌理论】1.4.双摆杆的不同参数模型
双摆杆运动模型.初始条件的微小差异,会导致千差万别的运动现象,这是混沌理论重要体现.主要考虑初始条件有两摆杆长度.质量.初始摆杆角度.重力加速度. input: % 参数定义 L1 = 1; % 第一 ...
- zookeeper JavaApi 修改节点
*修改数据 * 1.修改数据 * 2.根据版本修改 * * * */ @Test public void testSet() throws Exception{ Stat stat = new Sta ...
- Hudi 在 vivo 湖仓一体的落地实践
作者:vivo 互联网大数据团队 - Xu Yu 在增效降本的大背景下,vivo大数据基础团队引入Hudi组件为公司业务部门湖仓加速的场景进行赋能.主要应用在流批同源.实时链路优化及宽表拼接等业务场景 ...
- SpringCloud Gateway 网关
SpringCloud Gateway 网关 spring: cloud: gateway: routes: - id: after_route uri: https://example.org pr ...
- Python——第二章:元组
元组 tuple 使用小括号组成 特点: 元组是不可变的,固定了某些数据. t = ("张无忌", "赵敏", "呵呵哒") print(t ...
- springsecurity 使用浅谈(一)
1. 背景 springsecurity框架主要用于Web应用的认证和授权.所谓认证就是验证当前访问系统的是不是本系统的用户,并且要确认具体是哪个用户.而授权就是经过认证后判断当前用户是否有权 限进行 ...