做完冻结后在做这三道题,简直爆切,直接四倍经验$STO$。 飞行路线: 几乎跟冻结一模一样就不讲啦 #include <bits/stdc++.h> using namespace std; int n , m , k , ans = 0x3ffffff , s , ee; int dis[1000 ...
分类:
其他好文 时间:
2020-06-22 21:09:53
阅读次数:
58
P1216 数字三角形 每个节点的值只受左上,右上两节点影响。索引从1开始,避免处理边界问题。 int n,ans,a[1005][1005],dp[1005][1005]; //pull: dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j]) + dp[i] ...
分类:
其他好文 时间:
2020-06-21 20:09:12
阅读次数:
61
题目链接 #include<iostream> #include<string> #include<algorithm> using namespace std; int Atoi( string str , int N ){ //N进制转10进制,输入string 输出int int ans = ...
分类:
其他好文 时间:
2020-06-18 19:06:27
阅读次数:
126
#include<bits/stdc++.h> #define ls rt<<1 #define rs rt<<1|1 using namespace std; typedef long long ll; const int p=1e8+7; vector<int>v[1001000],ans; i ...
分类:
其他好文 时间:
2020-06-14 12:35:49
阅读次数:
64
数论: 快速乘: ll ModMul(ll a,ll b,ll n){//快速积取模 a*b%n ll ans=0; while(b){ if(b&1) ans=(ans+a)%n; a=(a+a)%n; b>>=1; } return ans; } 快速幂: ll ModExp(ll a,ll b ...
分类:
其他好文 时间:
2020-06-13 23:38:02
阅读次数:
91
面试题63. 股票的最大利润 class Solution { public: int maxProfit(vector<int>& prices) { if(prices.size()<=1) return 0; int ans=prices[0]; int ans1=0; for(int i=1 ...
分类:
其他好文 时间:
2020-06-13 23:27:12
阅读次数:
69
链接:https://leetcode-cn.com/problems/4sum/ 代码 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> ans = n ...
分类:
其他好文 时间:
2020-06-13 21:04:30
阅读次数:
53
链接:https://leetcode-cn.com/problems/3sum-closest/ 代码 class Solution { public int threeSumClosest(int[] nums, int target) { int ans = nums[0] + nums[1] ...
分类:
其他好文 时间:
2020-06-13 17:24:10
阅读次数:
58
class Solution { public static List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> ans = new ArrayList(); int len = nums.length; if(nums == ...
分类:
编程语言 时间:
2020-06-13 15:42:57
阅读次数:
95
方法一:二分查找。 class Solution(object): # 二分法 def countNegatives(self, grid): """ :type grid: List[List[int]] :rtype: int """ ans = 0 for nums in grid: if n ...
分类:
其他好文 时间:
2020-06-08 14:39:50
阅读次数:
58