Problem 1490 五子棋 Time Limit: 1000 mSec Memory Limit : 32768 KB  Problem Description 五子棋是起源于中国古代的传统黑白棋种之一.现代五子棋日文称之为"连珠",音译为"Renju",英文称之为"Gobang"或"FIR"(Five in a Row的缩写),亦有"连五子"."五子连"."串珠&quo…
layout: post title: 2019牛客暑期多校训练营(第五场)G - subsequeue 1 (一题我真的不会的题) author: "luowentaoaa" catalog: true tags: mathjax: true - ACM-ICPC 题意 给你两个由数字组成的字符串\(S\),\(T\) 长度为\(1e3\),问你S中有多少个子序列的值大于字符串T: 思路 首先在比赛的时候一眼确定是\(N^2\) 复杂度的DP,但是想了两三个小时却没想到怎么转移,各种…
原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round3-G.html 题目传送门 - 2018牛客多校赛第三场 G 题意 给定一个 $n$ 个节点的树,有 $k$ 种颜色. 现在让你给每一个节点都染上一种颜色,总共有 $k^n$ 种方法. 现在问,在所有染色方案中,使得相同颜色点对之间的最短距离为 $D$ 的有多少种方案. 答案对于 $10^9+7$ 取模. $n,k,d\leq 5000$ 题解 首先我们来算…
https://www.nowcoder.com/acm/contest/67/G 思路: 分形. 记录中间左边点的坐标,然后推出另外3个点的坐标,递归到最简单的情况. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mem(a,b) memset(a,b,sizeof(a)) ][]; void dfs(int n,int i,int j){…
链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网 题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m of them such that: the rest integers have only one m…
题目链接:https://www.nowcoder.com/acm/contest/146/G G.Counting regions | 时间限制:1 秒 | 内存限制:128M Niuniu likes mathematics. He also likes drawing pictures. One day, he was trying to draw a regular polygon with n vertices. He connected every pair of the verti…
题目链接:https://www.nowcoder.com/acm/contest/143/G 题目描述 Give two positive integer c, n. You need to find a pair of integer (a,b) satisfy 1<=a,b<=n and the greatest common division of a and b is c.And you need to maximize the product of a and b 输入描述: Th…
https://www.nowcoder.com/acm/contest/144/G 链接:https://www.nowcoder.com/acm/contest/144/G来源:牛客网 In Viridian forest there is a tree T formed by N nodes, each edge on which has a positive weight. There is an undirected graph G generated from tree T, whi…
链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m of them such that: the rest integers have only one mode an…
题目链接:https://ac.nowcoder.com/acm/contest/885/G 题意:给定字符串s,t,求s中满足字典序大于t的子序列的个数. 思路:组合数学+dp.当子序列长度大于m时很简单,利用初始化的组合数即可.当子序列长度等于m时类似于数位dp的处理办法,我们用dp[pos][num]表示处理到s中的第pos位时已经选择num个数的可能个数. 那么当s[pos]>t[num+1]时: 如果选择s[i]:dp[pos][num]=(dp[pos][num]+C[n-pos][…