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 题解 直接 ...
随机推荐
- tableau用数值呈现条形图的总计
创建计算字段 创建计算字段:销售额总计,键入函数: IF Size()=1 THEN 0 ELSE Sum([销售额]) END 创建视图 将度量"销售额"拖放至列,将维度&quo ...
- Kotlin协程系列(二)
在进行业务开发时,我们通常会基于官方的协程框架(kotlinx.coroutines)来运用Kotlin协程优化异步逻辑,不过这个框架过于庞大和复杂,如果直接接触它容易被劝退.所以,为了我们在后续的学 ...
- Netty源码学习6——netty编码解码器&粘包半包问题的解决
系列文章目录和关于我 零丶引入 经过<Netty源码学习4--服务端是处理新连接的&netty的reactor模式和<Netty源码学习5--服务端是如何读取数据的>的学习, ...
- 嵌入式linux主机通过分区镜像生成固件,DD备份分区后打包成固件,px30刷机教程 ,rockchip刷机教程
我这边有一个工控路由器因为刷机变砖了,网上下载不到固件,自己暂时还没有搞过编译.我找到了同型号的路由器,把它的系统制作成镜像. 具体操作分为三步: 第一步,直接用DD命令备份了几个分区,分区我暂时还不 ...
- 初探webpack之单应用多端构建
初探webpack之单应用多端构建 在现代化前端开发中,我们可以借助构建工具来简化很多工作,单应用多端构建就是其中应用比较广泛的方案,webpack中提供了loader与plugin来给予开发者非常大 ...
- Android12版本闹钟服务崩溃问题
原文地址: Android12版本闹钟服务崩溃问题 - Stars-One的杂货小窝 公司项目app线上出现的崩溃记录问题,崩溃日志如下所示: Caused by java.lang.Security ...
- 深入解析LLaMA如何改进Transformer的底层结构
本文分享自华为云社区<大语言模型底层架构你了解多少?LLM大底层架构之LLM模型结构介绍>,作者: 码上开花_Lancer . 大语言模型结构当前绝大多数大语言模型结构都采用了类似GPT ...
- 基于winform(C#)的飞鸟小游戏
本项目是一款基于C# (winform)版本的飞鸟小游戏,是一款益智类游戏 其效果如下图所示 如上图所示为飞鸟游戏的初始化界面: 可以看到游戏包含了四个功能: 启动 注册 登陆 排行榜 启动:是用于开 ...
- 24、Go语言中的OOP思想
1.是什么? OOP:面向对象 Go语言的解构体嵌套 1.模拟集成性:is - a type A struct { field } type B struct { A // 匿名字段 } 这种方式就会 ...
- Cisco 交换机利用CDP数据自动绘制网络拓扑图[drawio]-实践
进行网络运维,必须对网络拓扑情况进行详细的掌握,但是网络改动后,更新网络拓扑比较繁琐,维护人员容易懈怠,久而久之,通过人工绘制的网络拓扑很容易与现有网络出现偏差. 现在,可以通过python 丰富的库 ...