A.Rescue The PrincessDescription Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry  the princess set out immediately. Yet, the beast set a maze. Only if the…
题目地址:http://acm.upc.edu.cn/problemset.php?page=13  2217~2226 A.Rescue The Princess 一个等边三角形告诉前2个点,求逆时针序的第三个点坐标. 简单几何,其实做法有很多,好像大多数都是带直线方程然后判断方向做的.我觉得直接将A放在原点,让B绕A逆时针旋转60度,最后加上A的偏移更简单.旋转直接用方向向量乘旋转矩阵就好. #include <map> #include <set> #include <…
题目传送门 /* 已知一向量为(x , y) 则将它旋转θ后的坐标为(x*cosθ- y * sinθ , y*cosθ + x * sinθ) 应用到本题,x变为(xb - xa), y变为(yb - ya)相对A点的位置,即B绕着A点旋转60度至C点 注意:计算后加回A点的坐标才是相对于原点的坐标 详细解释:http://www.tuicool.com/articles/FnEZJb */ #include <cstdio> #include <cmath> #include…
一次比赛做一次总结,弱菜又来总结了…… 我这种大四的又死皮赖来混省赛了,貌似就我和山大威海的某哥们(不详其大名)了吧.颁奖前和他聊天,得知他去百度了,真是不错,ORZ之. 比赛流水账: 题目目前不知道哪有,过几天填坑. 没发题目前,我们赌A题可能是水题,由于我是主coder,我去读A,剩下的一个从前往后,一个从后往前. 结果……,看到A有一个貌似是几何的图……,我还是硬头皮读了.读到一半,3分钟刷榜,发现E有出,让ZK读E,ZK先告诉我了B题题意,转而读E.B题是一个有环形关系的期望,我扫了一下…
Problem Description Orz has two strings of the same length: A and B. Now she wants to transform A into an anagram of B (which means, a rearrangement of B) by changing some of its letters. The only operation the girl can make is to “increase” some (po…
1.高斯日记 大数学家高斯有个好习惯:无论如何都要记日记. 他的日记有个与众不同的地方,他从不注明年月日,而是用一个整数代替,比如:4210 后来人们知道,那个整数就是日期,它表示那一天是高斯出生后的第几天.这或许也是个好习惯,它时时刻刻提醒着主人:日子又过去一天,还有多少时光可以用于浪费呢? 高斯出生于:1777年4月30日. 在高斯发现的一个重要定理的日记上标注着:5343,因此可算出那天是:1791年12月15日. 高斯获得博士学位的那天日记上标着:8113 请你算出高斯获得博士学位的年月…
Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia…
http://acm.sdibt.edu.cn/JudgeOnline/problem.php?id=3230 Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry  the princess set out immediately. Yet,…
题目描述 Cainiao is a university student who loves ACM contest very much. It is a festival for him once when he attends ACM Asia Regional Contest because he always can find some famous ACMers there. Cainiao attended Asia Regional Contest Fuzhou Site on N…
本文出自:http://blog.csdn.net/svitter 原题:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2624 题意:为什么每次都是我做这么坑爹的题目TAT 一开始的名字我在想名字有没有空格,就像是之前 Sdut2411 Pixel density 山东省第三届ACM省赛(输入输出字符串处理) 这道题目,以至于第一篇WA我根本想不出到底是name的问题还是其他方面的问题.后来证明果然…
2013第四届蓝桥杯决赛Java高职高专组题目以及解法答案 不知不觉离决赛都过去一个月了,一直忙于各种事情,都忘记整理一份试题.当作回忆也好. 1. 标题:好好学习 汤姆跟爷爷来中国旅游.一天,他帮助中国的小朋友贴标语.他负责贴的标语是分别写在四块红纸上的四个大字:“好.好.学.习”.但是汤姆不认识汉字,他就想胡乱地贴成一行. 请你替小汤姆算一下,他这样乱贴,恰好贴对的概率是多少? 答案是一个分数,请表示为两个整数比值的形式.例如:1/3 或 2/15 等. 如果能够约分,请输出约分后的结果.…
最近蒜头君喜欢上了U型数字,所谓U型数字,就是这个数字的每一位先严格单调递减,后严格单调递增.比如 212212 就是一个U型数字,但是 333333, 9898, 567567, 3131331313,就是不是U型数字. 现在蒜头君问你,[1,100000][1,100000] 有多少U型数字? 提示:请不要输出多余的符号. import java.util.Scanner; public class Main1{ public static String mp[] = new String[…
问题描述 一天蒜头君得到 n 个字符串 si​,每个字符串的长度都不超过 10. 蒜头君在想,在这 n 个字符串中,以 si​ 为后缀的字符串有多少个呢? 输入格式 第一行输入一个整数 n. 接下来 n 行,每行输入一个字符串 si​. 输出格式 输出 n 个整数,第 i 个整数表示以 si​ 为后缀的字符串的个数. 数据范围 对于 50\%50% 的数据,1≤n≤10^3. 对于 100\%100% 的数据,1 ≤n≤10^5. 所有的字符串仅由小写字母组成. 样例输入 3ba a aba 样…
第九届蓝桥杯国赛+第二天的第11届acm省赛的总结 25号坐的去北京的火车,10个小时的火车,然后挤了快两个小时的地铁,最终达到了中国矿业大学旁边的订的房间.12个小时很难受,晕车症状有点严重,吃了快4颗晕车药,到宾馆还是很晕,就睡了.晕车这块,我们都自信过分了,很影响状态. 我们学校晋级省一的名额不多,大多数人都没有去,只有我和Z去了,Z很想去北京看看,我也有点想去,想想还是比较激动,还有那几次比赛太好了——膨胀了不少:主要去的时候想的是,按照往年的省赛来看,拿金的希望几乎没有,无论怎样都拿银…
蓝桥刷题 原文链接: https://github.com/libo-sober/LanQiaoCup Python解答蓝桥杯省赛真题之从入门到真题 不同字串 """ 一个字符串的非空子串是指字符串中长度至少为1 的连续的一段字符组成的串.例如,字符串aaab 有非空子串a, b, aa, ab, aaa, aab, aaab,一共 7个. 注意在计算时,只算本质不同的串的个数. 请问,字符串0100110001010001 有多少个不同的非空子串? 这是一道结果填空的题,你…
第四届蓝桥杯省赛C++B/C组----带分数 思路: 1.先枚举全排列 2.枚举位数 3.判断是否满足要求 这道题也就是n=a+b/c,求出符合要求的abc的方案数.进行优化时,可以对等式进行改写,改写成:b=cn-ca. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N = 30; int ta…
2021蓝桥杯省赛B组题目(C/C++)E.路径 最短路径, 因为变化情况比较多, 所以开始想的是深搜, 但是太慢了, 跑不出来, 后来就想着优化一下, 有的地方到另一个地方可能会考虑很多遍, 于是考虑了DP #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int,int> PII; const int N = 1e8+10, M = 21; LL res = 9999…
2021蓝桥杯省赛C++A组试题E 回路计数 状态压缩DP 题目描述 蓝桥学院由21栋教学楼组成,教学楼编号1到21.对于两栋教学楼a和b,当a和b互质时,a和b之间有一条走廊直接相连,两个方向皆可通行,否则没有直接连接的走廊. 小蓝现在在第一栋教学楼,他想要访问每栋教学楼正好一次,最终回到第一栋教学楼(即走一条哈密尔顿回路),请问他有多少种不同的访问方案?两个访问方案不同是指存在某个i,小蓝在两个访问方法中访问完教学楼i后访问了不同的教学楼. 提示:建议使用计算机编程解决问题. 解题思路 哈密…
Rescue The Princess Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 412  Solved: 168 [Submit][Status][Web Board] Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince wh…
排名:http://acm.sdut.edu.cn/sd2012/2013.htm 解题报告:http://www.tuicool.com/articles/FnEZJb A.Rescue The Princess(几何,向量) B.The number of steps(记忆化搜索,概率dp) C.Boring Counting(划分树) D.A-Number and B-Number E.Alice and Bob F.Mountain Subsequences(dp) G.Rubik’s…
A.Rescue The Princess 已知一个等边三角形的两个顶点A.B,求第三个顶点C,A.B.C成逆时针方向. 常规的解题思路就是用已知的两个点列出x,y方程,但这样求出方程的解的表达式比较复杂.更为简单的方法就是以A的坐标加A.C直线的角度求解,使用atan2函数求出A.B直线的角度再加上60就是A.C的角度,使用A.B求出等边三角形的边长. #include <cstdio> #include <cmath> #include <iostream> usi…
Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry  the princess set out immediately. Yet, the beast set a maze. Only if the prince find out the m…
Rescue The Princess Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 412  Solved: 168[Submit][Status][Web Board] Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who…
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2603 Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To re…
Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia…
题目链接: H - Rescue the Princess  ZOJ - 4097 学习链接: zoj4097 Rescue the Princess无向图缩点有重边+lca - lhc..._博客园 题目大意: 首先是T组测试样例,然后是n个点,m条双向边.然后给你u,v,w.问你v和w是否能够到达u,两个人走过的边不能有重复,否则这条边会被压塌. 具体思路:首先对能形成连通块的进行缩点,构成一个个的连通图.然后这样整个图就变成了一个森林,然后再根据染色后的连通块重新建图. 对于每一次的询问,…
Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry  the princess set out immediately. Yet, the beast set a maze. Only if the prince find out the m…
从空间拷过来的.尽管已经过去一个月了.记忆犹新 也算是又一次拾起这个blog Just begin 看着一群群大牛还有队友男神的省赛总结都出了 我最终也耐不住寂寞 来做个流水账抒抒情好了 第一次省赛 心情非常激动 也掺杂着一点小紧张 事实上最想吐槽的是伙食 真的真的真的真的吃不饱.. . 只是非常感谢我们xh老师提供的x牛和x力架 正式赛的时候根本没心思吃午饭 x牛确实提供了非常多能量(我真的没有打广告 你看 都打码了 嗯) 转回正题 说好的是来做流水账的 九号早七点集合从淄博出发 睡到了大青岛…
题目描述:There are n cities in Byteland, and the ith city has a value ai. The cost of building a bidirectional road between two cities is the sum of their values. Please  calculate the minimum cost of connecting these cities, which means any two cities c…
传送门 E.sequence •题意 定义序列 p 中的 "good",只要 i 之前存在 pj < pi,那么,pi就是 "good": 求删除一个数,使得序列中 "good" 的个数最多: •题解 一个数 pi 对 "good" 的贡献有两个来源: ①pi 本身为"good",对答案的贡献为 1: ②删除 pi 后,i 之后的本来是 "good" 的数因为 pi 被删除而变成非…