![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
紫书
WANG_zibi
蒟蒻成长之路
展开
-
UVA - 558 Wormholes(SPFA判负环)
In the year 2163, wormholes were discovered. A wormhole is a subspace tunnel through space and time connecting two star systems. Wormholes have a few peculiar properties: • Wormholes are one-way only....原创 2019-11-23 23:42:10 · 188 阅读 · 0 评论 -
UVA - 10986 Sending email(堆优化的dijkstra||SPFA)
There are n SMTP servers connected by network cables. Each of the m cables connects two computers and has a certain latency measured in milliseconds required to send an email message. What is the shor...原创 2019-11-23 23:38:17 · 383 阅读 · 0 评论 -
UVA - 10048 Audiophobia【floyd变形||最小生成树】
Consider yourself lucky! Consider yourself lucky to be still breathing and having fun participating in this contest. But we apprehend that many of your descendants may not have this luxury. For, as yo...原创 2019-11-23 23:34:47 · 127 阅读 · 0 评论 -
UVA - 567 Risk(Floyd)
Risk is a board game in which several opposing players attempt to conquer the world. The gameboard consists of a world map broken up into hypothetical countries. During a player’s turn, armies station...原创 2019-11-23 23:28:53 · 121 阅读 · 0 评论 -
【紫书】UVa-725 Division(暴力枚举)
照着老师得来的,,, #include<bits/stdc++.h> using namespace std; int check(int abcde, int fghij) { int used[10], d; memset(used, 0, sizeof(used)); if(fghij < 10000) used[0] = 1...原创 2019-10-18 22:10:22 · 114 阅读 · 0 评论 -
【紫书】UVa 1592 Database(map )(字符串哈希 +排序(暂时空缺))
Peter studies the theory of relational databases. Table in the relational database consists of values that are arranged in rows and columns. There are different normal forms that database may adhere t...原创 2019-10-18 15:09:05 · 100 阅读 · 0 评论 -
【紫书】UVA - 156 Ananagrams(STLmap)
Most crossword puzzle fans are used to anagrams — groups of words with the same letters in different orders — for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have this attribute...原创 2019-10-17 15:39:06 · 102 阅读 · 0 评论 -
【紫书】UVa-10815 Andy's First Dictionary(set+stringstream)
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instead of thinking up all the wo...原创 2019-10-17 15:15:06 · 89 阅读 · 0 评论 -
【紫书】UVA - 10474 Where is the Marble?(排序)
很简单的一个题,被最后打印的**‘:’**弄自闭了 什么时候好好梳理一下STL里的各类函数的用法 根据紫书代码,下面AC的代码用到了lower_bound(二叉搜索树,O(nlogn)) #include <bits/stdc++.h> using namespace std; const int N = 100100; int main(){ int n,m,x,a[N],k=1...原创 2019-10-15 14:00:07 · 67 阅读 · 0 评论 -
【紫书】UVa489 Hangman Judge(模拟)
这个题,小模拟,AC的代码默写自紫书,注意输入输出 AC的代码 #include <bits/stdc++.h> using namespace std; const int N = 101; int l,sum; char s[N],s1[N]; bool win,lose; void guess(char ch){ bool flag=1; for(int i=0;i<s...原创 2019-10-15 13:29:07 · 95 阅读 · 0 评论 -
【紫书】UVa202 Repeating Decimals(模拟)
这题,不知道是在考输入输出还在考算法,心态爆炸 #include <bits/stdc++.h> using namespace std; const int N = 3000; int b[N]; int a[N]; int main() { int n, d, start, end, i, j; while (scanf("%d%d", &n, &d)...原创 2019-10-15 12:59:57 · 81 阅读 · 0 评论 -
【紫书】UVa232 Crossword Answers(模拟)
#include <bits/stdc++.h> using namespace std; const int N = 101; char mp[N][N]; int n,m; int vis[N][N]; bool fl[N][N]; void search(){ int num=1; for(int i=0;i<n;i++) for(int j=0;j<m;j+...原创 2019-10-15 12:58:34 · 88 阅读 · 0 评论 -
【紫书】UVa 1339 A - Ancient Cipher(字符串处理+排序)
Ancient Roman empire had a strong government system with various departments, including a secret service department. Important documents were sent between provinces and the capital in encrypted form t...原创 2019-10-13 22:55:27 · 140 阅读 · 0 评论 -
【紫书】UVa455 Periodic Strings(字符串处理)
A character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example, the string ”abcabcabcabc” has period 3, since it is...原创 2019-10-12 22:15:01 · 80 阅读 · 0 评论 -
【紫书】UVa- Digit Counting(水题)
Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N (1 < N < 10000). After that, he counts the num...原创 2019-10-12 19:27:25 · 73 阅读 · 0 评论 -
【紫书】UVa 1584 score(水题)
There is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problem and an ‘X’ means a wrong answer. The score of each problem of this test is calculated by itself and i...原创 2019-10-12 17:51:35 · 223 阅读 · 0 评论 -
【紫书】UVa 1584 Circular Sequence(环形串字符串处理)
题目链接 学了一下n=strlen(s),s[(p+i)%n]这个遍历环形串的写法 AC的代码 #include <bits/stdc++.h> using namespace std; const int N = 105; //判断p和q的字典序 int les(char s[],int p,int q){ int n=strlen(s); for(int i=0;i<n...原创 2019-10-12 17:38:39 · 117 阅读 · 0 评论 -
【紫书】UVa 1583 Digit Generator(打表)
For a positive integer N, the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N, we call N a generator of M. For example, the digit-sum of 245 is 256 (= 245 ...原创 2019-10-12 17:10:52 · 67 阅读 · 0 评论 -
【紫书】UVa 340 Master-Mind Hints(串处理)
MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the...原创 2019-10-12 16:48:00 · 92 阅读 · 0 评论 -
【紫书】UVa-401 A - Palindromes(字符串处理)
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string “ABCDEDCBA” is a palindrome because it is the same when the string is read from le...原创 2019-10-12 15:11:18 · 160 阅读 · 0 评论 -
acwing 95.费解的开关
你玩过“拉灯”游戏吗?25盏灯排成一个5x5的方形。每一个灯都有一个开关,游戏者可以改变它的状态。每一步,游戏者可以改变某一个灯的状态。游戏者改变一个灯的状态会产生连锁反应:和这个灯上下左右相邻的灯也要相应地改变其状态。 我们用数字“1”表示一盏开着的灯,用数字“0”表示关着的灯。下面这种状态 10111 01101 10111 10000 11011 在改变了最左上角的灯的状态后将变成: 01...转载 2019-10-18 21:24:13 · 82 阅读 · 0 评论