上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页
摘要: 资源限制 时间限制:1.0s 内存限制:256.0MB 问题描述 土豪大学每年都会给学生颁发巨额的特等奖学金,当然,获奖的前提是要足够优秀。这所大学有n名学生,他们中的每个人都会在m门必修课的每门课上获得一个百分制的整数成绩(0-100),到了期末教务长会获得所有学生在所有必修课上的成绩报告,他会从 阅读全文
posted @ 2020-03-18 13:22 sqsq 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 思路: 已知:A%9973 = n; gcd(B,9973)=1; 求(A/B)%9973; k = (A/B)%9973 - > A/B - 9973*y = k; -> A = k*B+9973*y; 带入 A%9973 = n中得 k*B%9973 = n; kB - 9973*y = n; 阅读全文
posted @ 2020-03-10 01:24 sqsq 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 参考博客: https://blog.csdn.net/u012469987/article/details/39041797 https://blog.csdn.net/qq_22902423/article/details/50569835 代码: #include<iostream> #inc 阅读全文
posted @ 2020-03-10 00:41 sqsq 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 思想: 用到了欧拉筛,然后对数组的内存的巧妙处理。 推荐的博客: https://blog.csdn.net/Feynman1999/article/details/79533130?depth_1-utm_source=distribute.pc_relevant.none-task&utm_so 阅读全文
posted @ 2020-03-09 23:47 sqsq 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 优先队列: 代码: 过了50% #include <stdio.h> #include <algorithm> #include<iostreami> using namespace std; int ans[1001]; struct { int x,y; }a[1001]; bool cmp(i 阅读全文
posted @ 2020-03-07 16:39 sqsq 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 大表: #include<iostream> #include<stdio.h> #include<algorithm> using namespace std; typedef long long ll; int main(){ for(int j=1;j<=50;j++)//打表 { int n 阅读全文
posted @ 2020-03-06 21:47 sqsq 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 思想: dp[i][j]代表到达坐标(i,j)这个位置最少需要转换成障碍格子的数目; 代码: #include<iostream> #include<stdio.h> #include<string.h> using namespace std; const int inf = 0x3f3f3f3f 阅读全文
posted @ 2020-03-06 20:36 sqsq 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 思想: 巧妙的利用二进制数的特性,时间复杂度o(2^m(n*m)); 代码: #include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int n,m,k,ans; int a[20][20],sum[ 阅读全文
posted @ 2020-03-06 20:25 sqsq 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 思路: 区间dp,定义的 l 是区间的长度。for(k)的循环时防止(()的类似情况 代码: #include<iostream> #include<stdio.h> #include<string.h> using namespace std; const int maxn = 101; int 阅读全文
posted @ 2020-02-27 21:18 sqsq 阅读(117) 评论(2) 推荐(0) 编辑
摘要: 石子合并(每次合并相邻的两堆石子,代价为这两堆石子的重量和,把一排石子合并为一堆,求最小代价) 是一个经典的问题。dp可以做到O(n*n)的时间复杂度,方法是: 设f[i,j]为合并从i到j的石子所用最小代价。 f[i,j]=min(sum(i,j)+f[i,k]+f[k+1,j])对所有i<=k< 阅读全文
posted @ 2020-02-27 17:15 sqsq 阅读(679) 评论(0) 推荐(1) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页