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个人的时候,这个学校能参加的人的能力值和最大 ...
随机推荐
- 【Java基础】Java8 新特性
Java8 新特性 Lambda 表达式 Lambda 是一个匿名函数,我们可以把 Lambda 表达式理解为是一段可以传递的代码(将代码像数据一样进行传递).使用它可以写出更简洁.更灵活的代码. L ...
- java环境配置-win10(傻瓜式教程)
java环境配置 – 小学弟要开始学java了,由于本人较懒,表达能力有限,所以来这,写一篇简单的指导,帮学弟装下java环境. 首先打开浏览器,输入这个网址https://www.oracle.co ...
- 【EXP/IMP】问题总结
为了使测试与生产数据保持一致,只需要导出数据的时候,可以将测试库的表truncate,保留其它如索引,trigger,constraints,grants等不用再重新导. exp时候rows=y,其它 ...
- 【MYSQL】win7安装mysql-5.7.10绿色版
1.下载 :mysql下载地址 2.解压缩 3.环境变量配置 MYSQL_HOME=D:\mysql-5.7.11-win32 PATH=%MYSQL_HOME%\bin 4.修改配置文件 a.)将m ...
- kubernets集群的安全防护(上)
一 了解认证机制 1.1 API的服务器在接收来自客户端的请求的时候会对发起的用户进行几个步骤 认证插件进行认证,确认发起的用户是外部用户,还是集群中的某个命名空间里面的pod 确认用户属于哪个 ...
- vue路由切换和用location切换url的区别
最近的业务涉及到了axios的拦截器,要在request.js里面要根据状态码来跳转页面,这时候我就面对了几种跳转选择: 1.使用location.href='/url'来跳转,简单方便,但是刷新了页 ...
- Dubbo的设计理念原来就藏在这三张图中
Dubbo在众多的微服务框架中脱颖而出,占据RPC服务框架的半壁江山,非常具有普适性,熟练掌握 Dubbo的应用技巧后深刻理解其内部实现原理,让大家能更好的掌控工作,助力职场,特别能让大家在面试中脱颖 ...
- 跨平台导PDF,结合wkhtmltopdf很顺手
前言 好东西要分享,之前一直在使用wkhtmltopdf进行pdf文件的生成,常用的方式就是先安装wkhtmltopdf,然后在程序中用命令的方式将对应的html生成pdf文件,简单而且方便:但重复的 ...
- dubbo快速入门demo
参考文章 https://blog.csdn.net/abcwanglinyong/article/details/81906027 该demo包含三个项目,分别是: 服务提供端项目:provider ...
- 网络编程 — Windows TCP服务端和客户端
1. 服务端 #include <iostream> #include <signal.h> #include <forward_list> #include &l ...