摘要:
1 #include <stdio.h> 2 #include <algorithm> 3 using namespace std; 4 5 typedef long long ll; 6 const int mod = 1e9 + 7; 7 int dp[1010][10000]; 8 // dp 阅读全文
摘要:
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; 8 */ 9 class Solutio... 阅读全文
摘要:
模拟题,运用强大的stl。 阅读全文
摘要:
random 是使用随机数的python 标准库 ——为随机数:采用梅森旋转算法生成的(伪)随机序列中的元素 —— import random 基本随机数函数:seed(),random() 扩展随机数函数:randint(),getrandbits(),uniform(), randrange() 阅读全文
摘要:
模拟题,用链表来进行模拟 阅读全文
摘要:
题意: 第一类物品的价值为k1,第二类物品价值为k2,背包的体积是 c ,第一类物品有n 个,每个体积为S11,S12,S13,S14.....S1n ; 第二类物品有 m 个,每个体积为 S21,S22,S23,S24.......S2m; 每次装入物品时,得到的价值是 剩余背包体积*该类物品的价 阅读全文
摘要:
首先只需要 import time (典型的,标准的python库的使用方法) 主要包括三类函数 ——时间获取:time() , ctime() , gmtime() ——时间格式化: strftime(), strptime() ——程序计时:sleep(), perf_counter() 1.时 阅读全文
摘要:
1 //字符串的乘法 2 string multi(string a, string b){ 3 int i, j, arr[200], len = a.length() + b.length(); 4 memset(arr, 0, sizeof arr); 5 reverse(a.begin(), a.end()); 6 reverse(b.begi... 阅读全文
摘要:
大神的字符串快速幂 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #define MOD 7 5 #define N 2 6 using namespace std; 7 8 struct Matrix 9 { 10 long long v[N][N]; 11 }; 12 13 //矩阵间的乘法%m 14 Matrix matrix_mul(Matrix... 阅读全文