码迷,mamicode.com
首页 >  
搜索关键字:ans    ( 3741个结果
[入门组模拟赛]机器工厂
题目描述小T开办了一家机器工厂,在N(Nusing namespace std;int n,s,c,y;long long ans,mn;int main(){ scanf("%d%d",&n,&s); for(int i=1;i<=n;i++) { scanf("%d%d",&c,&y); if(... ...
分类:其他好文   时间:2020-07-05 20:59:53    阅读次数:65
力扣题解 1th 两数之和
1th 两数之和 暴力枚举法 直接两重循环暴力枚举,很慢。 class Solution { public int[] twoSum(int[] nums, int target) { int[] ans = new int[2]; for(int i = 0; i < nums.length; i ...
分类:其他好文   时间:2020-07-04 14:59:09    阅读次数:48
386. 字典序排数
给定一个整数 n, 返回从 1 到 n 的字典顺序。 例如, 给定 n =1 3,返回 [1,10,11,12,13,2,3,4,5,6,7,8,9] 。 请尽可能的优化算法的时间复杂度和空间复杂度。 输入的数据 n 小于等于 5,000,000。 vector<int>ans; class Sol ...
分类:其他好文   时间:2020-07-02 16:15:55    阅读次数:58
A1049 Counting Ones (30分)
一、技术总结 分三种情况: 当 二、参考代码 #include<iostream> using namespace std; int main(){ int n, a = 1, ans = 0; int left, now, right; cin >> n; while(n / a != 0){ l ...
分类:其他好文   时间:2020-06-29 23:08:00    阅读次数:93
Tokio Marine & Nichido Fire Insurance Programming Contest 2020 English
D 设阈值$L$,预处理$i\le L$的祖先最优背包 对于一次询问,$i>L$的部分可以状压 E 显然,题目可以直接转化为$S=0,T=2^L-1$,\(A_i\in[0,2^T)\) 令$f(U)\(为集合大小\)\in[1,K]\(,集合中所有数\)\And U$相同的个数 \(ans=\su ...
分类:其他好文   时间:2020-06-28 22:51:38    阅读次数:124
manacher模板
详细讲解可以看这个 下面只是些模板 纯模板 int manacher() { // 将数组初始化 init(); int p[N*2],ans=0,mx=0,max_len=-1,id=0,index; // p[i]代表以i为中心的回文串半径,p[i]-1是以i为中心的最长回文串(相对于原字符串) ...
分类:其他好文   时间:2020-06-28 22:45:32    阅读次数:63
搜索与图论_递归枚举
指数型枚举: 无个数限制 题目描述: 从 1~n 这 n 个整数中随机选取任意多个,输出所有可能的选择方案。 朴素dfs枚举 int n; vector<int> ans; void calc(int x) { if(x == n + 1) { for(auto c: ans) printf("%d ...
分类:其他好文   时间:2020-06-27 13:18:24    阅读次数:49
算法进阶指南(DFS和BFS)--- 小猫爬山
题目链接:小猫爬山 解法一: #include<iostream> #include<algorithm> using namespace std; const int N = 20; int n,m; int cat[N],sum[N]; int ans=N; void dfs(int now,i ...
分类:编程语言   时间:2020-06-26 10:50:34    阅读次数:99
P2356 弹珠游戏
题目如下: 思路: 1.数据很小 可以开数组解决 代码如下: #include<cstdio> #include<iostream> using namespace std; int a[1010][1010]; int ans=0,n; bool flag=false; int f(int i,i ...
分类:其他好文   时间:2020-06-26 10:41:13    阅读次数:89
C. RationalLee 思维题
题意 给你n个数字,要求把它们分成k组,每组w[i]个,ans为每组的最小值加最大值的总和。 思路 很容易看出,如果一组只有一个人,那么把尽可能较大的分给他,最小值和最大值都会大,ans也会大,所有我们先把大的数分给那些只有一个人的组。 考虑剩下的情况,现在每组的最大值都是确认的(较大的每组一个), ...
分类:其他好文   时间:2020-06-25 14:13:42    阅读次数:64
3741条   上一页 1 ... 7 8 9 10 11 ... 375 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!