• UVA 11992 - Fast Matrix Operations(段树)

    时间:2024-04-25 14:27:57

    UVA 11992 - Fast Matrix Operations题目链接题意:给定一个矩阵,3种操作,在一个矩阵中加入值a,设置值a。查询和思路:因为最多20列,所以全然能够当作20个线段树来做,然后线段树是区间改动区间查询,利用延迟操作,开两个延迟值一个存放set操作。一个存放add操作代码:...

  • UVA 253 (13.08.06)

    时间:2024-04-23 22:57:28

     Cube painting We have a machine for painting cubes. It is supplied withthree different colors: blue,red and green. Each face of the cube gets oneof t...

  • uva 10817 - Headmaster's Headache ( 状态压缩dp)

    时间:2024-04-21 21:06:14

    本文出自   http://blog.csdn.net/shuangde800 题目链接: 点击打开链接题目大意某校有n个教师和m个求职者,已知每人的工资和能教的课程集合,要求支付最少的工资使得每门课都至少有两名教师教学。在职教师必须招聘。思路这题不太好想,搞了很久。。f[s1][s2]: s1表...

  • UVA11988-Broken Keyboard(数组模拟链表)

    时间:2024-04-21 11:46:27

    Problem UVA11988-Broken KeyboardAccept: 5642  Submit: 34937Time Limit: 1000 mSec Problem DescriptionYou’re typing a long text with a broken keyboard. ...

  • UVa11167 Monkeys in the Emei Mountain(最大流)

    时间:2024-04-21 09:19:25

    题目大概说有n只猴子,猴子们在某个时间段需要喝vi时间的水,各个单位时间段最多允许m只猴子同时喝水,问猴子们能否成功喝水并输出一个可行的方案,输出方案的时间段区间要从小到大排序并且合并连续的区间。首先应该能联想到这是最大流的模型。猴子有100只,不过区间的点达到50W,这时考虑离散化,离散化后最多就...

  • UVa 673 Parentheses Balance【栈】

    时间:2024-04-20 23:07:28

    题意:输入一个包含"()"和"[]"的序列,判断是否合法用栈来模拟,遇到"(",“[”就入栈,遇到')',']'就取出栈顶元素看是否匹配,如果不匹配,则不合法还有注意一下每次取出栈顶元素的时候判断栈是否为空,如果为空就要跳出循环注意空串也是合法的串 #include<iostream> ...

  • UVa 11495 - Bubbles and Buckets

    时间:2024-04-19 18:45:46

    题目大意:给一个有n个数的序列,通过交换相邻的逆序数使这个序列最终有序,求需要交换的次数。本来可以用冒泡排序解决,但是n达到105,用冒泡排序会超时,用O(nlogn)的归并排序可以达到要求。《算法竞赛入门经典》第八章的“逆序对数”有详细介绍。 #include <cstdio> #de...

  • UVA247 Calling Circles 解题报告-代码

    时间:2024-04-11 16:01:44

    #include <bits/stdc++.h>using namespace std;using ll = long long;using ull = unsigned long long;using ld = long double;#define endl '\n';const ...

  • [刷题]算法竞赛入门经典(第2版) 5-7/UVa12100 - Printer Queue

    时间:2024-04-10 09:08:50

    题意:一堆文件但只有一个打印机,按优先级与排队顺序进行打印。也就是在一个可以插队的的队列里,问你何时可以打印到。至于这个插队啊,题目说”Of course, those annoying term papers that others are printing may have to wait fo...

  • uva 991

    时间:2024-04-08 22:46:36

    卡特兰数  最后不输出空行。。。#include <cstdio>#include <cstdlib>#include <cmath>#include <map>#include <set>#include <queue>#in...

  • uva10106(大数乘法)

    时间:2024-04-07 23:12:33

    public class Product { public static void main(String[] args){ Scanner sc = new Scanner(new BufferedInputStream(System.in)); BigDecim...

  • uva10820 send a table (nlogn求1-n欧拉函数值模版

    时间:2024-04-06 12:02:59

    //重点就是求1-n的欧拉函数啦,重点是nlogn求法的版//大概过程类似于筛选法求素数 #include<cstdio> #include<iostream> #include<cmath> #include<algorithm> #include&...

  • UVA_1025_A_Spy_in_the_Metro_(动态规划)

    时间:2024-04-03 07:48:34

    描述https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3466某城市的地铁是线性的,有n个车站,有M1辆列车从左到右开,M2辆列车从右...

  • Uva 11178 Morley's Theorem 向量旋转+求直线交点

    时间:2024-04-01 22:57:56

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9题意:Morlery定理是这样的:作三角形ABC每个内角的三等分线。相交成三角形DEF。则DEF为等边三角形,你的任务是给你A,B,C点坐标求D,E,F的坐...

  • uva 1660 & poj 1966(点连通度)

    时间:2024-03-31 14:13:45

    Cable TV NetworkTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 4267 Accepted: 2003DescriptionThe interconnection of the relays in a cable T...

  • UVA 11461 - Square Numbers(水题)

    时间:2024-03-31 10:58:15

    题目链接 #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <ctime> #include <cstdlib> #...

  • Uva 11300 Spreading the Wealth(递推,中位数)

    时间:2024-03-24 14:53:56

    Spreading the WealthProblemA Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular ...

  • UVa 10562看图写树(二叉树遍历)

    时间:2024-03-24 09:20:35

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1503这道题错了好多次,一开始我直接是cin>>t,但前面可能还有空格...

  • UVA 4080 Warfare And Logistics 战争与物流 (最短路树,变形)

    时间:2024-03-22 12:24:54

    题意:给一个无向图,n个点,m条边,可不连通,可重边,可多余边。两个问题,第一问:求任意点对之间最短距离之和。第二问:必须删除一条边,再求第一问,使得结果变得更大。思路:其实都是在求最短路的过程。第一问可以floyd解决,也可以SSSP解决。注意是任意两个点,(a,b)和(b,a)是不同的,都要算。...

  • uva-784-水题-搜索

    时间:2024-03-22 12:00:01

    题意:从*点开始,标记所有能走到的点,X代表墙,下划线原样输出AC:40ms#include<stdio.h>#include<iostream>#include<queue>#include<memory.h>using namespace std;...