摘要: 题目描述 Given is an N×N matrix C whose elements are non-negative integers. Determine whether there is a pair of sequences of non-negative integers A1,A2, 阅读全文
posted @ 2021-08-05 21:40 梨花满地 阅读(63) 评论(0) 推荐(0)
摘要: 题目描述 N students took a test with M questions with two choices: 0 and 1. You are given N strings of length M each: S1,S2,…,SN. The k-th character of Si 阅读全文
posted @ 2021-08-05 20:35 梨花满地 阅读(49) 评论(0) 推荐(0)
摘要: The cows are in a particularly mischievous mood today! All Farmer John wants to do is take a photograph of the cows standing in a line, but they keep 阅读全文
posted @ 2021-08-04 21:25 梨花满地 阅读(90) 评论(0) 推荐(0)
摘要: 题目描述 Let S be a set composed of all integers from 1 through N. f is a function from S to S. You are given the values f(1),f(2),⋯,f(N) as f1,f2,⋯,fN. F 阅读全文
posted @ 2021-08-04 21:19 梨花满地 阅读(41) 评论(0) 推荐(0)
摘要: 思路:欧拉定理扩展 定义phi[i] = φ(i) ax = a(x % phi[p] + phi[p]) % p #include<iostream> #include<cmath> #include<cstring> #include<algorithm> using namespace std 阅读全文
posted @ 2021-08-03 16:39 梨花满地 阅读(80) 评论(0) 推荐(0)
摘要: 题目描述 Bessie the cow is getting bored of the milk production industry, and wants to switch to an exciting new career in computing. To improve her codin 阅读全文
posted @ 2021-07-30 17:26 梨花满地 阅读(65) 评论(0) 推荐(0)
摘要: 问题: 一天,小 D 决定买一些糖果。他决定在两家不同的商店中买糖果,来体验更多的口味。 在每家商店中都有 n 颗糖果,每颗糖果都有一个权值:愉悦度,代表小 D觉得这种糖果有多好吃。其中,第一家商店中的第 i 颗糖果的愉悦度为 Ai,而第二家商店中的第 i 颗糖果的愉悦度为 Bi。 在每家商店买的糖 阅读全文
posted @ 2021-07-27 11:02 梨花满地 阅读(235) 评论(0) 推荐(0)
摘要: 解题思路 使用二分来对朴素版动态规划进行优化 当这个数a[i]比当前f最后一个数f[cnt]还要大时,那么这个数就符合条件f[cnt++] = a[i] 否则 就在f数组里面找第一个比a[i]大的数, 把a[i] 替换给这个位置 毕竟1 5 6 和1 4 6 总是1 4 6 可能性更高一些 比如 2 阅读全文
posted @ 2021-07-23 20:12 梨花满地 阅读(80) 评论(0) 推荐(0)
摘要: 中石油大D:Go Fishing 求点(x, y)极坐标下的角度 double x = atan2(y, x);//此时的x是一个正切值 (atan2 返回以弧度表示的 y/x 的反正切) x * 180 / 3.14; #include<iostream> #include<cmath> #inc 阅读全文
posted @ 2021-07-20 22:25 梨花满地 阅读(346) 评论(0) 推荐(0)
摘要: 输入a,b,c 题目:求给定数据范围[a,b]的前c小质因子的和, #include<iostream> #include<algorithm> #include<vector> using namespace std; const int N = 1e8 + 10; typedef long lo 阅读全文
posted @ 2021-07-20 20:51 梨花满地 阅读(38) 评论(0) 推荐(0)