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 题解 直接 ...
随机推荐
- LOG日志系统
# coding=utf-8 import datetime import logging import os import sys from logging.handlers import Time ...
- teleport 服务端配置文件说明
teleport 服务端配置文件说明 teleport配置文件位于/usr/local/teleport/data/etc目录下.服务器端包含两个配置文件: core.ini 和 web.ini,其中 ...
- 数字孪生与GIS结合,为智慧交通带来的改变
在当代社会,交通问题已经成为城市发展中的一个重要挑战.交通拥堵.安全隐患.环境污染等问题给人们的出行带来了许多不便和困扰.然而,随着数字孪生技术与地理信息系统(GIS)的融合,我们迎来了智慧交通的新时 ...
- Date、正则表达式练习
Date.正则表达式练习 package com.guoba.date; import java.text.SimpleDateFormat; import java.util.Calendar; i ...
- 如何用python脚本制作生成CANdbc
最近在工作中,有同事拿了一个excel的dbc表格,在用官方的dbc工具一个一个创建信号,大概看了一下共累计20多个节点,300多个信号,居然在手动处理,顿感无语.. 于是在网络上搜相关的dbc 通过 ...
- 【csharp】抽象类与接口有哪些不同?什么时候应该使用抽象类?
抽象类与接口有哪些不同? 抽象类和接口是在面向对象编程中两个不同的概念,它们有一些重要的区别.以下是抽象类和接口的主要不同点: 抽象类(Abstract Class): 成员类型: 抽象类可以包含抽象 ...
- 【scikit-learn基础】--『监督学习』之 随机森林分类
随机森林分类算法是一种基于集成学习(ensemble learning)的机器学习算法,它的基本原理是通过对多个决策树的预测结果进行平均或投票,以产生最终的分类结果. 随机森林算法可用于回归和分类问题 ...
- 基于Atlas 200 DK的原版YOLOv3(基于Darknet-53)实现(Python版本)
[摘要]本文将为大家带来使用Atlas 200 DK的原版YOLOv3(基于Darknet-53)实现的展示. 前言 YOLOv3可以算作是经典网络了,较好实现了速度和精度的Trade off,成为和 ...
- MySQL数据库技术与应用:数据查询
摘要:数据查询是数据库系统应用的主要内容,也是用户对数据库最频繁.最常见的基本操作请求. 数据查询 数据查询是数据库系统应用的主要内容,也是用户对数据库最频繁.最常见的基本操作请求.数据查询可以根据用 ...
- 当AI抄起了水表
摘要:一套AI工作流,既减轻水表抄表工的负担,也保证了普通百姓用水数据的真实. 本文分享自华为云社区<行业案例:当AI抄起水表,一套工作流打通水务智能的"任督二脉">, ...