A:

尽可能平均然后剩下的平摊

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx=2;
int n,m,a,b;
int read(){
char c=getchar();int x=0,f=1;
while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();}
return x*f;
}
int main()
{
n=read();
while(n--){
ll kk,kkk,res;
a=read(),b=read();
kk=b/a;
kkk=b%a;
b%=a;
res=(a-kkk)*(kk*kk);
res+=kkk*(kk+1)*(kk+1);
printf("%lld\n",res);
}
return 0;
}

B 

逆着思维从0开始操作,会发现两边加起来肯定是3*(k+x+y+...),然后在保证下最小的数起码得大于x+y+z...就行

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx=2;
ll n,m;
ll a,b;
ll mi;
ll read(){
char c=getchar();ll x=0,f=1;
while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();}
return x*f;
}
int main()
{
n=read();
while(n--){
a=read(),b=read();
mi=min(a,b);
if((a==1&&b==1)||(a==2&&b==2)){puts("NO");continue;}
ll ans=a+b;
if(ans%3==0){
if((ans/3)>mi){puts("NO");continue;}
else {puts("YES");continue;}
}
else puts("NO");
}
return 0;
}

 c

有一个超长围栏

l r

从0开始,第i块板下标是l的倍数,刷红色,是r的倍数,刷蓝色,同时是l,r的倍数,红蓝都可以。

然后有颜色的板子连起来,如果有k个板子的颜色一模一样,你就死定了。

        // In God We Trust

# include <bits/stdc++.h>
using namespace std; # define INF 1 << 31 - 1
# define pb push_back
# define fi first
# define se second int gcd(int a, int b)
{
// Everything divides 0
if (a == 0)
return b;
if (b == 0)
return a; // base case
if (a == b)
return a; // a is greater
if (a > b)
return gcd(a % b, b);
return gcd(a, b % a);
} signed main() {
cout<<__gcd(8,12);
int t;
cin >> t;
int r, b, k;
for (int i = 0; i <t; i++){
cin >> r >> b >> k;
if ( r == b ){
cout << "obey" << endl ;
continue;
}
int g = gcd(r, b);
int n = max(r, b) / g;
int m = min(r, b) / g;///简化
int l = n / m;
if (m == 1)///模拟一下就知道为什么
l --;
else if (n % m != 1)///我们可以理解为,n到2n,2n到3n,3n到4n。。。。等于1相当于某一段n的区间内m的倍数接下来下一个数字就是n,之间没有多出一个数字,也就是说如果不等于1,中间空出来几个数字会提供m的倍数几个位置导致在下一段的n区间内,第一个m的倍数字可以前移了,那么肯定是可以再提供一个数字的在此区间里!!
l ++;
if (l < k)
cout << "obey" << endl;
else
cout << "rebel" << endl;
} }

  

Educational Codeforces Round 77 (Rated for Div. 2)的更多相关文章

  1. 【cf比赛记录】Educational Codeforces Round 77 (Rated for Div. 2)

    比赛传送门 这场题目前三题看得挺舒服的,没有臃肿的题目,对于我这种英语渣渣就非常友好,但因为太急了,wa了两发A后才意识到用模拟(可以删了,博主真的是个菜鸟),结果导致心态大崩 ---- 而且也跟最近 ...

  2. Educational Codeforces Round 77 (Rated for Div. 2) D A game with traps

    题意:x正轴上有着一个陷阱的位置,开关和灵敏度,如果一个士兵灵敏度输给陷阱,他是过不去这个陷阱的幸运的是,你可以先过去把开关给关了,没错你是不怕陷阱的接下来呢你有操作,你移动一个,耗费一秒而你的团队需 ...

  3. Codeforce |Educational Codeforces Round 77 (Rated for Div. 2) B. Obtain Two Zeroes

    B. Obtain Two Zeroes time limit per test 1 second memory limit per test 256 megabytes input standard ...

  4. Educational Codeforces Round 77 (Rated for Div. 2)D(二分+贪心)

    这题二分下界是0,所以二分写法和以往略有不同,注意考虑所有区间,并且不要死循环... #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> ...

  5. Educational Codeforces Round 77 (Rated for Div. 2) - D. A Game with Traps(二分)

    题意:$m$个士兵,每个士兵都有一个灵敏度$a[i]$,起点为$0$,终点为$n + 1$,在路上有$k$个陷阱,每个陷阱有三个属性$l[i],r[i],d[i]$,$l[i]$表示陷阱的位置,如果你 ...

  6. Educational Codeforces Round 77 (Rated for Div. 2) C. Infinite Fence

    C. Infinite Fence 题目大意:给板子涂色,首先板子是顺序的,然后可以涂两种颜色,如果是r的倍数涂成红色,是b的倍数涂成蓝色, 连续的k个相同的颜色则不能完成任务,能完成任务则输出OBE ...

  7. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  8. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  9. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

随机推荐

  1. 在5分钟内将Spring Boot作为Windows服务启动

    分享优锐课学习笔记~来看一下如何使用Spring Boot创建Windows服务以及通过配置详细信息来快速启动并运行. 最近不得不将Spring Boot应用程序部署为Windows服务,感到惊讶的是 ...

  2. Dubbo学习系列之七(分布式订单ID方案)

    既然选择,就注定风雨兼程! 开始吧! 准备:Idea201902/JDK11/ZK3.5.5/Gradle5.4.1/RabbitMQ3.7.13/Mysql8.0.11/Lombok0.26/Erl ...

  3. 云服务器+域名+hexo 搭建博客

    1 阿里云服务器安全组规则中启用80,4000,22端口, 记得出方向也要设置,否则... 2 域名指向服务器ip 3 安装git yum install git 4 安装node.js 下载地址为: ...

  4. Nginx(四)-- Nginx的扩展-OpenRestry

    1. OpenResty 安装及使用 OpenResty 是一个通过 Lua 扩展 Nginx 实现的可伸缩的 Web 平台,内部集成了大量精良的 Lua 库.第三方模块以及大多数的依赖项.用于方便地 ...

  5. flask之分析线程和协程

    flask之分析线程和协程 01 思考:每个请求之间的关系 我们每一个请求进来的时候都开一个进程肯定不合理,那么如果每一个请求进来都是串行的,那么根本实现不了并发,所以我们假定每一个请求进来使用的是线 ...

  6. 一遍文章搞清楚VO、DTO、DO、PO的概念、区别

    作者:Cat Qi 概念: VO(View Object):视图对象,用于展示层,它的作用是把某个指定页面(或组件)的所有数据封装起来. DTO(Data Transfer Object):数据传输对 ...

  7. DS-5获取License

    1.点击Eclipse for DS-5,打开DS-5,弹出workspace选择窗口   2.点击OK,打开DS-5,弹出License窗口,license需要自己去解决

  8. Spring Boot 外部化配置(二) - @ConfigurationProperties 、@EnableConfigurationProperties

    目录 3.外部化配置的核心 3.2 @ConfigurationProperties 3.2.1 注册 Properties 配置类 3.2.2 绑定配置属性 3.1.3 ConfigurationP ...

  9. 安装完PyCharm,启动时弹出Failed to load JVM DLLbinserverjvm

    安装完PyCharm,启动时弹出"Failed to load JVM DLL\bin\server\jvm.dll"解决方案 问题描述:打开PyCharm时,弹出"Fa ...

  10. Maven pom.xml 全配置(二)不常用配置

    Maven pom.xml 全配置(二)不常用配置 这里贴出Maven pom.xml文件中使用率较少的配置参数,如果此篇文档中没有找到你想要的参数,移步Maven pom.xml 全配置(一)常用配 ...