
紫书
努力的气球
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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 · 6675 阅读 · 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 · 7816 阅读 · 0 评论 -
Where is the Marble? (简单题)
Sample Input4 1235155 213331230 0Sample OutputCASE# 1:5 found at 4CASE# 2:2 not found3 found at 3 题目大意是找到指定数字(经过排序后的)位置,用sort()和lower_bound()就可以做了,记住的是不能用...原创 2018-08-09 20:46:17 · 10613 阅读 · 0 评论 -
The Blocks Problem (vector入门题)
Sample Input10move 9 onto 1move 8 over 1move 7 over 1move 6 over 1pile 8 over 6pile 8 over 5move 2 over 1move 4 over 9quitSample Output0: 01: 1 9 2 42:3: 34:5: 5 8 7 ...原创 2018-08-09 21:05:03 · 6495 阅读 · 2 评论 -
Andy's First Dictionary(set入门题)
Sample InputAdventures in DisneylandTwo blondes were going to Disneyland when they came to a fork in theroad. The sign read: "Disneyland Left."So they went home.Sample Outputaadventures...原创 2018-08-10 10:01:15 · 6567 阅读 · 0 评论 -
Ananagrams (map入门题)
Sample Inputladder came tape soon leader acme RIDE lone Dreis peatScAlE orb eye Rides dealer NotE derail LaCeS drIednoel dire Disk mace Rob dries#Sample OutputDiskNotEderaildrIedey...原创 2018-08-10 10:28:19 · 6464 阅读 · 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 · 6445 阅读 · 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 · 6273 阅读 · 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 · 13446 阅读 · 0 评论