牛客国庆集训派对Day7 Solution】的更多相关文章

A    Relic Discovery 水. #include <bits/stdc++.h> using namespace std; int t, n; int main() { scanf("%d", &t); while (t--) { scanf("%d", &n); ; , a, b; i <= n; ++i) { scanf("%d%d", &a, &b); res += a *…
A    矩阵乘法 思路: 1° 牛客机器太快了,暴力能过. #include <bits/stdc++.h> using namespace std; #define N 5000 int n, p, m; ], b[][N], ans[N][N]; void Run() { while (scanf("%d%d%d", &n, &p, &m) != EOF) { ; i <= n; ++i) ; j <= p; ++j) scanf(…
链接:https://ac.nowcoder.com/acm/contest/1112/J来源:牛客网 题目描述 Bobo 有一个三角形和一个矩形,他想求他们交的面积. 具体地,三角形和矩形由 8 个整数 x1,y1,x2,y2,x3,y3,x4,y4x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4x1​,y1​,x2​,y2​,x3​,y3​,x4​,y4​ 描述. 表示三角形的顶点坐标是 (x1,y1),(x1,y2),(x2,y1)(x_1, y_1), (x_…
链接:https://ac.nowcoder.com/acm/problem/52800来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K Special Judge, 64bit IO Format: %lld 题目描述 给出正整数 n 和 m,统计满足以下条件的正整数对 (a, b) 的数量: 1. 1≤a≤n,1≤b≤m 2. a×b 是 2016 的倍数. 输入描述: 输入包含不超过 30 组数据.每组数据包含两个整数 n,…
A    深度学习 puts(n) #include <bits/stdc++.h> using namespace std; int main() { double n; while (scanf("%lf", &n) != EOF) printf("%.10f\n", n); ; } B    异或求和 思路:  有一个$O(nlogn^2)$ 的做法,但是T了. 设$bit(x, i)$为 x在二进制下第i位为1还是0 考虑 $\sum_{…
A    Tobaku Mokushiroku Kaiji 水. #include <bits/stdc++.h> using namespace std; ], b[]; void Run() { while (scanf("%d", a) != EOF) { ; i < ; ++i) scanf("%d", a + i); ; i < ; ++i) scanf("%d", b + i); printf(], b[])…
A    Knight 留坑. B    Tree 思路:两次树形DP,但是要考虑0没有逆元 可以用前缀后缀做 #include <bits/stdc++.h> using namespace std; #define N 1000010 #define ll long long ; int n; ll dp[N], dp2[N]; ll prefix[N], suffix[N]; vector <int> G[N]; void Init() { ; i <= n; ++i)…
A    璀璨光滑 留坑. B    电音之王 蒙特马利大数乘模运算 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long u64; typedef __int128_t i128; typedef __uint128_t u128; struct Mod64 { Mod64() :n_() {} Mod64(u64 n) :n_(init(n)) {} st…
A    Birthday 思路:设置一个源点,一个汇点,每次对$源点对a_i, b_i , a_i 对 b_i 连一条流为1,费用为0的边$ 每个点都再连一条 1, 3, 5, 7, ....的边到汇点之间,因为每多加一个流的费用,然后就是最小费用最大流 #include<bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; ; ; struct Edge{ int to, nxt, cap, flow, cost;…
牛客国庆集训派对Day6 A Birthday:https://www.nowcoder.com/acm/contest/206/A 题意: 恬恬的生日临近了.宇扬给她准备了一个蛋糕. 正如往常一样,宇扬在蛋糕上插了n支蜡烛,并把蛋糕分为m个区域.因为某种原因,他必须把第i根蜡烛插在第ai个区域或第bi个区域.区域之间是不相交的.宇扬在一个区域内同时摆放x支蜡烛就要花费x2的时间.宇扬布置蛋糕所用的总时间是他在每个区域花的时间的和. 宇扬想快些见到恬恬,你能告诉他布置蛋糕最少需要多少时间吗?  …