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. BIOS安全设置

    1.开机按F2进入BIOS 2.进入 Security 界面 3.Set user password 用户密码 开机密码 设置为123456 4.Set supervisor password 进BI ...

  2. Orleans 初接触(一) 入门例子

    [返回导航] 在简单了解了Orleans 之后我们可以通过几个例子去加深印象 一.Orleans入门例子 这个例子是跟着<Orleans入门例子>(https://www.cnblogs. ...

  3. ELK输出nginx的日志(未完成)

    我们先准备3台centos7服务器 171 做 elasticsearch,kibana的操作 172 做logstash 的操作 173 做nginx 的操作 软件 版本号 elasticsearc ...

  4. CSS3新特性简单总结(持续补充常用到的情景)

    1.CSS3边框border-radius 左上右下box-shadow box-shadow: 水平阴影(可负值,必) 垂直阴影(可负值,必) 模糊距离 阴影尺寸 颜色颜色 inset(将外部阴影改 ...

  5. 聊聊 Python 的内置电池

    本文原创并首发于公众号[Python猫],未经授权,请勿转载. 原文地址:https://mp.weixin.qq.com/s/XzCqoCvcpFJt4A-E4WMqaA (一) 最近,我突然想到一 ...

  6. SpringBoot内容聚合

    分类整理一些内容,方便需要时回过头来看,整理不易,如有疏漏,请多担待!之后要查看这篇文章,公众号后台回复 “Springboot聚合” SpringBoot+Mybatis多模块(module)项目搭 ...

  7. Gradle-构建脚本

    构建语言 Gradle提供了一种领域特定语言,目前同时支持 Groovy 和 Kotlin . 在 Groovy 构建脚本中(.gradle) 你可以使用任何 Groovy 元素. 在 Kotlin ...

  8. 百度大脑UNIT3.0详解之嵌入式对话理解技术

    相信很多人都体验过手机没有网时的焦虑,没有网什么也做不了.而机器人也会遇到这样的时刻,没有网或者网络环境不好的情况下,无法识别用户在说什么,也无法回复用户.在AIoT(AI+物联网)飞速普及的现在,智 ...

  9. C#的语法----程序结构(3)

    练习2 对于学员成绩的评测  成绩>=90:A  成绩>=80&&成绩<90:B  成绩>=70&&成绩<80:C  成绩>=60& ...

  10. PageRank算法小结

    PageRank 这个学期选了数据挖掘的课程,期末要做一个关于链接分析算法的报告,这是PR算法的小结. 算法 PR算法基于等级权威的思想,及不仅考虑指向该网页的链接数,同时也考虑指向该网页网站的重要程 ...