原创 201804第幾個幸運數
關聯:醜數 #include<bits/stdc++.h> using namespace std; typedef long long LL; const LL MAX = 59084709587505; int main
原创 牆壁塗色 遞推
要點: #include<bits/stdc++.h> using namespace std; long long int ans[51]; int main(){ int n; cin>>n; ans[1]=3; a
原创 喫辣椒
要點:對每個數考慮以它作爲最大值的集合個數。 對每個pi統計數組中比他小的數,從這些數中選k-1個組成的k個數中pi最大,可視爲這個pi值對答案的貢獻。 對每個pi,如果存在,從比它小的數裏面挑選k-1個數組成k個數,則這k個數中
原创 第二屆“傳智杯”全國大學生IT技能大賽前兩題小結(初賽)
賽後測試地址:C語言網 A 軟件工程實習 注意數據精度,round()的使用 因爲變量aver[i]aver[i]aver[i] 、t_score[i]t\_score[i]t_score[i]爲int型,在部分運算時記得乘以一個
原创 Pandas核心數據結構:Series和 DataFrame
Series Series是一個定長的字典序列,有兩個基本屬性,分別是index和values。index默認是從0開始的遞增整數序列,e.g. 0,1,2,3, 4。也可以自己指定索引,如index=[‘a’, ‘b’, ‘
原创 楊輝三角 遞推
#include<bits/stdc++.h> using namespace std; long long int r[51][51]; int main(){ int n,m; cin>>n>>m; for(int i=
原创 PAT B1019 數字黑洞 /A1069 The Black Hole of Numbers
方法1: #include<iostream> #include<stdio.h> #include<algorithm> bool cmp(int a,int b){ //遞減排序 cmp return a>b; } usi
原创 多重揹包問題(二進制拆分)
多重揹包問題描述: 有NNN種物品,第iii種物品的體積是cic_ici,價值是wiw_iwi,每種物品的數量都是有限的,爲nin_ini。現有容量爲VVV的揹包,求在總體積不超過VVV的條件下,使得揹包的總價值最大。
原创 A1007 Maximum Subsequence Sum 動態規劃
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; long long int dp[10010]; int v[10010];
原创 PAT B1003 我要通過!
方法1: 指針 #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int main(){ int n; scanf("%d
原创 藍橋杯 20180101分數 (快速冪運算&&輾轉相除法)
求a的b次冪:快速冪運算 求a b的最大公約數:輾轉相除法 #include<bits/stdc++.h> using namespace std; //快速冪運算 long pow(int a,int b){//求 a的
原创 B 1011 A+B 和 C
方法1 #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main(){
原创 刪除最少的元素 LIS
LIS複雜度爲O(nlogn)O(nlogn)O(nlogn)的算法: int ans[MAX_N],a[MAX_N],dp[MAX_N],n; //a是數組序列,ans 用來保存每個dp值對應的最小值 int len; //L
原创 Leetcode 764. 最大加號標誌
class Solution { public: int orderOfLargestPlusSign(int N, vector<vector<int>>& mines) { int Map[N][N];
原创 mathtype公式經常閃現,然後公式刪除變成了字母c
解決方案: 百度: 關閉金山詞霸中的“劃譯”功能就OK啦,具體情況具體分析,大家可以試一下這種方法。 個人經歷: 上一次是 Ctrl+C 、Ctrl+V 無法正常使用,最後關閉有道的劃譯功能就完美解決了。沒想到這次mathtype