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. DDoS攻击--Syn_Flood攻击防护详解(TCP)

    https://blog.csdn.net/qq_34777600/article/details/81946514

  2. kvm 虚拟化技术 1.2之kvm基础操作

    1.虚拟机基础操作 (1).查看.编辑.备份kvm配置文件以及查看kvm状态 [root@hd1 ~]# cd /etc/libvirt/qemu [root@hd1 qemu]# ls centos ...

  3. Spring大事务到底如何优化?

    所谓的大事务就是耗时比较长的事务. Spring有两种方式实现事务,分别是编程式和声明式两种. 不手动开启事务,mysql 默认自动提交事务,一条语句执行完自动提交. 一.大事务产生的原因 操作的数据 ...

  4. 没错,就是Access-Control-Allow-Origin,跨域

    服务端添加: <add name="Access-Control-Allow-Origin" value="*" /><add name=&q ...

  5. C#语言中的类型转换方法(unfinished)

    一.C#中的数据类型 1.数值类型 2.字符类型 3.字符串类型 4.布尔类型 5.枚举类型 6.Object类型 二.常见的类型转换 从转换方式的角度,类型转换分为隐式转换与显式转换两种. 其中,隐 ...

  6. 数据库常用DDL语句

    一.创建表 CREATE TABLE TABLE_NAME( #create table 表名 ID INT(4) PRIMARY KEY, #字段名 数据类型 完整性约束条件 NAME VARCHA ...

  7. 【原创】SpringBoot 2.7.0通过lettuce及commons-pool2 v2.9.0集成Redis踩坑记录

    背景 公司的一个项目由于HTTPS证书到期,导致小程序.POS不能正常使用.所以百度了下,通过URL检测证书有效期的代码,并自行整合到一个服务中. 代码仓库:[基于SpringBoot + 企业微信 ...

  8. vue内容拖拽放大缩小

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. CVE-2022-30190 Follina Office RCE分析【附自定义word钓鱼模板POC】

    昨天看了下'Follina' MS-MSDT n-day Microsoft Office RCE 这个漏洞,修改了下chvancooten的脚本,实现可以自定义word模板,便于实战中钓鱼使用,自己 ...

  10. [安洵杯 2019]easy_web-1

    1.首先打开题目如下: 2.观察访问的地址信息,发现img信息应该是加密字符串,进行尝试解密,最终得到img名称:555.png,如下: 3.获得文件名称之后,应该想到此处会存在文件包含漏洞,因为传输 ...