比赛传送门

这场题目前三题看得挺舒服的,没有臃肿的题目,对于我这种英语渣渣就非常友好,但因为太急了,wa了两发A后才意识到用模拟(可以删了,博主真的是个菜鸟),结果导致心态大崩 ---- 而且也跟最近的生活学习有点关系 ----补了B,跟C题。B题还是有点可惜的,没有做出来。

A

// http://codeforces.com/contest/1260/problem/A
/*
因为可以把 sum 分成 c 份(每份可以用 0 来补充)
所以要想最小,可以直接取接近中间值的数再平方
下面用模拟实现
*/
#include<iostream>
#include<cstdio>
using namespace std; int n;
int c, sum; int main()
{
scanf("%d", &n);
while(n--){
scanf("%d %d", &c, &sum);
if(c >= sum){
printf("%d\n", sum);
}
else if(c == 1){
printf("%d\n", sum * sum);
}
else {
int ans = 0;
while(c > 0){
int d = sum / c;
ans += d * d;
c--;
sum -= d;
}
printf("%d\n", ans);
}
}
return 0;
}

B

// http://codeforces.com/contest/1260/problem/B
/*
分析:

a = x_1 + x_2 + ... + x_k
则 b = 2 * x_1 + 2 * x_2 + ... + 2 * x_k = 2 * (x_1 + x_2 + ... + x_k) = 2 * a
由此可以看出 ---- 若输出 YES b 的最大值为 2a
所以有条件一 a * 2 >= b ①
a + b = 3 * (x_1 + x_2 + ... + x_k)
可见 (a + b) % 3 == 0 ②
*/
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std; int n, a, b; int main()
{
scanf("%d", &n);
while(n--){
scanf("%d %d", &a, &b);
if(a > b) swap(a, b); // 保证 b > a
if((a + b) % 3 == 0 && a * 2 >= b) printf("YES\n");
else printf("NO\n");
}
return 0;
}

C

// https://codeforces.com/contest/1260/problem/C
/*
题意:给木板涂色,要求不能有连续 k 块的颜色一样(没有涂色的木板不计入)
知识点 ---- gcd(int, int) 求两数的最大公约数
当 gcd(r, b) == 1 时(即两数互为质数), 当 r b 相近的时候,如果先涂了r,那么下一个就是 b
此时,要检查 r b 二者差距是否过大 ---- 即要符合
(k - 1) * r + 1 >= b 即连续的第 k-1 格上涂的 r 会比前面一格(因为 gcd() == 1)要大于等于 b
所以,对于 gcd(r, b) > 1 时只需要把它们都除以自己的最大公约数就可以互为质数了
注意会爆 int 范围
*/
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std; typedef long long LL;
LL T, r, b, k; LL gcd(LL a, LL b){
if(b == 0) return a;
else return gcd(b, a % b);
} int main()
{
scanf("%I64dd", &T);
while(T--){
scanf("%I64d %I64d %I64d", &r, &b, &k);
if(r > b) swap(r, b);
LL d = gcd(b, r);
b /= d; r /= d;
if((k - 1) * r + 1 >= b){
printf("OBEY\n");
}
else printf("REBEL\n");
}
return 0;
}

掉分了

【cf比赛记录】Educational Codeforces Round 77 (Rated for Div. 2)的更多相关文章

  1. 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]$表示陷阱的位置,如果你 ...

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

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

  3. Educational Codeforces Round 77 (Rated for Div. 2)

    A: 尽可能平均然后剩下的平摊 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int ...

  4. 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 ...

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

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

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

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

  7. Educational Codeforces Round 53 (Rated for Div. 2) (前五题题解)

    这场比赛没有打,后来补了一下,第五题数位dp好不容易才搞出来(我太菜啊). 比赛传送门:http://codeforces.com/contest/1073 A. Diverse Substring ...

  8. Educational Codeforces Round 69 (Rated for Div. 2) E. Culture Code

    Educational Codeforces Round 69 (Rated for Div. 2) E. Culture Code 题目链接 题意: 给出\(n\)个俄罗斯套娃,每个套娃都有一个\( ...

  9. Educational Codeforces Round 65 (Rated for Div. 2)题解

    Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...

随机推荐

  1. GitHub的高级搜索功能

    1. 首先,提供Github高级搜索帮助页面https://help.github.com/categories/search/     2. 搜索语法https://help.github.com/ ...

  2. 科xue上网工具

    原来这样严格了吗 收藏一个工具列表: http://next.36kr.com/posts/collections/75

  3. 《STL源码剖析》——Array

    array array本身内容较少,日常使用也不是很多,里面也没有很高深的技巧 1 array的基本架构 了解array的架构需要一个额外的语法知识: int a[100]; int [100]b; ...

  4. Redis 分析部分功能所解决的问题

    前言:说到缓存,大家都会想到redis,而redis中又有各种眼花缭乱的功能,今天就来看看这些功能能解决的问题. Redis官方简介 Redis是一个基于BSD开源的项目,是一个把结构化的数据放在内存 ...

  5. go 中string[0]到底是rune还是byte?

    好像没区别,对吧? 来看个全面的对比: package main import ( "fmt" "reflect") func main(){ asci:=&q ...

  6. 用chrome的snippets片段功能创建页面js外挂程序,从控制台创建js小脚本

    用chrome的snippets片段功能创建页面js外挂程序,从控制台创建js小脚本 Chrome的snippets是小脚本,还可以创作并在Chrome DevTools的来源面板中执行.可以访问和从 ...

  7. Go 语言基础语法-Go

    Go 标记 Go 程序可以由多个标记组成,可以是关键字,标识符,常量,字符串,符号.如以下 GO 语句由 6 个标记组成: fmt.Println("Hello, World!") ...

  8. ffmpeg 基本数据结构和对象(一): AVPacket、AVPicture、AVFrame

    来源:http://blog.csdn.net/chance_yin/article/details/16817957 一.AVPacket /** * AVPacket 作为解码器的输入 或 编码器 ...

  9. kubernetes学习之二进制部署1.16

    服务器规划和系统初始化 一.服务器规划 10.255.20.205 Master01 kube-apiserver.kube-controller-manager.kube-scheduler.ETC ...

  10. (原)netbeans中使用libtorch

    转载请注明处处: https://www.cnblogs.com/darkknightzh/p/11479330.html 说明:第一种方式在netbeans中无法debug代码,设置了断点也不会在断 ...