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. Python爬虫之cookie的获取、保存和使用【新手必学】

    前言本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理.作者:huhanghao Cookie,指某些网站为了辨别用户身份.进行ses ...

  2. jquery (内置遍历数组的函数,事件)

    内置遍历数组的函数: 1. $.map(array, function() { }); 取到数组或者对象array中每一项进行遍历  然后在function中处理: var attr = [1,2,3 ...

  3. v-if和v-show 的区别

    区别 1.手段:v-if是通过控制dom节点的存在与否来控制元素的显隐:v-show是通过设置DOM元素的display样式,block为显示,none为隐藏: 2.编译过程:v-if切换有一个局部编 ...

  4. 【Eclipse】Spring Tool Suite插件

    Spring Tool Suite插件 最新下载地址:https://spring.io/tools3/sts/all 以前下载地址:https://spring.io/tools3/sts/lega ...

  5. intellij cpu占有高解决办法(亲测有效!)

    File---Settings---Inspections---把勾都去掉或者选自己需要的部分.

  6. express 中间件的简单应用与实现

    express 中间件的简单应用与实现 看了慕课网双越老师的课之后结合自己的理解做了一些简单的总结,如有不恰当之处,欢迎指正. 提到 express 就不得不提到中间件,接下来就简单的介绍一下 exp ...

  7. Linux服务器部署.Net Core笔记:二、安装FTP

    1.安装 安装ftp:yum install -y vsftpd 将ftp设置开机启动:systemctl enable vsftpd.service 2.配置 安装好后在ftp配置文件里进行配置 : ...

  8. c++-多态小案例

    多态小案例 C面向接口编程和C多态 函数类型语法基础 函数指针做函数参数(回调函数)思想剖析 函数指针做函数参数两种用法(正向调用.反向调用) 纯虚函数 抽象类 抽象类基本概念 抽象类在多继承中的应用 ...

  9. Hack the Breach 2.1 VM (CTF Challenge)

    主机扫描: ╰─ nmap -p- -A 192.168.110.151Starting Nmap 7.70 ( https://nmap.org ) at 2019-08-29 09:48 CSTN ...

  10. 区块链技术驱动金融.mobi

    链接:https://pan.baidu.com/s/1yY8f_PglsPoudb76nru9Ig 提取码:c58o 想一起学习区块链的朋友可以加好友一个学习哦,共同进步