A

暴力 .

greater<double> -> greater<int>

\(100\) -> \(50\)

代码丢了 .

B

dp .

考场上代码抢救一下就过力

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <climits>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
template<typename T>
inline int chkmin(T& a, const T& b){if (a > b) a = b; return a;}
template<typename T>
inline int chkmax(T& a, const T& b){if (a < b) a = b; return a;}
const int N = 114514, P = 1e9+7;
int n;
ll a[N], b[N], dp[N][2];
int main()
{
#ifndef ONLINE_JUDGE
// freopen("i.in", "r", stdin);
#endif
scanf("%d", &n);
for (int i=1; i<=n; i++) scanf("%lld", a+i);
for (int i=1; i<n; i++) scanf("%lld", b+i);
dp[0][0] = 1;
for (int i=1; i<=n; i++)
{
dp[i][0] = (a[i] * ((dp[i-1][0] + dp[i-1][1]) % P) % P + b[i-1] * dp[i-1][0] % P + (b[i-1] - 1) * dp[i-1][1]) % P;
dp[i][1] = b[i] * (dp[i-1][0] + dp[i-1][1]) % P;
} printf("%lld\n", dp[n][0]);
return 0;
}

C

玄学

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <climits>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <bitset>
using namespace std;
const int N = 111111;
int n, s, now, a[N], su[N], ans[N];
inline int sum(int l, int r){return su[r] - su[l-1];}
int main()
{
scanf("%d%d", &n, &s); now = n;
for (int i=1; i<=n; i++) scanf("%d", a+i), su[i] = su[i-1] + a[i];
for (int i=n; i>=1; i--)
{
while ((now + now-i-1 > n) || (sum(i, now-1) > s) || (sum(now, min(n, now*2-i-1)) > s)) --now;
ans[i] = (now-i)*2;
}
for (int i=1; i<=n; i++) printf("%d\n", ans[i]);
return 0;
}

D

Fibonacci Nim,我懒得链了,就是上一篇 .

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <climits>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
template<typename T>
inline int chkmin(T& a, const T& b){if (a > b) a = b; return a;}
template<typename T>
inline int chkmax(T& a, const T& b){if (a < b) a = b; return a;}
const ll lim = 74, magic[] = {0ll, 1ll, 1ll, 2ll, 3ll, 5ll, 8ll, 13ll, 21ll, 34ll, 55ll, 89ll, 144ll, 233ll, 377ll, 610ll, 987ll, 1597ll, 2584ll, 4181ll, 6765ll, 10946ll, 17711ll, 28657ll, 46368ll, 75025ll, 121393ll, 196418ll, 317811ll, 514229ll, 832040ll, 1346269ll, 2178309ll, 3524578ll, 5702887ll, 9227465ll, 14930352ll, 24157817ll, 39088169ll, 63245986ll, 102334155ll, 165580141ll, 267914296ll, 433494437ll, 701408733ll, 1134903170ll, 1836311903ll, 2971215073ll, 4807526976ll, 7778742049ll, 12586269025ll, 20365011074ll, 32951280099ll, 53316291173ll, 86267571272ll, 139583862445ll, 225851433717ll, 365435296162ll, 591286729879ll, 956722026041ll, 1548008755920ll, 2504730781961ll, 4052739537881ll, 6557470319842ll, 10610209857723ll, 17167680177565ll, 27777890035288ll, 44945570212853ll, 72723460248141ll, 117669030460994ll, 190392490709135ll, 308061521170129ll, 498454011879264ll, 806515533049393ll, 1304969544928657ll};
ll n;
int main()
{
scanf("%lld", &n);
for (int i=1; i<=lim; i++)
if (magic[i] == n){printf("%lld\n", n); return 0;}
for (int i=lim; i>=1; i--)
{
if (magic[i] < n) n -= magic[i];
if (magic[i] == n) break;
}
printf("%lld\n", n);
return 0;
}

丽泽普及2022交流赛day21 社论的更多相关文章

  1. 丽泽普及2022交流赛day18 社论

    A 暴力扫一遍 B 算法 0 似乎是二分 算法 1 随便贪心 C 算法 1 枚举一个点作为最大值 / 最小值,用单调栈维护其作为答案的左右端点即可轻易计算 . 时间复杂度 \(O(n)\) . 算法 ...

  2. 丽泽普及2022交流赛day17 社论

    http://zhengruioi.com/contest/1088 SoyTony 重新 rk1 . stO SoyTony Orz 省流:俩计数 . 目录 目录 A 题面 题解 Key 算法 1( ...

  3. 丽泽普及2022交流赛day16 社论

    这场比较平凡吧 . 省流: http://zhengruioi.com/contest/1087 目录 目录 A. Gene 题面 题解 算法一(正解) 算法二 B. Fight 题面 题解 算法一( ...

  4. 丽泽普及2022交流赛day15 社论

    前言 link 太牛逼了,补完我一定放代码 . orz 越看越牛逼 orz . 时间复杂度都是口胡,不要信 . 以下是目录 目录 目录 前言 A 题面 题解 代码 B 题面 题解 代码 C 题面 题解 ...

  5. 丽泽普及2022交流赛day20 1/4社论

    目录 T1 正方形 T2 玩蛇 T3 嗷呜 T4 开车 T1 正方形 略 T2 玩蛇 略 T3 嗷呜 (插一个删一个?) 找出相同的,丢掉循环节 . 感觉非常离谱,,, 正确性存疑 正确性问 SoyT ...

  6. 丽泽普及2022交流赛day22 无社论

    开始掉分模式 . T3 有人上费用流了???(id) 不用 TOC 了 . T1 暴力 T2 没看见 任意两圆不相交,gg 包含关系容易维护,特判相切 . 单调栈即可 T3 贪心 T4 神秘题

  7. 丽泽普及2022交流赛day19 半社论

    目录 No Problem Str Not TSP 题面 题解 代码 Game 题面 题解 代码 No Problem 暴力 Str 存在循环节,大力找出来即可,长度显然不超过 \(10^3\) . ...

  8. 丽泽普及2022交流赛day14

    目录 A 题面 题解 B 题面 题解 C 题面 题解 D 题面 题解 A 题面 一个 \(1\dots n\) 的排列 \(p\) 和一个 \(1\dots n-1\) 的排列 \(q\) 满足 对排 ...

  9. 记:青岛理工ACM交流赛筹备工作总结篇

    这几天筹备青岛理工ACM交流赛的过程中遇到了不少问题也涨了不少经验.对非常多事也有了和曾经不一样的看法, ​一直在想事后把这几天的流水帐记一遍,一直没空直到今天考完C++才坐下来開始动笔.将这几天的忙 ...

随机推荐

  1. 27个常用Linux命令

    1.查找文件 find / -name filename.txt 根据名称查找/目录下的filename.txt文件. 2.查看一个程序是否运行 ps –ef|grep tomcat 查看所有有关to ...

  2. 聊聊 HTTPS

    聊聊 HTTPS 本文写于 2021 年 6 月 30 日 最近工作也是越来越忙了,不像上学的时候,一天下来闲着没事可以写两篇博客. 今天来聊一下 HTTPS. HTTP HTTP 是不安全的协议. ...

  3. Spring-Batch处理MySQL数据后存到CSV文件

    1 介绍 用Spring Batch实现了个简单的需求,从MySQL中读取用户表数据,根据生日计算年龄,将结果输出到csv文件. 1.1 准备表及数据 user test; DROP TABLE IF ...

  4. 使用 Vite 插件开发构建 Tampermonkey 用户脚本

    起因 一直以来,我都是直接在浏览器 Tampermonkey 扩展页面直接新建用户脚本来开发的: 对于一些简单的脚本,这没有什么问题,即改即看.但当代码多了以后问题就来了,自带编辑器开发体验确实不太舒 ...

  5. Vue 基础篇---computed 和 watch

    最近在看前端 Vue方面的基础知识,虽然前段时间也做了一些vue方面的小项目,但总觉得对vue掌握的不够 所以对vue基础知识需要注意的地方重新撸一遍,可能比较零碎,看到那块就写哪块吧 1.vue中的 ...

  6. 【clickhouse专栏】单机版的安装与验证

    <clickhouse专栏>第三节内容,先安装一个单机版的clickhouse,是后续学习多副本或者分布式集群安装的基础内容.但基本的clickhouse是不依赖于zookeeper的,只 ...

  7. 13. L1,L2范数

    讲的言简意赅,本人懒,顺手转载过来:https://www.cnblogs.com/lhfhaifeng/p/10671349.html

  8. 深度学习与CV教程(13) | 目标检测 (SSD,YOLO系列)

    作者:韩信子@ShowMeAI 教程地址:http://www.showmeai.tech/tutorials/37 本文地址:http://www.showmeai.tech/article-det ...

  9. D3.JS结合Canvas实现直方图,散点图,等高线图,密度图

    接触到D3.JS,感觉在图表方面实现的很好,于是深入了解了一下,想在项目中使用, 可是当看到DEMO时才发现,基本上所有的DEMO都是基于SVG,虽然D3.JS声称支持CANVAS,可并没有发现一例使 ...

  10. ebook下载 | 灵雀云发布《 企业高管IT战略指南——为何选择容器与Kubernetes》

    发送关键词[高管指南]至灵雀云公众号,立即下载完整版电子书 "本书将提供企业领导者/IT高管应该了解的,所有关于容器技术和Kubernetes的基础认知和关键概念,突破技术语言屏障,全面梳理 ...