ICode9

精准搜索请尝试: 精确搜索
  • AtCoder Beginner Contest 236 A-D题解2022-01-24 20:34:01

    A - chukodai 题意 使字符串第a个字符与第b个字符交换` #include<bits/stdc++.h> using namespace std; int dp[109][109],a[109][109]; char c[100009]; int main() { int t,i,flag,j,k,m,n,x,y,cnt,o,l,r; char h; cin>>c>>x>>y; h=c[x-1]; c[x-1]=c[y

  • AtCoder Beginer Contest 236 ABCD签到2022-01-24 00:01:08

    A.chukodai 拼手速 #include <bits/stdc++.h> using namespace std; inline void solve(){ string s; cin >> s; int a, b; cin >> a >> b; for(int i = 0; i < s.size(); i++){ if(i == a - 1) cout << s[b - 1];

  • AtCoder Regular Contest 133 题解 A - C2022-01-23 03:00:26

    本文地址 视频讲解 A - Erase by Value 贪心, 找到第一个出现的相邻逆序. #include <bits/stdc++.h> using namespace std; #define inc(x, l, r) for (int x = l; x <= r; x++) const int maxn = 1e6 + 5; int a[maxn]; int main() { int n; cin >> n; inc(i, 1,

  • [Atcoder]AtCoder Beginner Contest 234 题解2022-01-21 17:31:40

    前几题直接代码。 A - Weird Function int f(int x) { return x * x + 2 * x + 3; } cout << f(f(f(t)+t)+f(f(t))) << endl; B - Longest Segment double ans = 0; for(int i = 1; i <= n; i++) { for(int j = i + 1; j <= n; j++) { ans = max(

  • Atcoder ABC231 C2022-01-18 16:01:04

    C - Counting 2 题意 给定n个数,q次查询,每次输出大于等于查询时输入的数的个数。 小知识 lower_bound(大于等于) upper_bound(大于) 返回的是迭代器,相当于STL中的指针 能够和别的函数或者begin(),end()配合 auto it = lower_bound(v.begin(), v.end(), x); 代码 #include <iostream>

  • Atcoder ABC232 B/C2022-01-18 13:32:26

    B - Caesar Cipher 题意描述 给两个字符串S,T。S能执行若干次下列操作 S中的每个字符都加一 S能否转换成T? 题解 核心: (s[i] - '0') % 26 + a,这样的题有三个点可以作为偏移量,a / z / s[i] 我是直接暴力映射到52个字母的数字中找对应的char字符。 代码 #include <iostream> #includ

  • AtCoder Beginner Contest 215 F - Dist Max 2(二分、尺取)2022-01-16 17:01:28

    题目大意: 给出 \(n\) 个不同的点,定义两点间距离为:\(x\) 坐标差与 \(y\) 坐标差的最小值,求任意两点间距离的最大值。 思路: 典型的最大最小值问题,我们考虑二分答案。 问题则转化为如何判断是否存在两个点满足距离大于二分的 \(limit\) 。 注意式子: \[min(\left | x_i - x_j \right |

  • AtCoder Grand Contest 0142022-01-13 21:02:05

    A - Cookie Exchanges 看到这种题一般能想到直接枚举一定次数,不行就输出无解。 可以证明是 \(\log n\) 次,没想过证明。 B - Unplanned Queries 观察样例容易发现,或者这类题我好像见过类似的,结论就是如果所有端点都被取偶数次,那么就是可行的,反之不行。 考虑把路径的性质反映到点上,

  • AtCoder Beginner Contest 2342022-01-10 13:34:55

    A - Weird Function 给出f函数表达式,求:f(f(f(t)+t)+f(f(t))) 签到题 重复利用的代码,最好写一个函数出来 #include <bits/stdc++.h> using namespace std; int f(int x) { return x * x + 2 * x + 3; } int main() { int t; cin >> t; int ans = 0; int

  • AtCoder Beginner Contest 234 F - Reordering2022-01-08 23:02:03

    期末考试考完了…开始补题了 最近几场ATC的ABC都很简单,前五题都是普及组左右,因此目前的目标就是能够稳出F 这次F的读题没读明白,读错了,实际上是可以乱序,因此就是一个数学组合题: #define int LL const int N = 5010,mod=998244353; int n,m,k; int f[N][N],fac[N],inv[N],fin

  • AtCoder Beginner Contest 234 题解2022-01-08 22:02:17

    A、 题意明了不用思考直接模拟 #include<iostream> #include<algorithm> #include<cstring> using namespace std; typedef long long LL; LL cul(LL x) { return x*x+2*x+3; } int main() { LL n; scanf ("%lld",&n); printf ("%lld",cul(c

  • AtCoder Beginner Contest 233 F - Swap and Sort2022-01-06 17:03:27

    题目链接:https://atcoder.jp/contests/abc233/tasks/abc233_f 题目大意:给你一个 1 1 1到 N N

  • Atcoder Beginner Contest 231 G - Balls in Boxes(生成函数)2022-01-03 16:05:02

    MARK on 2022.1.3:由于本人觉得“组合数学杂题选做”这篇博客太累赘了,故将其删除并将其中所有题解都单独开一篇博客写入。 首先列出式子: \[ans=k![x^k]\prod\limits_{i=1}^n(\sum\limits_{j}(a_i+j)·\dfrac{1}{j!}·x^j) \]考虑把括号里的东西拆开 \[\begin{aligned} &\sum\limits

  • Atcoder Grand Contest 019 F - Yes or No(贪心+组合数学)2022-01-03 16:00:43

    MARK on 2022.1.3:由于本人觉得“组合数学杂题选做”这篇博客太累赘了,故将其删除并将其中所有题解都单独开一篇博客写入。 题面传送门 首先我们贪心地想,如果现在 Yes 个数多于 No 的个数那我们肯定会猜 Yes,如果 No 个数多于 Yes 个数那我们肯定会猜 No,否则我们随便猜哪个都无所谓。

  • AtCoder Beginner Contest 2302022-01-01 15:32:22

    A - AtCoder Quiz 3 B - Triple Metre C - X drawing 暂无 D - Destroyer Takahashi 暂无 贪心好难啊 E - Fraction Floor Sum F - Predilection G - GCD Permutation H - Bullion暂无 A A

  • AtCoder Beginner Contest 1872021-12-31 23:35:19

    这比赛我今年(2021)一月二号打了,那时候还很菜 qwq,只做了四道题,现在还有不到一个小时就到 2022 了,写下题解纪念。 附上全部 AC 代码链接: https://atcoder.jp/contests/abc187/submissions/me?f.Task=&f.LanguageName=&f.Status=AC&f.User=HinanawiTenshi 前四题很水就不讲了,只讲今天

  • Atcoder Regular Contest 063 D - Snuke's Coloring 2(单调栈+线段树)2021-12-30 23:05:26

    洛谷题面传送门 & Atcoder 题面传送门 好题一道。 一个很 trivial 的发现是答案等价于求一个周长最大的矩形,满足这个矩形内部(不含边界)没有其他点。 首先注意到一个性质:答案肯定不小于 \(2\max(H,W)+2\),这是因为我们肯定可以框出一个 \(1\times\max(H,W)\) 的矩形,其内部肯定不会含

  • AtCoder Beginner Contest 232题解2021-12-22 22:36:53

    M-SOLUTIONS Programming Contest 2021(AtCoder Beginner Contest 232) A - QQ solver 题意:自己看题目 思路:根据题意模拟即可 参考代码: #include<bits/stdc++.h> using namespace std; string s; int main() { cin >> s; int a = s[0] - '0', b = s[2] - '0';

  • AtCoder Beginner Contest 229 D - Longest X2021-12-16 20:04:58

    题意 给定一个只包含'X'和'.'的串和整数k,可以对串进行k次替换,每次把一个'.'替换成'X'。 串的长度和k的范围都是2e5级别。 问:替换完成后,最多有多少个连续的'X'? 题解 公理1:最多替换k次。 公理2:复杂度支持遍历串的所有'.',进行滑动窗口。 性质1:最终替换结果一定是"靠在"一个比较长的"

  • AtCoder abc231_d(或者说……UnionFind?)2021-12-12 10:32:51

    最近在学数据结构,但是没找到我想要的题,真冤呀……手动滑稽 正在我苦恼的时候,我眼前出现了这样一道题: AtCoder ABC231 D 这道题我是比赛后才做出来的…… 于是! U n i o n F i n d 手动滑稽 今天我就来给大家讲一讲UnionFind! -----------------------------------------------------

  • AtCoder Beginner Contest 231 A~F 题解2021-12-12 09:34:27

    目录A - Water PressureB - ElectionC - Counting 2D - NeighborsE - Minimal paymentsF - Jealous TwoG - Balls in BoxesH - Minimum Coloring 上分难,上分难,上分路,今安在/ll 还好 E 题最后 5min 完成绝杀避免掉分。 一共 10 发罚时,菜的真实。 A - Water Pressure 输出 \(\frac{x

  • AtCoder Beginner Contest 230 A ~ G 题解2021-12-12 04:01:42

    AtCoder Beginner Contest 230 A ~ G 题解 A. AtCoder Quiz 3 按题目要求输出就行 void solve() { int a; cin >> a; if (a >= 42) ++a; printf("AGC%03d", a); } B. Triple Metre 就加长一下然后find就好了 void solve() { string s; for (int i = 0; i < 10;

  • AtCoder Regular Contest 131 A-C题解2021-12-06 20:36:23

    比赛链接 本人太懒,详见强哥的题解 简单说下T3 T3是个博弈论题,有两个结论 1.n为奇数时,先手必胜 2.n为偶数时,先手如果不能一步制胜,则必败。 证明出第一个哪第二个就显然了,下面只证第一个,当n为奇数的情况。 博弈论中双方都是绝顶聪明的,聪明到什么程度呢,对于先手来说,他能做到:即使自己

  • AtCoder Beginner Contest 2302021-12-04 14:33:52

    solved: 5/8 A   如果x>=42那就++, 然后输出补全为三位数有前导0的x B   模拟 C   模拟 D   先按右端点升序排序, 再按左端点升序   可以发现每一拳都打在右端点是最优的, 证明的话可以发现, 假设我有某一拳打中间, 前面已经全部被摧毁了, 覆盖到后面的区域肯定不如右端点广

  • AtCoder Beginner Contest 2302021-12-03 23:32:58

    以后不准备把打的每一场比赛的题解都挂在 cnblogs 上了因为我懒。 但这次还是想写写。 A 显然,当 \(n < 42\) 时输出 AGC+str(n);否则,输出 AGC+str(n+1)。时间复杂度为 \(O(1)\)。 注意需要补足 \(3\) 位。 代码: #include <stdio.h> int main(){ int n; scanf("%d", &n); if (n

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有