Kattis - mixedfractions】的更多相关文章

Mixed Fractions You are part of a team developing software to help students learn basic mathematics. You are to write one part of that software, which is to display possibly improper fractions as mixed fractions. A proper fraction is one where the nu…
题目链接: D - It's a Mod, Mod, Mod, Mod World Kattis - itsamodmodmodmodworld 具体的每个参数的代表什么直接看题面就好了. AC代码: #include<bits/stdc++.h> using namespace std; # define ll long long # define inf 0x3f3f3f3f ; ll cal(ll a, ll b,ll c,ll n){ ); )return (b/c); ll tmp=…
题目链接: A - Piece of Cake Kattis - pieceofcake 题目大意:给你一个多边形,然后给你这个多边形的每个点的坐标,让你从这个n个点中选出k个点,问这个k个点形成的面积的期望. 具体思路:我们肯定不能硬跑每一个k边形,肯定会超时.我们以每个点作为起点,从这个点开始,形成的面积的期望是多少,然后遍历每一个点,这样算出来的会有重复,最后除以2就可以了. 然后算面积的时候,我们分开算.一个多边形的面积等于每个点按照顺时针或者是逆时针两个点之间的叉积. 求组合数的时候,…
题目链接: Subsequences in Substrings Kattis - subsequencesinsubstrings 题目大意:给你字符串s和t.然后让你在s的所有连续子串中,找出这些连续子串中的非连续子串中包含t的有多少个. 具体思路:我们枚举s的每一个位置,然后判断一下s的包含t的非连续子串中到达那个位置,然后这个字符串两边的长度相乘就是当前位置开始,满足条件的字符位置.然后我们在找从上一次找到首字母位置下一个开始, 继续往下找就可以了. AC代码: #include<bit…
题目链接: G - Intersecting Rectangles Kattis - intersectingrectangles 题目大意:给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角的坐标,然后问你这些矩形会不会相交,如果存在相交的点,输出1,否则输出0. 具体思路:扫描线,我们首先对x进行排序,然后判断当前x直线对应的线段上是否有x已经覆盖,如果已经有就证明存在相交的情况.但是这样会存在多算的情况,所以我们对于每一个矩形的左端点打一个标记,然后右端点再打一个标记,当左端点的时…
题目链接: E - Emptying the Baltic Kattis - emptyingbaltic 题目大意:n*m的地图, 每个格子有一个海拔高度, 当海拔<0的时候有水. 现在在(x, y)最深处放一个抽水机, 问最多能抽多少水,周围8个方向的水会流过来. 具体思路:对于每一个海拔小于0的点,判断这个点周围有水的最低高度.然后将这些高度加起来就可以了. AC代码: #include<bits/stdc++.h> using namespace std; # define ll…
题目链接: G - Galactic Collegiate Programming Contest Kattis - gcpc 题目大意:当前有n个人,一共有m次提交记录,每一次的提交包括两个数,st和ed.st代表当前人的编号,ed代表总的耗费的时间,每一次提交代表这个人AC了一道题.具体的排名顺序就是先按照题目数量和提交的时间来拍的,然后每一次提交后问你当当前编号为1的人排名是多少. 具体思路:我们把人分为两类,第一类 编号为1的人.第二类,排名大于1的人.每一次当一个人进来的时候,如果这个…
Kattis - virus[字符串] 题意 有一个正常的DNA序列,然后被病毒破坏.病毒可以植入一段DNA序列,这段插入DNA序列是可以删除正常DNA序列中的一个连续片段的. 简单来说就是,给你一段字符串,然后这段字符串中插入一段,删掉一段.然后可以不插入,只删除.也可以只插入,不删除.但是 插入的只有一段,删除的也只有一段.也就是说 ATAA T 这组数据 删掉两边是不对的. 而且 插入的那段和删除的那段 必须是连着的. 也就是说 ATAT TATAA 这组数据 我们应该视为 删除了ATAT…
Kattis - bank [简单DP] Description Oliver is a manager of a bank near KTH and wants to close soon. There are many people standing in the queue wanting to put cash into their accounts after they heard that the bank increased the interest rates by 42% (f…
/** 题目:City Destruction Kattis - city 链接:https://vjudge.net/problem/Kattis-city 题意:有n个怪兽,排成一行.每个怪兽有一个生命值和一个爆炸值.每次可以选择一个怪兽攻击早造成d伤害. 如果生命值<=0:那么怪兽i死亡并且爆炸.i+1,i-1第怪兽都会受到 第i个怪兽的爆炸值伤害.如果第i-1被第i炸死,第i-1怪兽不会继续炸别人. 不会传递.也就是只有攻击者攻击致死的怪兽才会对i-1,i+1造成爆炸值伤害. 求最少攻击…
Kattis - honey[DP] 题意 有一只蜜蜂,在它的蜂房当中,蜂房是正六边形的,然后它要出去,但是它只能走N步,第N步的时候要回到起点,给出N, 求方案总数 思路 用DP 因为N == 14 所以 最多走7步 我们不妨设 (7, 7) 为原点,然后 dp[0][7][7] = 1 因为 N == 0 的时候 方案数只有一个 那就是 不动吧.. dp[i][j][k] i 代表第几步 j k 分别表示 目前的位置 一个点 在一张图里面本来有八个方向可以走 这里六边形 我们只取六个方向就可…
Kattis - fence2[二分法] 题意 有一个农夫需要建造一个 N - 1 米长的篱笆,需要 N 根柱子,然后有 K 根 柱子 需要将这 K 根柱子 切成 N 段 然后 要尽量保证这 N 段柱子的长度尽量长,并且这 N 段柱子的长度是相等的 然后求最少需要切几次.注意:柱子的长度可以是浮点数. 思路 用二分法找答案,然后再求和 不过要注意的是 ,如果柱子原来的长度与要分成的柱子的长度是可以整除的 那么切的刀数 就是 N/MAX - 1 AC代码 #include <iostream>…
Kattis - pizzahawaii [状态标记] Description You are travelling in a foreign country. Although you are also open to eat some regional food, you just cannot resist after you have found an Italian restaurant which offers pizza. Unfortunately the menu is wri…
Kattis - wheretolive [数学] Description Moving to a new town can be difficult. Finding a good place to live which is close to everything you're interested in is important. However, since you're a great programmer, you know that you can solve this probl…
Kattis - cokolada[水] 题意 有一个人想吃巧克力,但是巧克力都是按照 2 的幂次的数量包装的,然后他想吃一定数量块的巧克力,然后可以敲碎,每次敲碎都分成两半,比如四块装的分成两块就是二块和二块,但是只能买一块,求要买的那块的数量,和要敲几次 思路 因为数据比较小,可以先打一个 2 的幂次的表,然后二分查找最少的那个数量,然后每次都剪掉一半,然后往下找,直到减为0 就跳出 然后用 大的减最小的那个数 就可以了 AC代码 #include <iostream> #include…
Kattis - glitchbot [DFS] 题意 有一个机器人 刚开始在(0, 0),然后给出一个目标点,并且会给出一系列指令,但是其中会有一个指令是错误的.我们需要找出那个指令,并且改成正确的. 思路 因为数据范围比较小,我们可以把每条指令都改一下 暴力搜索一下,能不能走到目标点,如果改了,可以 那么 这就是答案 直接输出 break 掉就可以了 AC代码 #include <iostream> #include <cstdio> #include <algorith…
Kattis - amsterdamdistance[数学] 题意 给出两个点 算出从第一个点到第二个点的最短距离,只不过这里不是直角坐标系, 是雷达图 思路 因为内圈的圆的路径要比外圈的小,所以我们要尽可能先往内圈走,加一个判断条件 走到哪里就好了 AC代码 #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <deque> #…
题目链接 https://open.kattis.com/problems/names 题意 给出一个字符串 有两种操作 0.在字符串的最末尾加一个字符 1.更改字符串中的一个字符 求最少的操作步数使得字符串变成回文串 思路 由于回文串具有对称关系 所以给出一串回文串 最多的操作步数 就是 len / 2 只改一半不同的字符就可以了 所以我们可以先将字符串倒置 然后依次一步一步 挪过去 与原串比较 比出有多少个不同的字符 那么操作次数就是 挪位数+不同字符个数/ 2 比如说 样例 kaia ai…
Installing Apps Kattis - installingapps Sandra recently bought her first smart phone. One of her friends suggested a long list of applications (more commonly known as “apps”) that she should install on the phone. Sandra immediately started installing…
题目:  Kattis - whatdoesthefoxsay   Determined to discover the ancient mystery—the sound that the fox makes—you went into the forest, armed with a very good digital audio recorder. The forest is, however, full of animals’ voices, and on your recording,…
Association for Computing Machinery ACM (Association for Computing Machinery) organizes the International Collegiate Programming Contest (ICPC) worldwide every year. In the ICPC, a team of three students is presented with a problem set that contains …
Kattis - barcode 题目原文: To prepare for ACM-ICPC 2017 in Saigon, the host univeristy – Ho Chi Minh city University of Education (HCMUE) – decided to print barcodes on the participants’ t-shirts. The barcode requirement needs to be simple to reduce the…
题目:https://open.kattis.com/problems/intersectingrectangles 题意::给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角的坐标,然后问你这些矩形会不会相交,如果存在相交的点,输出1,否则输出0. #include<bits/stdc++.h> using namespace std; #define pb push_back #define lson root<<1,l,midd #define rson root&l…
Aaah! Photo by Unknown Jon Marius shouted too much at the recent Justin Bieber concert, and now needs to go to the doctor because of his sore throat. The doctor’s instructions are to say “aaah”. Unfortunately, the doctors sometimes need Jon Marius to…
Fenwick Tree Input The first line of input contains two integers NN, QQ, where 1≤N≤50000001≤N≤5000000 is the length of the array and 0≤Q≤50000000≤Q≤5000000 is the number of operations. Then follow QQ lines giving the operations. There are two types o…
Biased Standings Usually, results of competitions are based on the scores of participants. However, we are planning a change for the next year of IPSC. During the registration each team will be able to enter a single positive integer – their preferre…
Bus Numbers Your favourite public transport company LS (we cannot use their real name here, so we permuted the letters) wants to change signs on all bus stops. Some bus stops have quite a few buses that stop there and listing all the buses takes spac…
Peragrams Photo by Ross Beresford Per recently learned about palindromes. Now he wants to tell us about it and also has more awesome scientific news to share with us. “A palindrome is a word that is the same no matter whether you read it backward or…
题目来源:https://vjudge.net/problem/Kattis-programmingtutors 题意: 有n个游客,n个导游,给出他们的坐标,问你怎么匹配可以使他们最大距离最小 题解: 用一个lim变量表示最远可以连接的距离,用二分图匹配,如果可以匹配则这个lim一定符合条件,用二分寻找最小的lim 好题 #include<iostream> #include<cstdio> #include<vector> #include<cstring&g…
A prime number p≥2 is an integer which is evenly divisible by only two integers: 1 and p. A composite integer is one which is not prime. The fundamental theorem of arithmetic says that any integer x can be expressed uniquely as a set of prime factors…