• YANG Contribution Procedures Direct Contributions Contributions Via Submodules Travis CI Jobs Slack Group and Channels Models Directory Structure Tools Directory Structure License Notes Code of ...
• For each test case, output the last four digits of the number of elements on the N + 1 line on Yang Hui Triangle which can not be divided by P in the format as indicated in the sample output. ...
• For each test case, output the last four digits of the number of elements on the N + 1 line on Yang Hui Triangle which can not be divided by P in the format as indicated in the sample output. ...
• <p>The <code>nb_oper_data_iterate()</code> API function was modified to accept a starting offset, a maximum number of elements to iterate over and outputs where the iteration stopped. The outputted ...
• For each test case, output the last four digits of the number of elements on the N + 1 line on Yang Hui Triangle which can not be divided by P in the format as indicated in the sample output. ...
• --rw asn ietf-inet-types:as-number | | +--rw metric? uint8 | | +--rw route-policy? route-policy-ref | +--rw cg-nat! | | +--rw metric? uint8 | | +--rw route-policy? route-...
• --ro source-port inet:port-number | +--ro dest-port? inet:port-number | +--ro session-running | | +--ro session-index? uint32 | | +--ro local-state? state | | +--ro remote-...
• 详细解释 请参见http://www.cnblogs.com/julie-yang/p/5147460.html #include<vector> #include<queue> #include<map> #include<limits> #include<iostre...

注意负数，所以要使用long，而不能用int
详细解释 请参见http://www.cnblogs.com/julie-yang/p/5147460.html

#include<vector>
#include<queue>
#include<map>
#include<limits>
#include<iostream>
using namespace std;
struct Node{
long idx;
long val;
};
struct cmp
{    bool operator()(const Node &a,const Node &b)
{
return a.val>b.val;
}
};
class Solution {
public:
int nthUglyNumber(int n) {
priority_queue<Node, vector<Node>, cmp> min_heap;
vector<int> primes;
primes.push_back(2);
primes.push_back(3);
primes.push_back(5);
if (primes.size() == 0) return 0;
map<long, int> start_idx;
start_idx[1] = 0;
int res = 1;

Node temp_node;
temp_node.idx = 1;     //idx  is the first val of start_idx
temp_node.val = primes[0];
min_heap.push(temp_node);

int cnt = 1;
if (n == 1) return 1;
long min_val = INT_MAX;

long min_idx = 0;
while (cnt < n)
{
min_val = min_heap.top().val;
min_idx = min_heap.top().idx;
min_heap.pop();
if ((res != (min_val)))
{
res = min_val;
cnt++;
start_idx[min_val] = 0;
temp_node.idx = min_val;     //idx  is the first val of start_idx
temp_node.val = min_val * primes[0];
min_heap.push(temp_node);

}
if (start_idx[min_idx] < primes.size() - 1)
{
start_idx[min_idx] ++;
temp_node.idx = min_idx;     //idx  is the first val of start_idx
temp_node.val = min_idx * primes[start_idx[min_idx]];
min_heap.push(temp_node);

}

}
return res;
}
};

转载于:https://www.cnblogs.com/julie-yang/p/5147485.html
展开全文
• 对于本题的意思是：  给出一数组，数组中其中有两个元素不是重复的，剩余的元素都是两个重复的，返回这两个不重复的元素 这样说来，这题就有些特殊了，首先这个数组...//author:liuyang //Time:28ms class Solution
对于本题的意思是：
给出一数组，数组中其中有两个元素不是重复的，剩余的元素都是两个重复的，返回这两个不重复的元素
这样说来，这题就有些特殊了，首先这个数组个数肯定是偶数，我们可以首先用sort排序，则第一个单独数肯定是位于基数位
上的，而且相同的数都是挨着的，可以用^ 来消除。具体程序如下：

//author:liuyang
//Time:28ms

class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
int x=0,index=0;
vector<int>result;
int n=nums.size();
sort(nums.begin(),nums.end());
for(int i=0;i<n;i++)
{
x^=nums[i];
if((i+1)%2==0 && x!=0 && index<1)
{
result.push_back(nums[i-1]);
x=0^nums[i];
index++;
}
}
result.push_back(x);
return result;

}
};
展开全文
• You've been invited to a party. The host wants to divide the guests into 2 teams for party games, with exactly the same number of guests on each team. She wants to be able to tell which guest is on wh

You've been invited to a party. The host wants to divide the guests into 2 teams for party games, with exactly the same number of guests on each team. She wants to be able to tell which guest is on which team as she greets them
when they arrive. She'd like to do so as easily as possible, without having to take the time to look up each guest's name on a list.

Being a good computer scientist, you have an idea: give her a single string, and all she has to do is compare the guest's name alphabetically to that string. To make this even easier, you would like the string to be as short as
possible.

Given the unique names of n party guests
(n is even), find the shortest possible string S such
that exactly half the names are less than or equal to S, and exactly
half are greater than S. If there are multiple strings of the same
shortest possible length, choose the alphabetically smallest string from among them.

Input

There may be multiple test cases in the input.

Each test case will begin with an even integer n (2n1,
000) on its own line.

On the next n lines will be names, one
per line. Each name will be a single word consisting only of capital letters and will be no longer than 30 letters.

The input will end with a 0' on its own line.

Output

For each case, print a single line containing the shortest possible string (with ties broken in favor of the alphabetically smallest) that your host could use to separate her guests. The strings should be printed in all capital
letters.

Sample
Input

4
FRED
SAM
JOE
MARGARET
2
FRED
FREDDIE
2
JOSEPHINE
JERRY
2
LARHONDA
LARSEN
0

Sample
Output

K
FRED
JF
LARI
题目大意：给你n个不相同的字符串，让你找出一个字符串s，s要满足以下条件：1、把n个字符串分为两部分，s >= （n / 2）个字符串， 并且 s < (n / 2) 个字符串；2、s 的长度尽可能短。 3、如果有多个长度相同的符合条件的s，输出字典序最小的s。
解题思路：先对字符串排序，分析第（n / 2）个字符串a和第（n / 2 + 1）个字符串b。此题需要想法全面，注意细节。
请看代码：
#include <iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
const int MAXN = 1005 ;
string s[MAXN] ;
string a , b ;
char ans[35] ;
int  we(string c , string d)
{
int len = min(c.length() , d.length() ) ;
int i ;
for(i = 0 ; i < len ; i ++)
{
if(c[i] != d[i])
{
return i ;
}
}
return -1 ;
}
int main()
{
int  n ;
while (scanf("%d" , &n) != EOF)
{
memset(ans , 0 , sizeof(ans)) ;
if(n == 0)
break ;
int i ;
for(i = 0 ; i < n ; i ++)
{
cin >> s[i] ;
}
sort(s , s + n) ;
a = s[n / 2 - 1] ;
b = s[n / 2] ;
int lena , lenb ;
lena =  a.length() ;
lenb = b.length() ;
int pos = -1 ;
if(lena < lenb)
{
pos = we(a , b) ;
if(pos == -1)
{
cout << a << endl ;
}
else
{
if(pos < lena - 1)
{
for(i = 0 ; i <= pos - 1 ; i ++)
{
ans[i] = a[i] ;
}
ans[pos] = a[pos] + 1 ;
ans[pos + 1] = '\0' ;
}
else
{
for(i = 0 ; i <= pos ; i ++)
{
ans[i] =  a[i] ;
}
ans[pos + 1] = '\0' ;
}
printf("%s\n" , ans) ;
}
}
else if(lena == lenb)
{
pos = we(a , b) ;
if(pos < lena - 1)
{
for(i = 0 ; i <= pos - 1 ; i ++)
{
ans[i] = a[i] ;
}
ans[pos] = a[pos] + 1 ;
ans[pos + 1] = '\0' ;
}
else
{
for(i = 0 ; i <= pos ; i ++)
{
ans[i] = a[i] ;
}
ans[pos + 1] = '\0' ;
}
printf("%s\n" , ans) ;
}
else
{
pos = we(a , b) ;
if(pos < lenb - 1)
{
for(i = 0 ; i < pos ; i ++)
{
ans[i] = a[i] ;
}
ans[pos] = a[pos] + 1 ;
ans[pos + 1] = '\0' ;
}
else
{
if(a[pos ] != b[pos] - 1)
{
for(i = 0 ; i < pos ; i ++)
{
ans[i] = a[i] ;
}
ans[pos] = a[pos] + 1 ;
ans[pos + 1] = '\0' ;
}
else
{
for(i = 0 ; i <= pos ; i ++)
{
ans[i] = a[i] ;
}
pos ++ ;
while (pos < lena )
{
if(a[pos] < 'Z')
{
if(pos == lena  - 1)
{
ans[pos] = a[pos] ;
ans[pos + 1] = '\0' ;
// cout << "NO" << endl ;
break ;
}
else
{
ans[pos] = a[pos] + 1 ;
ans[pos + 1] = '\0' ;
break ;
}
}
else
{
if(pos == lena - 1)
{
ans[pos] = a[pos] ;
ans[pos + 1] = '\0' ;
break ;
}
else
{
ans[pos] = a[pos] ;
pos ++ ;

}
}
}
}
}
printf("%s\n" , ans) ;
}
}
return 0;
}


展开全文
• Description You are a butler in a large mansion. This mansion has so many rooms that they are merely referred to by number (room 0, 1, 2, 3, etc...). Your master is a particularly absent-minded lou
Description

You are a butler in a large mansion. This mansion has so many rooms that they are merely referred to by number (room 0, 1, 2, 3, etc...). Your master is a particularly absent-minded lout and continually leaves doors open throughout a particular floor of the
house. Over the years, you have mastered the art of traveling in a single path through the sloppy rooms and closing the doors behind you. Your biggest problem is determining whether it is possible to find a path through the sloppy rooms where you: Always shut open doors behind you immediately after passing through Never open a closed door End up in your chambers (room 0) with all doors closed
In this problem, you are given a list of rooms and open doors between them (along with a starting room). It is not needed to determine a route, only if one is possible.
Input

Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.
A single data set has 3 components: Start line - A single line, "START M N", where M indicates the butler's starting room, and N indicates the number of rooms in the house (1 <= N <= 20). Room list - A series of N lines. Each line lists, for a single room, every open door that leads to a room of higher number. For example, if room 3 had open doors to rooms 1, 5, and 7, the line for room 3 would read "5 7". The first line in the list represents
room 0. The second line represents room 1, and so on until the last line, which represents room (N - 1). It is possible for lines to be empty (in particular, the last line will always be empty since it is the highest numbered room). On each line, the adjacent
rooms are always listed in ascending order. It is possible for rooms to be connected by multiple doors! End line - A single line, "END"
Following the final data set will be a single line, "ENDOFINPUT".
Note that there will be no more than 100 doors in any single data set.
Output

For each data set, there will be exactly one line of output. If it is possible for the butler (by following the rules in the introduction) to walk into his chambers and close the final open door behind him, print a line "YES X", where X is the number of doors
he closed. Otherwise, print "NO".
Sample Input
START 1 2
1

END
START 0 5
1 2 2 3 3 4 4

END
START 0 10
1 9
2
3
4
5
6
7
8
9

END
ENDOFINPUT
Sample Output
YES 1
NO
YES 10
题目大意不在敖述，此题是一道典型的求无向图中有无欧拉回路或欧拉通路的问题。首先是建图：以房间为顶点，房间之间的门为边建立无向图。然后就是输入问题，要求大家对字符串的有较好的处理能力，我用的是getchar()。然后请看代码：
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<queue>
using namespace std ;
const int MAXN = 105 ;
const int INF = 0x7fffffff ;
int d[MAXN] ; // 建立顶点的度的数组
int main()
{
string s ;
int m , n ;
int sumt , sumj , sumd ;
while (cin >> s)
{
if(s == "START")
{
scanf("%d%d" , &m , &n) ;
getchar() ; // 处理刚才的回车，此处千万不要忘记 ！！
memset(d , 0 , sizeof(d)) ;
int i ;
sumd = 0 ; // 统计边的数目，即门的数目
int pan = 0 ; // 注意这个判断变量的应用，请大家自己体会 ！！
for(i = 0 ; i < n ; i ++)
{
sumt = 0 ;
char t ;
while (1)
{
t = getchar() ;
if(t == '\n')
{
if(pan)
{
d[i] ++ ;
d[sumt] ++ ;
sumd ++ ;
pan = 0 ;
}
break ;
}
if(t == ' ')
{
d[i] ++ ;
d[sumt] ++ ;
sumd ++ ;
sumt = 0 ;
}
else
{
sumt = sumt * 10 + t - '0' ;
pan = 1 ;
}
}
}
}
if(s == "END")
{
int j ;
sumj = 0 ; // 统计奇度顶点的个数
for(j = 0 ; j < n ; j ++)
{
if(d[j] % 2 == 1)
{
sumj ++ ;
}
}
if(sumj > 2 || sumj == 1)
{
printf("NO\n") ;
}
else if(sumj == 0 && m != 0)
{
printf("NO\n") ;
}
else if(sumj == 2 && (d[m] % 2 != 1 || d[0] % 2 != 1))
{
printf("NO\n") ;
}
else if(sumj == 2 && d[m] % 2 == 1 && d[0] % 2 == 1 && m == 0)
{
printf("NO\n") ;
}
else
{
printf("YES %d\n" ,sumd) ;
}
}
if(s == "ENDOFINPUT")
{
break ;
}
}
return 0 ;
}

`
展开全文
• row_number()可以查找主键不相连的数据 select * from (select row_number()over(order by peopleId desc) as rowNum ,* from T_People)as tb where rowNum between...转载于:https://www.cnblogs.com/yang_mysky/a...
• <p>note: When I decrease the number of ENUM in charg-type.yang, the get-config is OK, I'm not sure whether there is number limination. <p>Thanks Darcy</p><p>该提问来源于开源项目：sysrepo/...
• Description Did you know that you can use domino bones for other things besides playing Dominoes? Take a number of dominoes and build a row by standing them on end with only a small distance in bet
• A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (th
• Description A World Cup of association football is being held with teams from around the world. The standing is based on the number of points won by the teams, and the distribution of points is d
• <p>Consider a following YANG hierarchy: <pre><code> top +-- alist [key1] +-- key1 +-- leaf1 +-- blist [key2] +--key2 +--leaf2 </code></pre> <p>Sample Data: <pre><code>xml...
• number of records response time 50 0.389s 100 1.521s 200 10.57s 300 30s 500 2m 19.17s 1000 15m 39s 2000 49m <p>Content of the test xml: <pre><code>xml <test-container xmlns="...
• <p>I have the yang module bellow <pre><code> container TESTAPPNEW { container LARGEDEFAULTs { list LARGEDEFAULT { key "INDEX"; config true; description "largedefault"; leaf ...
• Our application limits the number of threads due to resource constraints. And I am wondering if we can configure that when initialize_blob_client. <p>Thanks, <p>Yang</p><p>该提问来源于开源项目：...
• class Solution {  const vector yang=  {  " ",  "",  "abc",  "def",  "ghi",  "jkl",  "mno",
• Premise: Given a specification for a “base” (well, actually a mixed radix number system), take in pairs of numbers written in our “base”, perform a specified operation on them and outp
• <div><p>Hi, <p>I have tested this. Email address if it'... All other email addresses are fine....Could you investigate it?...Yang</p><p>该提问来源于开源项目：seven1m/onebody</p></div>
• attribute d: Expected number, "MNaN,NaNLNaN,NaN". </path></code></pre> <p>The error message could be improved (it took me about 15 min to figure it out).</p><p>该提问来源于开源项目&#...
• 题目1 CCPC-Wannafly Winter Camp Day4 G.置置置换 wls有一个整数n(n<=1e4)，他想请你算一下有多少1...n的排列（permutation）满足: ...https://www.90yang.com/camp-day4-div2/① https://www.icode9.com/conte.
• pkg/yang/entry_test.go:1154::error: arg dir for printf verb %s of wrong type: map[string]<em>yang.Entry (vet) pkg/yang/node.go:305::error: missing argument for Fprintf("%s"): format reads arg ...
• DescriptionDiao Yang keeps many dogs. But today his dogs all run away. Diao Yang has to catch them... To simplify the problem, we assume Diao Yang and all the dogs are on a number axis. The dogs are numb

...