C. Hostname Aliases 题目连接: http://www.codeforces.com/contest/644/problem/C Description There are some websites that are accessible through several different addresses. For example, for a long time Codeforces was accessible with two hostnames codeforce…
B. Processing Queries 题目连接: http://www.codeforces.com/contest/644/problem/B Description In this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment ti and needs to be pro…
错误代码提示: hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 0: invalid continuation byte 在命令行输入 python manage.py runserver启动服务器的时候,突然出现下面的错误 Traceback (most recent call last): File "le…
A. Voting for Photos time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct…
B. Chat Order time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that wh…
Description Polycarp has quite recently learned about email aliases. Of course, he used to suspect that the case of the letters doesn't matter in email addresses. He also learned that a popular mail server in Berland bmail.com ignores dots (character…
题目链接:http://codeforces.com/contest/655/problem/E 大意是Bessie只会英文字母表中的前k种字母,现在有一个长度为m+n的字母序列,Bessie已经知道了前m个字符,问如何填充剩下的n个字符,使得整个序列的不同子序列数目最大.当然所有字母都得是Bessie会的前k个字母. 两个月前比赛的时候做的,是一道不错的题. 关于子序列个数的计算 令dp[i]表示前i个数字组成的序列中子序列的个数, 则对于第i个数字a[i]来说,dp[i]来源于两种情况的转化…
题目链接:http://codeforces.com/contest/655/problem/D 大意是给若干对偏序,问最少需要前多少对关系,可以确定所有的大小关系. 解法是二分答案,利用拓扑排序看是否所有关系被唯一确定.即任意一次只能有1个元素入度为0入队. #include <iostream> #include <vector> #include <algorithm> #include <string> #include <string.h&g…
D. Robot Rapping Results Report 题目连接: http://www.codeforces.com/contest/655/problem/D Description While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessi…
B. Chat Order 题目连接: http://www.codeforces.com/contest/637/problem/B Description Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his fri…
A. Voting for Photos 题目连接: http://www.codeforces.com/contest/637/problem/A Description After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published t…
C. Binary Table 题目连接: http://codeforces.com/problemset/problem/662/C Description You are given a table consisting of n rows and m columns. Each cell of the table contains either 0 or 1. In one move, you are allowed to pick any row or any column and i…
题目链接: http://www.codeforces.com/contest/655/problem/D 题意: 题目是要求前k个场次就能确定唯一的拓扑序,求满足条件的最小k. 题解: 二分k的取值,做拓扑排序的时候只要每次只有一个元素没有前驱就可以唯一了. #include<iostream> #include<cstring> #include<cstdio> #include<vector> #include<queue> #includ…
今天在codeforces上面做到一道题:http://codeforces.com/contest/638/problem/B 题目大意是:给定n个字符串,找到最短的字符串S使得n个字符串都是这个字符串S的子串. 题目里有一个限制条件是每个字母都最多出现一次,所以可以用下面的方法来解决: http://codeforces.com/contest/638/submission/16900955 然后我想到如果问题没有“每个字母最多只出现一次”这个限制的话应该怎么解决. 暂时还在想………
F - Cowslip Collections http://codeforces.com/blog/entry/43868 这个题解讲的很好... #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define PLI pair<LL, int> #define…
E - Intellectual Inquiry 思路:我自己YY了一个算本质不同子序列的方法, 发现和网上都不一样. 我们从每个点出发向其后面第一个a, b, c, d ...连一条边,那么总的不同子序列就是从0号点出发能走出多少条 不同点的路径. dp[ i ]表示是到 i 这个点的不同路径数, 构成的图显然是个DAG,把这个dp出来就好啦.最后补 n个就是贪贪心. 网上的另外两种方法. dp[ i ] 表示[1, i] 的字符串有多少不同子序列. dp[ i ] = dp[i - 1] *…
D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Description A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepip…
C. Road Improvement 题目连接: http://www.codeforces.com/contest/638/problem/C Description In Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given…
B. Making Genome in Berland 题目连接: http://www.codeforces.com/contest/638/problem/B Description Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has notin…
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with od…
E. Intellectual Inquiry 题目连接: http://www.codeforces.com/contest/655/problem/E Description After getting kicked out of her reporting job for not knowing the alphabet, Bessie has decided to attend school at the Fillet and Eggs Eater Academy. She has be…
C. Enduring Exodus 题目连接: http://www.codeforces.com/contest/655/problem/C Description In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he…
B. Mischievous Mess Makers 题目连接: http://www.codeforces.com/contest/655/problem/B Description It is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so…
A. Amity Assessment 题目连接: http://www.codeforces.com/contest/655/problem/A Description Bessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 × 2 grid and three tiles labeled 'A', 'B', and 'C'.…
D. Running with Obstacles 题目连接: http://www.codeforces.com/contest/637/problem/D Description A sportsman starts from point xstart = 0 and runs to point with coordinate xfinish = m (on a straight line). Also, the sportsman can jump - to jump, he should…
C. Promocodes with Mistakes 题目连接: http://www.codeforces.com/contest/637/problem/C Description During a New Year special offer the "Sudislavl Bars" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free…
linux的hostname是一个kernel变量,可以通过hostname命令来查看本机的hostname.也可以直接cat /proc/sys/kernel/hostname查看. #hostname #cat /proc/sys/kernel/hostname 上面两种输出结果相同. 修改运行时Linux系统的hostname,即不需要重启系统 hostname命令可以设置系统的hostname #hostname newname newname即要设置的新的hostname,运行后立即生…
Linux操作系统的hostname是一个kernel变量,可以通过hostname命令来查看本机的hostname.也可以直接cat /proc/sys/kernel/hostname查看. #hostname #cat /proc/sys/kernel/hostname 上面两种输出结果相同. 修改运行时Linux系统的hostname,即不需要重启系统 hostname命令可以设置系统的hostname #hostname newname newname即要设置的新的hostname,运行…
基础命令学习目录首页 原文链接:https://idc.wanyunshuju.com/cym/68.html Linux操作系统的hostname是一个kernel变量,可以通过hostname命令来查看本机的hostname.也可以直接cat /proc/sys/kernel/hostname查看. #hostname #cat /proc/sys/kernel/hostname 上面两种输出结果相同. 修改运行时Linux系统的hostname,即不需要重启系统 hostname命令可以设…
很过人一提到更改hostname首先就想到修改/etc/hosts文件,认为hostname的配置文件就是/etc/hosts.其实不是的. hosts文件的作用相当如DNS,提供IP地址到hostname的对应.早期的互联网计算机少,单机hosts文件里足够存放所有联网计算机.不过随着互联网的发展,这就远远不够了.于是就出现了分布式的DNS系统.由DNS服务器来提供类似的IP地址到域名的对应.具体可以man hosts. Linux系统在向DNS服务器发出域名解析请求之前会查询/etc/hos…