
紫书
努力的气球
这个作者很懒,什么都没留下…
展开
-
UVA 1583 不用打表的做法
//通过观察,发现生成元在给出数n的n-100以内 //这么写不会超时 #include <iostream> #include <stdio.h> #include <stdlib.h> #include <cstring> #include <string.h> #include <cmath> #include <...原创 2018-04-24 22:13:55 · 6665 阅读 · 3 评论 -
紫书(算法竞赛)3.4.2思考题题目2的3个问题
#include <stdio.h> //隐藏错误:缺少头文件<string.h>#define maxn 10000000 + 10 //错误1:maxn太大,程序无法运行。int main(){ char s[maxn]; scanf("%s",s); int tot = 0; ...原创 2018-04-26 22:05:35 · 7802 阅读 · 0 评论 -
Where is the Marble? (简单题)
Sample Input 4 1 2 3 5 1 5 5 2 1 3 3 3 1 2 3 0 0 Sample Output CASE# 1: 5 found at 4 CASE# 2: 2 not found 3 found at 3 题目大意是找到指定数字(经过排序后的)位置,用sort()和lower_bound()就可以做了,记住的是不能用...原创 2018-08-09 20:46:17 · 10602 阅读 · 0 评论 -
The Blocks Problem (vector入门题)
Sample Input 10 move 9 onto 1 move 8 over 1 move 7 over 1 move 6 over 1 pile 8 over 6 pile 8 over 5 move 2 over 1 move 4 over 9 quit Sample Output 0: 0 1: 1 9 2 4 2: 3: 3 4: 5: 5 8 7 ...原创 2018-08-09 21:05:03 · 6479 阅读 · 2 评论 -
Andy's First Dictionary(set入门题)
Sample Input Adventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The sign read: "Disneyland Left." So they went home. Sample Output a adventures ...原创 2018-08-10 10:01:15 · 6552 阅读 · 0 评论 -
Ananagrams (map入门题)
Sample Input ladder came tape soon leader acme RIDE lone Dreis peat ScAlE orb eye Rides dealer NotE derail LaCeS drIed noel dire Disk mace Rob dries # Sample Output Disk NotE derail drIed ey...原创 2018-08-10 10:28:19 · 6446 阅读 · 0 评论 -
Matrix Chain Multiplication UVA - 442
Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary. ...原创 2018-10-08 20:22:31 · 6434 阅读 · 0 评论 -
UVA 524 素数环(dfs回溯)
#include<bits/stdc++.h> using namespace std; int A[120]; bool isp[150]; int n; int vis[150]; void dfs(int cur){ if(cur==n && isp[A[0]+A[n-1]]){ for(int i = 0;i < n;i++) ...原创 2019-01-22 19:43:22 · 6261 阅读 · 0 评论 -
最大连续和(子串)
用了4种方法实现: #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll maxn=1e5+10; const ll mod=1e9+7; int a[10000],b[10000],c[10000]; int n = 1000,t1 = 0,t2 = 0,t3 = 0,t4 = 0...原创 2019-08-21 23:36:48 · 13431 阅读 · 0 评论