A. Prime Subtractiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers x and y (it is guaranteed that x>y). You may choose any prime integer p and subtract it any number of…
题意: 给出无向图. good way : 仅有两条边只经过一次,余下边全经过两次的路 问你共有多少条不同的good way. 两条good way不同仅当它们所经过的边的集合中至少有一条不同 (很关键) 存在多个边连通分量的情况肯定是0. 当确定某两条边只经过一次的时候: 由于经过边的顺序不重要,余下边全经过两次,至多只有一条good way 那么把剩下经过两次的边拆分成两条经过一次的边,记现在的图是新图 原图中是否存在good way 就等价于新图中是否存在欧拉路 暴力枚举两条边判断肯定是要…
A. Magic Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of…
You are given two strings s and t. In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a move, the length of the string decreases by 1. You can't choose a string if it is empty. For exampl…