摘要: https://vjudge.net/contest/177579#problem/G这道题看起来可能有一点难,但是你把题目转换一下就好做了,把这个题求一头牛能被多少头牛看见就行了,用单调栈来做#include#include//用栈做#include#include... 阅读全文
posted @ 2017-08-09 20:12 c201904 阅读(95) 评论(0) 推荐(0)
摘要: 一个字母,则入度加一,并把小的当成大的字母的一个的出度,如果有一个入度为0就输出,并把其其所有出度点减一个入度,循环n次,若一次循环出两个字母,则排序失败,但不跳出,因为一旦遇到了一次循环根本无法输出,则输入结束后输出Inconsistency found after... 阅读全文
posted @ 2017-08-03 07:55 c201904 阅读(104) 评论(0) 推荐(0)
摘要: 这道题呢其实是很简单的,你先从全部水开始试,热了就减1个单位的热水,并比较这个方案是不是比原方案好,若要好些则认为这种情况暂时最好,冷了就减一个单位的冷水,知道有有一个小于0为止。#includeusing namespace std;int main(){ long... 阅读全文
posted @ 2017-08-03 07:47 c201904 阅读(204) 评论(0) 推荐(0)
摘要: 这道题是一道简单的不能再简单的题(虽然说我一开始看错题了),是一道数学题,代码简单,思想简单。先算出一共有多少对相同的,然后因为有两对才能配成一对,所以把对数和加起来后还要除以2才是最后的答案#includeusing namespace std;unsigned l... 阅读全文
posted @ 2017-07-28 20:45 c201904 阅读(100) 评论(0) 推荐(0)
摘要: 这道题呢其实说难不难说简单也不简单(虽然说我做了很久),重要的就是它的思想---正着做不行就反着做,先求出每个点不被抽到的概率,然后再用1-概率,并全部加起来。#include#include#includeusing namespace std;double cou... 阅读全文
posted @ 2017-07-28 20:38 c201904 阅读(93) 评论(0) 推荐(0)
摘要: 这道题,是一个典型最短路径问题,用宽搜,但不要理解为双起点,而要理解为双宽搜。这道题有多个终点,我们不要一个一个点地枚举,这样做会超时(我试过的,而且还卡了很久不知道为什么错.而是算没个人到每个KFC的距离,再用两人的距离和比较,取最小的。#include#inclu... 阅读全文
posted @ 2017-07-28 08:57 c201904 阅读(110) 评论(0) 推荐(0)
摘要: 这道题没什么好说的,一个最短路径的题,用宽搜。但是要注意的是,这道题是两个宽搜,先算火(有多个火!)到每个点的距离,然后人就必须在火到那个点之前到达那个点,不然人(只有一个人)就要死了#include#include#include#include#includeus... 阅读全文
posted @ 2017-07-28 08:40 c201904 阅读(143) 评论(0) 推荐(0)
摘要: 这道题说白了,其实就是最短路径问题,果断用宽搜,但是我们这里要注意的是,这道题是两个起点的宽搜,两个同时搜,而不是分开搜,我本人就是因为这个错误而做了很久的#include#include#includeusing namespace std;const int ma... 阅读全文
posted @ 2017-07-28 08:19 c201904 阅读(129) 评论(0) 推荐(0)
摘要: The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the... 阅读全文
posted @ 2017-07-28 08:05 c201904 阅读(110) 评论(0) 推荐(0)
摘要: Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digit... 阅读全文
posted @ 2017-07-28 07:56 c201904 阅读(111) 评论(0) 推荐(0)