nxt

How to make local USB port to work with Azure virtual machine

风格不统一 提交于 2019-12-10 18:05:33
问题 I am new to Azure, I want to connect my local USB port to Azure VM (for debugging apps), how can I do this? If I can connect local USB (USB of my PC) to Azure VM , I can make 100% use of Azure as PC, and I can run apps without any problem. Please help out doing this. 回答1: simply right click on the rdp file and click on edit and select local resource there you can find option called ports 回答2: Expanding on the answer above - you can also configure under Drives the option so that all new USBs

How to calibrate the Lego NXT color sensor with LeJos NXJ?

寵の児 提交于 2019-12-10 11:29:12
问题 I'm currently writing on a program about detecting different colored balls and sorting them with the Lego NXT and its color sensor. At the beginning it worked quite good but now, the color sensor always returnes the color ID "7" (white), no matter what i do. On the documentation page i found something about a calibration (calibrateHigh() and calibrateLow()). Does anybody know how to use this calibration or is my color sensor broken? I tried it with this code: package com.mydomain; import

HDUNumber Sequence(KMP)

妖精的绣舞 提交于 2019-12-08 12:55:39
传送门 题目大意:b在a第一次出现的位置 题解:KMP 代码: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define N 1000008 #define M 10009 using namespace std; int T; int a[N],b[M]; int nxt[M]; int lena,lenb; void getnext() { memset(nxt,0,sizeof(nxt)); for(int i=2,j=0;i<=lenb;i++) { while(b[i]!=b[j+1]&&j) j=nxt[j]; if(b[i]==b[j+1]) nxt[i]=++j; } } int KMP() { getnext(); // for(int i=0;i<=lenb;i++) cout<<i<<"---"<<nxt[i]<<endl; for(int i=1,k=0;i<=lena;i++) { for(;a[i]!=b[k+1]&&k;k=nxt[k]); if(a[i]==b[k+1])++k; if(k==lenb) return i-lenb+1; } return -1; } int main() { scanf("%d",&T); while(T--)

Lego Mindstorm NXT 2.0: “Error: NXT Bluetooth passkey confirmation failed”

不羁岁月 提交于 2019-12-07 18:48:23
问题 Running Windows 7 and the Lego Mindstorms NXT 2.0 IDE. The Windows bluetooth manager shows the NXT is connected and the NXT shows up in the Windows list of bluetooth devices. When I try to connect from the Lego IDE, however, I get a message that says "Error: NXT Bluetooth passkey confirmation failed". I entered the pairing key on the NXT and within Windows with no problems. The problem is when I am in the IDE trying to connect to the NXT. Any suggestions? Update - January 8, 2010 I have it

KMP算法模板

拟墨画扇 提交于 2019-12-07 12:53:24
1.啥是KMP算法? KMP算法是一种改进的字符串匹配算法,由D.E.Knuth,J.H.Morris和V.R.Pratt提出的,因此人们称它为克努特—莫里斯—普拉特操作(简称KMP算法)。KMP算法的核心是利用匹配失败后的信息,尽量减少模式串与主串的匹配次数以达到快速匹配的目的。具体实现就是通过一个next()函数实现,函数本身包含了模式串的局部匹配信息。KMP算法的时间复杂度O(m+n)。(源自 百度百科 ) 2.代码 #include<bits/stdc++.h> using namespace std; int nxt[1005]; void GetNext(string p) { int pLen=p.length(); nxt[0]=-1; int k=-1; int j=0; while (j<pLen-1) { if(k==-1||p[j]==p[k]) { ++k; ++j; nxt[j] = k; } else k=nxt[k]; } } int KMP1(string s,string p)//返回位置 { int i=0,j=0,sLen=s.length(),pLen=p.length(); GetNext(p); while(i<sLen&&j<pLen) { if(j==-1||s[i]==p[j]) { i++; j++; } else j=nxt

Lego Mindstorm NXT 2.0: “Error: NXT Bluetooth passkey confirmation failed”

只愿长相守 提交于 2019-12-06 13:20:23
Running Windows 7 and the Lego Mindstorms NXT 2.0 IDE. The Windows bluetooth manager shows the NXT is connected and the NXT shows up in the Windows list of bluetooth devices. When I try to connect from the Lego IDE, however, I get a message that says "Error: NXT Bluetooth passkey confirmation failed". I entered the pairing key on the NXT and within Windows with no problems. The problem is when I am in the IDE trying to connect to the NXT. Any suggestions? Update - January 8, 2010 I have it working on one computer. It's a desktop PC running Windows 7 Ultimate 32-bit. Same BT adapter, I just

How to calibrate the Lego NXT color sensor with LeJos NXJ?

孤街醉人 提交于 2019-12-06 11:09:49
I'm currently writing on a program about detecting different colored balls and sorting them with the Lego NXT and its color sensor. At the beginning it worked quite good but now, the color sensor always returnes the color ID "7" (white), no matter what i do. On the documentation page i found something about a calibration (calibrateHigh() and calibrateLow()). Does anybody know how to use this calibration or is my color sensor broken? I tried it with this code: package com.mydomain; import lejos.nxt.*; public class HelloWorld { public static void main(String[] args) throws Exception {

洛谷 UVA1328 Period

匆匆过客 提交于 2019-12-05 20:26:27
洛谷 UVA1328 Period 洛谷传送门 题目描述 PDF 输入格式 无 输出格式 无 题意翻译 题意描述 对于给定字符串S的每个 前缀 ,我们想知道它是否为周期串。也就还是说,它是否为某一字符串重复连接而成(必须至少重复2次)(即循环节)。 输入 多组数据。每组数据,第一行一个数字表示长度,第二行一个字符串S。 输出 输出前缀长度与循环节数量。 说明 字符串长度不超过1000000,仅由小写字母组成。 对于每个前缀,只要输出 长度最小的 循环节 输入输出样例 无 一道KMP算法的练手好题。 大体的题目大意是这样的: 题目大意: 如果一个字符串S是由一个字符串T重复K次形成的,则称T是S的循环元。使K最大的字符串T称为S的最小循环元,此时的K称为最大循环次数。 现给一个给定长度为N的字符串S,对S的每一个前缀S[1~i],如果它的最大循环次数大于1,则输出该前缀的最小循环元长度和最大循环次数。 题解: 一道KMP算法的题目,如果对KMP算法还是没有什么深刻的理解或者还没学KMP算法的,请移步我的这篇博客,讲解还算详细: KMP算法详解 一开始拿到题没什么思路(我还是太菜了) 后来发现,对给出的串 \(S\) 自匹配求出 \(nxt\) 数组之后,对于每一个 \(i\) ,一定会有这么一个结论: \[ S[1\,\,to\,\,nxt[i]]=S[i-nxt[i]+1\,\

POJ 1961 Period

血红的双手。 提交于 2019-12-05 20:25:39
POJ 1961 Period POJ传送门 Description For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 <= i <= N) we want to know the largest K > 1 (if there is one) such that the prefix of S with length i can be written as AK ,that is A concatenated K times, for some string A. Of course, we also want to know the period K. Input The input consists of several test cases. Each test case consists of two lines. The first one contains N (2 <= N <= 1 000 000) – the size

网络最大流 复习

眉间皱痕 提交于 2019-12-04 13:38:14
哎 打板子 调了 \(2\) h 无语了 \(EdmondKarp+Dinic(Dinitz)\) #include <set> #include <stack> #include <queue> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define reg register int #define isdigit(x) ('0' <= x&&x <= '9') template<typename T> inline T Read(T Type) { T x = 0,f = 1; char a = getchar(); while(!isdigit(a)) {if(a == '-') f = -1;a = getchar();} while(isdigit(a)) {x = (x << 1) + (x << 3) + (a ^ '0');a = getchar();} return x * f; } const int MAXN = 10010,MAXM = 100010; int cnt,n,m,s,t,_ori[MAXN]; struct EDGE { int v,w,_nxt; EDGE() {v = w = _nxt

工具导航Map