ural 1837. Isenbaev's Number bfs】的更多相关文章

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1837 描述: Isenbaev是国外的一个大牛. 现在有许多人要参加ACM ICPC. 一共有n个组,每组3个人.同组的3个人都是队友. 大家都想知道自己与大牛的最小距离是多少. 大牛与自己的最小距离当然是0.大牛的队友和大牛的最小距离是1.大牛的队友的队友和大牛的最小距离是2……以此类推. 如果实在和大牛没有关系的只好输出undefined了. 第一行读入n.表示有n个组.1 ≤ n ≤ 1…
http://acm.timus.ru/problem.aspx?space=1&num=1837 #include <cstdio> #include <cstring> #include <vector> #include <string> #include <iostream> #include <queue> #include <algorithm> using namespace std; vector&…
1837. Isenbaev's Number Time limit: 0.5 second Memory limit: 64 MB Vladislav Isenbaev is a two-time champion of Ural, vice champion of TopCoder Open 2009, and absolute champion of ACM ICPC 2009. In the time you will spend reading this problem stateme…
1837 被数据结构部分打击的不行了 换地 刷点简单的 图论第一题 floyd水过 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<string> #include<map> using namespace std; ][]; #define INF 0xffffff…
坑爹题,两种输入输出互相交换,裸bfs #include <stdio.h> #include <string.h> typedef struct { int x; int y; } point; point q[310]; int vis[15][15],mat[15][15]; int dx[4]= {1,0,-1,0}; int dy[4]= {0,1,0,-1}; char ans[5]= {"RTLB"}; int bfs1(int x,int y)…
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.…
网站:CSUST 8月1日 先总结下,不得不说死的很惨,又是第三就不说了,一共7道题,AC了5道,但是有一个组三个人是做的个人赛,有两人AK了.......Orz,然后深搜还是大问题,宽搜倒是不急了. 而且,其中还有一题是水过去的.唉,不说了,好好看.╮(╯▽╰)╭ A    骑士历遍问题:给出m,n,指大小为m*n的棋盘,问骑士是否能遍历整个棋盘,要求把路径打出来,(要按字典序)A Knight's Journey   POJ 2488 网上找到了个很好地代码,解释很清晰:http://www…
目录 2018-2019 ICPC, NEERC, Southern Subregional Contest (Codeforces 1070) A.Find a Number(BFS) C.Cloud Computing(线段树) D.Garbage Disposal(模拟) E.Getting Deals Done(二分) F.Debate(贪心) H.BerOS File Suggestion(后缀自动机) I.Privatization of Roads in Berland(网络流)…
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", &q…
Description Input is the matrix A of N by N non-negative integers. A distance between two elements Aij and Apq is defined as |i − p| + |j − q|. Your program must replace each zero element in the matrix with the nearest non-zero one. If there are two…