A. New Year and the Christmas Ornament

签到。

 #include <bits/stdc++.h>
using namespace std; int a, b, c; int main()
{
while (scanf("%d%d%d", &a, &b, &c) != EOF)
{
int res = min(a, min(b - , c - ));
printf("%d\n", res * + );
}
return ;
}

B. New Year and the Treasure Geolocation

签到。

 #include <bits/stdc++.h>
using namespace std; #define N 1010
int n, x[N], y[N], a[N], b[N]; int main()
{
while (scanf("%d", &n) != EOF)
{
for (int i = ; i <= n; ++i) scanf("%d%d", x + i, y + i);
for (int i = ; i <= n; ++i) scanf("%d%d", a + i, b + i);
sort(x + , x + + n);
sort(y + , y + + n);
sort(a + , a + + n);
sort(b + , b + + n);
printf("%d %d\n", x[] + a[n], y[] + b[n]);
}
return ;
}

C. New Year and the Sphere Transmission

Solved.

题意:

有一个环,长度为n,有n个点,标号为1-n,固定步长去走,求回到1的时候经过的点的标号总和多少

求出有多少个步长得到的这个标号总和不同,按从小到大顺序输出

思路:

如果步长是n的因数,那么可以在一轮走完,并且不同的因数走的路径不同,答案也不同

如果不是n的因数,那么一轮肯定走不完,到下一轮,相当于换个起点去走,也走不完,

直到起点回到1,这时候所有点都走完了,答案都是相同的

 #include <bits/stdc++.h>
using namespace std; #define ll long long
ll n; ll f(int an, int n)
{
return 1ll * ( + an) * n / ;
} int main()
{
while (scanf("%lld", &n) != EOF)
{
ll limit = sqrt(n) + ;
vector <ll> res; res.push_back(); res.push_back(n * (n + ) / );
for (int i = ; i <= limit; ++i) if (n % i == )
{
res.push_back(f(n + - i, n / i));
res.push_back(f(n + - n / i, i));
}
sort(res.begin(), res.end());
res.erase(unique(res.begin(), res.end()), res.end());
for (int i = , len = res.size(); i < len; ++i) printf("%lld%c", res[i], " \n"[i == len - ]);
}
return ;
}

D. New Year and the Permutation Concatenation

Solved.

题意:

给出一个n,如此构造一个序列,将他的所有排列按字典序大小放进去

问可以选多少个起点,使得以起点之后长度为n的子段的和为$\frac {n \cdot (n + 1)}{2}$

思路:

考虑两个相邻序列如果可以有这样的起点,那么必定是他们的公共前缀里的点,并且贡献就是公共前缀长度 + 1

再考虑 我们固定一个公共前缀的长度为x,那么这样的排列一共有$(n - x)!$种

并且这些排列肯定是连续在一起的,那么就可以算贡献了

枚举公共前缀长度就好了

 #include <bits/stdc++.h>
using namespace std; #define ll long long
const ll MOD = (ll);
int n; int main()
{
while (scanf("%d", &n) != EOF)
{
if (n <= )
{
printf("%d\n", n);
continue;
}
ll res = n - ;
for (int i = ; i <= n; ++i) res = (res * i) % MOD;
ll tot = ;
for (int i = n; i >= ; --i)
{
tot = (tot * i) % MOD;
res = (res - tot + MOD) % MOD;
}
printf("%lld\n", res);
}
return ;
}

E. New Year and the Acquaintance Estimation

Unsolved.

题意:

有n个点,给出每个点的度数,每个点最多去掉一个度,令$x = 去掉的度数之和$

求合法图中不同的$x个数,从小到大输出$

Good Bye 2018 Solution的更多相关文章

  1. Good Bye 2018 (A~F, H)

    目录 Codeforces 1091 A.New Year and the Christmas Ornament B.New Year and the Treasure Geolocation C.N ...

  2. Good Bye 2018

    Good Bye 2018 2018年最后一场CF,OVER! 弱弱的我只能做出3道A,B,D~~~~ 最后几分钟,感觉找到了C题的规律,结束的那一刻,提交了一发 "Wrong answer ...

  3. Codeforces Good Bye 2018

    咕bye 2018,因为我这场又咕咕咕了 无谓地感慨一句:时间过得真快啊(有毒 A.New Year and the Christmas Ornament 分类讨论后等差数列求和 又在凑字数了 #in ...

  4. Codeforces:Good Bye 2018(题解)

    Good Bye 2018! 题目链接:https://codeforces.com/contest/1091 A. New Year and the Christmas Ornament 题意: 给 ...

  5. Good Bye 2018题解

    Good Bye 2018题解 题解 CF1091A [New Year and the Christmas Ornament] 打完cf都忘记写题解了qwq 题意就是:给你一些黄,蓝,红的球,满足蓝 ...

  6. CF Good Bye 2018

    前言:这次比赛爆炸,比赛时各种想多,导致写到\(D\)题时思路已经乱了,肝了\(1\)个多小时都没肝出来,\(B\)题中途因为没开\(long\ long\)又被\(HACK\)了..\(C\)题因为 ...

  7. ACM ICPC, Amman Collegiate Programming Contest (2018) Solution

    Solution A:Careful Thief 题意:给出n个区间,每个区间的每个位置的权值都是v,然后找长度为k的区间,使得这个区间的所有位置的权值加起来最大,输出最大权值, 所有区间不重叠 思路 ...

  8. Good Bye 2018 D. New Year and the Permutation Concatenation

    传送门 https://www.cnblogs.com/violet-acmer/p/10201535.html 题意: 求 n 的所有全排列组成的序列中连续的 n 个数加和为 n*(n+1)/2 的 ...

  9. Good Bye 2018 C. New Year and the Sphere Transmission

    传送门 https://www.cnblogs.com/violet-acmer/p/10201535.html 题意: n 个people,编号1~n,按顺时针方向围城一圈: 初始,编号为1的peo ...

随机推荐

  1. Android 中如何从一个App启动另外一个App(如启动支付界面、启动地图界面、应用商场下载App等场景)

    假定两个App,分别是A和B,当A运行某个功能需要启动B,一种是启动B应用,一种直接进入B的某个Activity.搜了很多资料,没有一个完整的.下面就A--Android5.1.1.B--Androi ...

  2. GIS-010-ArcGIS JS 三种查询模式(转)

    QueryTask.FindTask.IdentifyTask都是继承自ESRI.ArcGIS.Client.Tasks: 1.QueryTask:是一个进行空间和属性查询的功能类,它可以在某个地图服 ...

  3. Centos下Nagios的安装与配置

    一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...

  4. linux下用gcc如何生成预处理、汇编等文件

    [gcc -E test.c -o test.i------>预处理文件生成.i 文件.] 1.c语言程序生成过程 C语言程序的生成过程可以简单的分为:编辑.预处理.编译.汇编.链接五个阶断. ...

  5. php检测文件只读、可写、可执行权限

    例子:检测文件是否可读.可写.可执行. 复制代码代码示例: <?php  $myfile = "./test.txt"; if (is_readable ($myfile)) ...

  6. background-clip和background-origin

    background-clip 修剪:背景颜色从哪些区域开始显示,默认从border开始该属性指定了背景在哪些区域可以显示,但与背景开始绘制的位置无关,背景的绘制的位置可以出现在不显示背景的区域,这时 ...

  7. UIGestureRecognizer学习笔记

    一.Gesture Recognizers Gesture Recognizers是在iOS3.2引入的,可以用来识别手势.简化定制视图事件处理的对象.Gesture Recognizers的基类为U ...

  8. c++11——右值引用

    1. 左值和右值 左值是表达式结束之后仍然存在的持久化对象,而右值是指表达式结束时就不再存在的临时对象.     c++11中,右值分为两种类型:将亡值(xvalue, expiring value) ...

  9. 【BZOJ3003】LED BFS+状压DP

    [BZOJ3003]LED Description LED屏是由一个庞大的点阵小灯泡组成的,一开始每个小灯泡都不发光.每一行一共有N个小灯泡,依次标号为1~n.现在给定K个点,要求这K个点发光,其余点 ...

  10. c# 给button添加不规则的图片以及用pictureBox替代button响应点击事件

    1.Flat button 用这个方法,前提是要把button的type设置为Flat button1.TabStop = false;button1.FlatAppearance.BorderSiz ...