ICode9

精准搜索请尝试: 精确搜索
  • 1024考试总结2020-10-25 07:31:40

    1024考试总结 T1 ​ 题目大意: ​ 理想的光滑平面上有\(n\)个加速阶段,每个加速阶段的加速度和持续时间分别是\(a[i], t[i]\),现在让你求一种\(n\)个阶段的排列顺序,使得新的顺序的位移比输入的顺序的位移相差最大,输出最大差值.\(n <= 1e5\). ​ ​ 贪心,按\(a[i]\)从大到小排序

  • python判断输入的字符串是否为数字2020-09-30 03:00:23

    # 判断输入的字符串是否为数字 x = input("请输入:") # 是否有一个小数点 if x.count(".") == 1: left, right = x.split(".") # 小数点左右是否为纯数字 if left.isdigit() and right.isdigit(): print("正小数") # 小数点左侧是否由负号开头且只有一个

  • 0926考试T3 容斥原理+组合数学2020-09-27 07:32:30

    0926考试T3 ​ ​ 题目大意: ​ ​ \(n \le 10 ^ 5, 10 ^ 5 \le m \le 10^9, y_i \le 50, 0 \le S \le min(M,\sum y_i)\) ​ ​ 容斥原理 + 组合数学。 ​ ​ 一开始看到这题很蒙啊,根本不知道从哪去想,于是就写了个爆搜。 ​ 我就直接粘题解吧,稍微解释一下。 ​ ​ 把集合根据大

  • ZR251 导数卷积2020-09-24 05:32:22

    题意: 链接:http://zhengruioi.com/problem/251 写一下k次项系数的表达式 然后利用一些数学技巧化简化简 大力NTT即可 #include<bits/stdc++.h> #define N 440000 #define L 400000 #define eps 1e-7 #define inf 1e9+7 #define db double #define ll long long #define ldb long

  • P4342 [IOI1998]Polygon2020-09-09 06:31:29

    P4342 [IOI1998]Polygon 题目链接 ​ 明显区间DP。 ​ 首先断环成链,然后枚举要删除哪条边。\(f[l][r], g[l][r]\)分别表示区间\([l, r]\),可以算出的最大值和最小值。瞎搞转移一下就好了。 ​ 为啥必须弄最小值?因为某些最大值是由最小值转移过来的,可能有两个区间的最小值为负数,一乘

  • #差分约束,SPFA#洛谷 1993 小 K 的农场2020-08-18 21:01:22

    题目 分析 对于描述1,也就是\((a,b,-c)\),\(b\)比\(a\)至多多\(-c\) 对于描述2,也就是\((b,a,c)\),\(a\)比\(b\)至多多\(c\) 对于描述3,也就是\((a,b,0),(b,a,0)\) 用SPFA判负环就可以了 代码 #include <cstdio> #include <cctype> #include <deque> #include <cstring> #def

  • 8.3集训2020-08-03 12:33:21

    上午 第一题 其中\(n \leq 1e18\) #include <bits/stdc++.h> #define int long long #define debug using namespace std; const int N = 1e5+66; int n; inline int thestars() { cin >> n; int l = 1, r = sqrt(n)*2+1; int mo = 2*n-2; while (l &

  • 长寿花——组合数学和状态转移2020-08-02 20:32:39

    长寿花                 输入: 3 2 10003 1 2 输出:  8     分析: 少一个mod调一天,啊啊啊,吐血的一天。先咕咕咕了,心累

  • Python isdigit()方法2020-07-19 10:00:45

    描述 Python isdigit() 方法检测字符串是否只由数字组成。高佣联盟 www.cgewang.com 语法 isdigit()方法语法: str.isdigit() 参数 无。 返回值 如果字符串只包含数字则返回 True 否则返回 False。 实例 以下实例展示了isdigit()方法的实例: #!/usr/bin/python str = "123456";

  • CF698B Fix a Tree2020-06-27 09:52:46

    本题链接 从叶子(尚未访问过的节点)往上找其最远的祖先,若能找到根,则合题;若找到环或找到与树不连通的祖先,则将祖先的父亲指向根。 #include <bits/stdc++.h> namespace FastIO { char buf[1 << 21], buf2[1 << 21], a[20], *p1 = buf, *p2 = buf, hh = '\n'; int p, p3 = -1;

  • 树状数组上二分2020-06-22 09:57:44

    树状数组上二分 联考D1T1卡常技巧 左半边的和它就等于a[mid]。 具体看实现 普通平衡树 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int read(){ int x=0,pos=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar()) if(ch=='-') pos=0; fo

  • POJ3615-Floyd2020-06-15 12:00:33

    http://poj.org/problem?id=3615 因为只需要求所在路径的最大高度的最小值,而且n<=300,我们可以用floyd跑。 g[i][j]=min(g[i][j],max(g[i][k],g[k][j]),简单地比大小,求最大值的最小值。 注意要先将g设为无限大。 #include<iostream> #include<cstdio> #include<ctype.h> #include

  • 快读2020-06-07 11:56:10

    为什么要用快读我就不说了反正就是很快就是了但是对于一些输入全是空格的毒瘤题目就算了吧好的我们开始记板子。 快读是可以写成template形式的但是我们一般只会用到int所以这里光放读int的。 1 #include<ctype.h> 2 #include<cstdio>//下面就不写头文件了 3 inline int read() 4

  • [TJOI2018] 数学计算2020-05-27 19:53:53

    题目 原题地址 解说 每次操作看成一个点,用线段树维护区间的积,没什么可说的。 代码 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int Q=1e5+5; inline ll read(){ ll X=0,w=0;char ch=0; while(!isdigit(ch)){w|=ch=='-';ch=getchar();}

  • python基本数据类型;字符串及其方法三:2020-05-23 10:57:03

    ###################判断类型################### ########################################################### #字符串及其方法三:判断类 ##方法isalnum()用于判断字符串是否只包含数字和字母(汉字) # string='01miku初音未来' # result=string.isalnum() # print(result) #方

  • BASIC-4 数列特征2020-04-15 17:02:08

    max、min函数的使用 #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int,int> P; const int N=1e6+9; const double PI=acos(-1); #define line '\n' #define gt getchar() #define mid ((L+R)>>1) int read(){in

  • 算法训练 字符串的展开(isdigit与islower的发现)2020-04-04 16:03:47

    在初赛普及组的“阅读程序写结果”的问题中,我们曾给出一个字符串展开的例子:如果在输入的字符串中,含有类似于“d-h”或者“4-8”的字串,我们就把它当作一种简写,输出时,用连续递增的字母获数字串替代其中的减号,即,将上面两个子串分别输出为“defgh”和“45678”。在本题中,我们通过增加

  • * ! AHOI/HNOI2018寻宝游戏2020-03-30 19:55:45

    x&0=0,x|1=1 我们把\(\&\to0,|\to1\),把操作用01串代替 于是转化为比大小的题目 桶排然后记录每个串的值方便求答案 时间复杂度\(O(nm)\) #include<bits/stdc++.h> using namespace std; inline int read(){ int x=0,f=1;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1

  • ! BJOI2018染色2020-03-26 16:51:09

    首先有奇环肯定不行 手算一下发现下列两种不行: 不行的: 奇环 形成3个及以上的环\((m>n+1)\) \(m=n+1\)即两个偶环相交是相交的两个点之间的三条链不满足\(2+2+偶数\) 详解 用\(dfs\)+拓扑排序判一下即可 #include<bits/stdc++.h> using namespace std; inline int read(){ i

  • 树状数组2020-03-20 21:04:38

    #include<iostream> #include<cstdio> using namespace std; #define lb(x) x&(-x) #define maxn 500001 int z[maxn],n,m; inline int read() { int k=0,f=1;char c=getchar(); for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;

  • SDOI2017相关分析2020-03-18 16:55:22

    一道线段树水题 注意别被卡精度(无时无刻都要想着强制转换double) 居然写了\(100min\),我太弱了!!! #include<bits/stdc++.h> using namespace std; inline int read(){ int x=0,f=1;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c))

  • C++快速读入法2020-03-07 17:41:17

    有时候我们会遇到“由于输入量很大,请使用快速输入法”之类的。 输入还要用快速的?是不是把平时我们使用的cin换成scanf? 不!还要更快! getchar(); 读取一个字符的getchar();这个比cin和scanf的读入还要快! 直接给出模板: template<typename T> inline void read(T &x) { x=0;

  • 引水入城2020-03-07 16:56:44

    引水入城 挺好的题.. 首先可以思考到将第一行每一个点作为bfs的起点找出他能到的干旱地区,之后就想着状压...结果发现500根本压不下来... 那我们就要找点性质让我们可以DP.... 之后就知道了每一个水库覆盖着干旱地区一定是连续的区间,因为如果连续,就一定会有交叉,之后就可以被一

  • 密码设置只能为6-16为的字母数字组合2020-02-27 17:07:17

    /** * 包含大小写字母及数字且在6-16位 * 是否包含 * * @param str * @return */ public static boolean isLetterDigit(String str) { boolean isDigit = false;//定义一个boolean值,用来表示是否包含数字 boolean isLett

  • #线段树#洛谷 4588 [TJOI2018]数学计算2020-02-23 23:58:49

    题目传送门 分析 由于曾经做过原题 所以就直接说了,因为每个数最多被除掉一次 所以可以用线段树维护区间乘,也就很简单了,删除就单点修改就行了 代码 #include <cstdio> #include <cctype> #define rr register using namespace std; int Q,mod,w[400011]; inline signed iut(){

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

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

ICode9版权所有