Educational Codeforces Round 84 (Div. 2)
Educational Codeforces Round 84 (Div. 2)
读题读题读题+脑筋急转弯 = =。
A. Sum of Odd Integers
奇奇为奇,奇偶为偶,所以n,k奇偶性要相同。
由求和公式得k个不同奇数组成的最小数为k2,所以n≥k2。
#include <bits/stdc++.h>
using namespace std;
void solve(){
int n,k;
cin>>n>>k;
if((n-k)%2==0&&n>=1LL*k*k)
cout<<"YES\n";
else
cout<<"NO\n";
}
int main()
{
int t;cin>>t;
while(t--)
solve();
return 0;
}
B. Princesses and Princes
先模拟,后贪心。
#include <bits/stdc++.h>
using namespace std;
void solve(){
int n;cin>>n;
bool prin[n+1]={0};
bool dau[n+1]={0};
vector<int> v[n+1];
for(int i=1;i<=n;i++){
int k;cin>>k;
for(int j=0;j<k;j++){
int t;cin>>t;
v[i].push_back(t);
}
}
for(int i=1;i<=n;i++){
for(int j:v[i]){
if(!prin[j]){
dau[i]=prin[j]=true;
break;
}
}
}
for(int i=1;i<=n;i++){
if(!dau[i]){
for(int j=1;j<=n;j++){
if(!prin[j]){
cout<<"IMPROVE\n";
cout<<i<<' '<<j<<"\n";
return;
}
}
}
}
cout<<"OPTIMAL\n";
}
int main()
{
int t;cin>>t;
while(t--)
solve();
return 0;
}
C. Game with Chips
先把所有点移至一角,然后遍历整个方块。
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;cin>>n>>m;
string ans;
ans+=string(n-1,'D');
ans+=string(m-1,'R');
for(int i=0;i<m;i++){
ans+=string(n-1,"UD"[i&1]);
if(i!=m-1) ans+="L";
}
cout<<ans.size()<<"\n";
cout<<ans<<"\n";
return 0;
}
E. Count The Blocks
中间情况:i长块在n长数中有n-i+1种位置,左右两位各有9种可能,其余n-i-2位各10种可能,i长块本身10种可能。
边界情况:i长块有2种位置,左或右有9种可能,其余n-i-1位各10种可能,i长块本身10种可能。
全长情况:i长块有1种位置,i长块本身10种可能。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;
ll qpow(ll a,ll b){
ll ret=1;
while(b>0){
if(b&1) ret=ret*a%mod;
a=a*a%mod;
b>>=1;
}
return ret;
}
int main()
{
int n;cin>>n;
for(int i=1;i<n;i++){
ll sum=0;
sum+=2*9*10*qpow(10,n-i-1)%mod,sum%=mod;//边界情况
sum+=(n-i-1)*9*10*9*qpow(10,n-i-2)%mod,sum%=mod;//中间情况
cout<<sum<<" ";
}
cout<<"10"<<"\n";
return 0;
}
Educational Codeforces Round 84 (Div. 2)的更多相关文章
- Educational Codeforces Round 84 (Rated for Div. 2)
A. Sum of Odd Integers(思维) 思路 这一题看完ans之后觉得是真简单,不过有一些地方还是要理解的. 这一题输出YES,有两个条件 kk%2 == n%2k,这个条件的意思是 k ...
- Educational Codeforces Round 58 Div. 2 自闭记
明明多个几秒就能场上AK了.自闭. A:签到. #include<iostream> #include<cstdio> #include<cmath> #inclu ...
- Educational Codeforces Round 47 (Div 2) (A~G)
目录 Codeforces 1009 A.Game Shopping B.Minimum Ternary String C.Annoying Present D.Relatively Prime Gr ...
- Educational Codeforces Round 46 (Div 2) (A~G)
目录 Codeforces 1000 A.Codehorses T-shirts B.Light It Up C.Covered Points Count(差分) D.Yet Another Prob ...
- Educational Codeforces Round 45 (Div 2) (A~G)
目录 Codeforces 990 A.Commentary Boxes B.Micro-World C.Bracket Sequences Concatenation Problem D.Graph ...
- Educational Codeforces Round 85 (Div. 2)
题目链接:https://codeforces.com/contest/1334 A. Level Statistics 题意 一个关卡有玩家的尝试次数和通关次数,按时间顺序给出一个玩家 $n$ 个时 ...
- Educational Codeforces Round 86 (Div. 2)
比赛链接:https://codeforces.com/contest/1342 A - Road To Zero 题意 有两个非负整数 x, y 以及两种操作: 支付 a 点代价使其中一个数加一或减 ...
- Educational Codeforces Round 119 (Div. 2), (C) BA-String硬着头皮做, 能做出来的
题目链接 Problem - C - Codeforces 题目 Example input 3 2 4 3 a* 4 1 3 a**a 6 3 20 **a*** output abb abba b ...
- Educational Codeforces Round 108 (Div. 2), C map套vector存储
地址 Problem - C - Codeforces 题目 题意 一个学校有n个人参加比赛,他们分别属于ui队,每个人的能力值为si 当每个队需要1~n个人的时候,这个学校能参加的人的能力值和最大 ...
随机推荐
- PHP 导入Excel数据 到数据库
/** * 导入excel * @throws \PHPExcel_Exception * @throws \PHPExcel_Reader_Exception */ public function ...
- 二 prometheus 监控 Redis
Prometheus 监控Redis需要用到redis_exporter客户端, Prometheus -> redis_exporter这个模式, 类似监控Mysql 一个思路. 1 ) 设置 ...
- 虚拟机linux共享文件夹
linux共享文件夹问题 1. 初配置 2. 挂载 018.7.8 为了实现win7与VMware中linux文件夹共享很花费了一些时间,但终成正果 1. 初配置 虚拟机设置->选项->共 ...
- AgileConfig - RESTful API 介绍
AgileConfig AgileConfig是一个基于.net core开发的轻量级配置中心. AgileConfig秉承轻量化的特点,部署简单.配置简单.使用简单.学习简单,它只提取了必要的一些功 ...
- ctfhub技能树—文件上传—文件头检查
打开靶机 尝试上传一个php文件 抓包修改 放包 制作图片马 上传图片马,并修改文件类型为png 测试连接 查找flag 成功拿到flag
- vxfs(Veritas File System)扩充目录大小
1.新增加一个磁盘并初始化 # vxdisk list # vxdisksetup -i 3pardata0_22 2.将新增加的磁盘合并到磁盘组中 # vxdg -g testdg01 adddis ...
- Inlook - 你的私人工作助理 V1.0.0.2
Inlook - Your personal assistant 中文版|English version Introduction Inlook是为在桌面上直观地提醒用户收到未读邮件和日程安排而开发的 ...
- 本地jar添加到本地仓库 本地jar依赖无效问题
最近工作发生了一个很奇怪的事情,我在本地写了一个项目,打包成jar,然后敲命令mvn install:install-file -DgroupId=com.yzwine -DartifactId=yz ...
- STGAN: A Unified Selective Transfer Network for Arbitrary Image Attribute Editing 阅读笔记和pytorch代码解读
一.论文采用的新方法 1.AttGan中skip connect的局限性 由于encoder中对特征的下采样实际上可能损失部分特征,我们在decoder中进行上采样和转置卷积也无法恢复所有特征,因此A ...
- 探索微软开源Python自动化神器Playwright
相信玩过爬虫的朋友都知道selenium,一个自动化测试的神器工具.写个Python自动化脚本解放双手基本上是常规的操作了,爬虫爬不了的,就用自动化测试凑一凑. 虽然selenium有完备的文档,但也 ...