Problem Description
At present, the university rankings are very popublar.They help senior high school students to choose universities for study.For example,you can find the CHINESE UNIVERSITY RANGKINGS at http://www.netbig.com/.
As we know ,a university ususally has many different departments,such as department of Language(FLS).some of them are quit good when comparing to other universities,but others are not.So,most of universities'rangkings are are composed of several ranking lists, each list for one department.
But here comes a problem that sometimes it's hard to determine which universities is better,when comparing two universities with each othe.Fortunately,Doctor Bob has advanced a new concept named "absolutely better",with which the problem above can be solved.
Now,here is a an example to explain the concept "absolutely better":
Assum that there are three universities (X,Y,Z)and every university has three department:CS,EE and FLS.And the rangkings of the departments are as the followed:
The rankings of the CS:X>Y>Z(X>Y means X has a better CS department than Y)
The rankings of the EE:X>Z>Y
The rankings of the FLS:Z>X>y
Obviously,each each department of University X is better than that of University Y. Then,it's called that X is absolutely better than Y.Using the "absolutely better"concept, it becomes better to compare some paires of Universities.
Now Bob has the complete rangkings of different departments of many universities,and he wants to find k universities(U1,u2,....Uk)such that Ui is absolutely better that Uj(for any i<j).

Input
The first line of the input is a positive integer C.C is the number of test cases
followed.
The first line of each test case is two positive integers N,M(0<N,M<=100),N is the number of the universities and M is the number of departments.And then M lines follow.The i(th)(1<=i<=M)line contains N numbers Ui(1<=i<=N,1<=Ui<=N),indicating the ranking of the i(th)department.If Universitites Ui preceds to University Uj in line k(th department, then the k(th)department do Ui is better than k(th) department of Uj.

Output
The output should consist fo C lines, one lines for each test case.Each line only constains one integer- the maximum values fo k as descriped above.No redundant spaces are needed.

Sample Input
1
3 3
1 2 3
1 3 2
3 1 2

Sample Output
2

Problem Description There is an undirected graph G with n vertices and m edges. Every time, you can select several edges and delete them. The edges selected must meet the following condition: let G′ be graph induced from these edges, then every connected component of G′ has at most one cycle. What is the minimum number of deletion needed in order to delete all the edges. Input There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case: The first line contains two integers n and m (1≤n≤2000,0≤m≤2000) -- the number of vertices and the number of edges. For the next m lines, each line contains two integers ui and vi, which means there is an undirected edge between ui and vi (1≤ui,vi≤n,ui≠vi). The sum of values of n in all test cases doesn't exceed 2⋅104. The sum of values of m in all test cases doesn't exceed 2⋅104. Output For each test case, output the minimum number of deletion needed. Sample Input 3 4 2 1 2 1 3 4 5 1 2 1 3 1 4 2 3 2 4 4 4 1 2 2 3 3 4 4 1 Sample Output 1 2 1

Problem Description 数列的定义如下： 数列的第一项为n，以后各项为前一项的平方根，求数列的前m项的和。 Input 输入数据有多组，每组占一行，由两个整数n（n<10000）和m(m<1000)组成，n和m的含义如前所述。 Output 对于每组输入数据，输出该数列的和，每个测试实例占一行，要求精度保留2位小数。 Sample Input 81 4 2 2 Sample Output 94.73 3.41

#include<stdio.h> int main() { int A,B; while(scanf("%d%d",&A,&B)!=EOF) { int l,m,i,j; l=0; m=0; long long int s[A],r[B]; for(i=m;i<A;i++) { scanf("%lld",&s[i]); } for(i=m;i<B;i++) { scanf("%lld",&r[i]); } for(j=0;j<B;j++) { for(i=m;i<A;i++) { if(r[j]==s[i]) { l=l+1; m=i+1; break; } else continue; } } if(l==B) printf("yes"); else printf("no"); } return 0; } 这么做对嘛

Problem Description There is a sequence of n positive integers. Fancycoder is addicted to learn their product, but this product may be extremely huge! However, it is lucky that FancyCoder only needs to find out one factor of this huge product: the smallest factor that contains more than 2 factors（including itself; i.e. 4 has 3 factors so that it is a qualified factor）. You need to find it out and print it. As we know, there may be none of such factors; in this occasion, please print -1 instead. Input The first line contains one integer T (1≤T≤15), which represents the number of testcases. For each testcase, there are two lines: 1. The first line contains one integer denoting the value of n (1≤n≤100). 2. The second line contains n integers a1,…,an (1≤a1,…,an≤2×109), which denote these n positive integers. Output Print T answers in T lines. Sample Input 2 3 1 2 3 5 6 6 6 6 6 Sample Output 6 4

Problem Description After little Jim learned Fibonacci Number in the class , he was very interest in it. Now he is thinking about a new thing -- Fibonacci String . He defines : str[n] = str[n-1] + str[n-2] ( n > 1 ) He is so crazying that if someone gives him two strings str[0] and str[1], he will calculate the str[2],str[3],str[4] , str[5].... For example : If str[0] = "ab"; str[1] = "bc"; he will get the result , str[2]="abbc", str[3]="bcabbc" , str[4]="abbcbcabbc" …………; As the string is too long ,Jim can't write down all the strings in paper. So he just want to know how many times each letter appears in Kth Fibonacci String . Can you help him ? Input The first line contains a integer N which indicates the number of test cases. Then N cases follow. In each case,there are two strings str[0], str[1] and a integer K (0 <= K < 50) which are separated by a blank. The string in the input will only contains less than 30 low-case letters. Output For each case,you should count how many times each letter appears in the Kth Fibonacci String and print out them in the format "X:N". If you still have some questions, look the sample output carefully. Please output a blank line after each test case. To make the problem easier, you can assume the result will in the range of int. Sample Input 1 ab bc 3 Sample Output a:1 b:3 c:2 d:0 e:0 f:0 g:0 h:0 i:0 j:0 k:0 l:0 m:0 n:0 o:0 p:0 q:0 r:0 s:0 t:0 u:0 v:0 w:0 x:0 y:0 z:0

Problem Description Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each sequence are recognizable. Xinlv wants to know some numbers in these sequences, and he needs your help. Input The first line contains an integer N, indicting that there are N sequences. Each of the following N lines contain four integers. The first three indicating the first three numbers of the sequence, and the last one is K, indicating that we want to know the K-th numbers of the sequence. You can assume 0 < K <= 10^9, and the other three numbers are in the range [0, 2^63). All the numbers of the sequences are integers. And the sequences are non-decreasing. Output Output one line for each test case, that is, the K-th number module (%) 200907. Sample Input 2 1 2 3 5 1 2 4 5 Sample Output 5 16

Problem Description Friend number are defined recursively as follows. (1) numbers 1 and 2 are friend number; (2) if a and b are friend numbers, so is ab+a+b; (3) only the numbers defined in (1) and (2) are friend number. Now your task is to judge whether an integer is a friend number. Input There are several lines in input, each line has a nunnegative integer a, 0<=a<=2^30. Output For the number a on each line of the input, if a is a friend number, output “YES!”, otherwise output “NO!”. Sample Input 3 13121 12131 Sample Output YES! YES! NO!

# 斐波那契数列前n项和问题 如果数列的前前两项不为1，而是a1和a2，那应该怎么设计这个函数呢？ ``` #include"stdio.h" int fb(int a1,int a2,int n); int main() { int a,b,n,s; scanf("%d%d%d",&a,&b,&n); s=fb(a,b,n); printf("%d\n",s); } ``` ``` int fb(int a1,int a2,int n); { } ```

Problem Description 数列的定义如下： 数列的第一项为n，以后各项为前一项的平方根，求数列的前m项的和。 Input 输入数据有多组，每组占一行，由两个整数n（n<10000）和m(m<1000)组成，n和m的含义如前所述。 Output 对于每组输入数据，输出该数列的和，每个测试实例占一行，要求精度保留2位小数。 Sample Input 81 4 2 2 Sample Output 94.73 3.41

Problem Description Being a pirate means spending a lot of time at sea. Sometimes, when there is not much wind, days can pass by without any activity. To pass the time between chores, pirates like to play games with coins. An old favorite of the pirates is a game for two players featuring one stack of coins. In turn, each player takes a number of coins from the stack. The number of coins that a player takes must be a power of a given integer K (1, K, K^2, etcetera). The winner is the player to take the last coin(s). Can you help the pirates gure out how the player to move can win in a given game situation? Input The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format: One line with two integers S and K, satisfying 1 <= S <= 10^9 and 1 <= K <= 100: the size of the stack and the parameter K, respectively. Output For every test case in the input, the output should contain one integer on a single line: the smallest number of coins that the player to move can take in order to secure the win. If there is no winning move, the output should be 0. Sample Input 5 5 1 3 2 8 2 50 3 100 10 Sample Output 1 0 2 0 1

C语言中fibonacci数列的问题

Problem Description 我们有一个数列A1,A2...An，你现在要求修改数量最少的元素，使得这个数列严格递增。其中无论是修改前还是修改后，每个元素都必须是整数。 请输出最少需要修改多少个元素。 Input 第一行输入一个T(1≤T≤10)，表示有多少组数据 每一组数据： 第一行输入一个N(1≤N≤105)，表示数列的长度 第二行输入N个数A1,A2,...,An。 每一个数列中的元素都是正整数而且不超过106。 Output 对于每组数据，先输出一行 Case #i: 然后输出最少需要修改多少个元素。 Sample Input 2 2 1 10 3 2 5 4 Sample Output Case #1: 0 Case #2: 1

Problem Description 　　Cut or not to cut, it is a question. 　　In Fruit Ninja, comprising three or more fruit in one cut gains extra bonuses. This kind of cuts are called bonus cuts. 　　Also, performing the bonus cuts in a short time are considered continual, iff. when all the bonus cuts are sorted, the time difference between every adjacent cuts is no more than a given period length of W. 　　As a fruit master, you have predicted the times of potential bonus cuts though the whole game. Now, your task is to determine how to cut the fruits in order to gain the most bonuses, namely, the largest number of continual bonus cuts. 　　Obviously, each fruit is allowed to cut at most once. i.e. After previous cut, a fruit will be regarded as invisible and won't be cut any more. 　　In addition, you must cut all the fruit altogether in one potential cut. i.e. If your potential cut contains 6 fruits, 2 of which have been cut previously, the 4 left fruits have to be cut altogether. Input 　　There are multiple test cases. 　　The first line contains an integer, the number of test cases. 　　In each test case, there are three integer in the first line: N(N<=30), the number of predicted cuts, M(M<=200), the number of fruits, W(W<=100), the time window. 　　N lines follows. 　　In each line, the first integer Ci(Ci<=10) indicates the number of fruits in the i-th cuts. 　　The second integer Ti(Ti<=2000) indicate the time of this cut. It is guaranteed that every time is unique among all the cuts. 　　Then follow Ci numbers, ranging from 0 to M-1, representing the identifier of each fruit. If two identifiers in different cuts are the same, it means they represent the same fruit. Output 　　For each test case, the first line contains one integer A, the largest number of continual bonus cuts. 　　In the second line, there are A integers, K1, K2, ..., K_A, ranging from 1 to N, indicating the (Ki)-th cuts are included in the answer. The integers are in ascending order and each separated by one space. &nbsp;If there are multiple best solutions, any one is accepted. Sample Input 1 4 10 4 3 1 1 2 3 4 3 3 4 6 5 3 7 7 8 9 3 5 9 5 4 Sample Output 3 1 2 3

Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生，它是这样定义的： F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以，1,2,3,5,8,13……就是菲波那契数列。 在HDOJ上有不少相关的题目，比如1005 Fibonacci again就是曾经的浙江省赛题。 今天，又一个关于Fibonacci的题目出现了，它是一个小游戏，定义如下： 1、 这是一个二人游戏; 2、 一共有3堆石子，数量分别是m, n, p个； 3、 两人轮流走; 4、 每走一步可以选择任意一堆石子，然后取走f个； 5、 f只能是菲波那契数列中的元素（即每次只能取1，2，3，5，8…等数量）； 6、 最先取光所有石子的人为胜者； 假设双方都使用最优策略，请判断先手的人会赢还是后手的人会赢。 Input 输入数据包含多个测试用例，每个测试用例占一行，包含3个整数m,n,p（1<=m,n,p<=1000）。 m=n=p=0则表示输入结束。 Output 如果先手的人能赢，请输出“Fibo”，否则请输出“Nacci”，每个实例的输出占一行。 Sample Input 1 1 1 1 4 1 0 0 0 Sample Output Fibo Nacci

Problem Description 有一个长度为n(n<=100)的数列，该数列定义为从2开始的递增有序偶数，现在要求你按照顺序每m个数求出一个平均值，如果最后不足m个，则以实际数量求平均值。编程输出该平均值序列。 Input 输入数据有多组，每组占一行，包含两个正整数n和m，n和m的含义如上所述。 Output 对于每组输入数据，输出一个平均值序列，每组输出占一行。 Sample Input 3 2 4 2 Sample Output 3 6 3 7

C语言程序设计，求数列的前m项的和

Problem Description 数列的定义如下： 数列的第一项为n，以后各项为前一项的平方根，求数列的前m项的和。 Input 输入数据有多组，每组占一行，由两个整数n（n<10000）和m(m<1000)组成，n和m的含义如前所述。 Output 对于每组输入数据，输出该数列的和，每个测试实例占一行，要求精度保留2位小数。 Sample Input 81 4 2 2 Sample Output 94.73 3.41

Java基础知识面试题（2020最新版）

Linux 会成为主流桌面操作系统吗？

loonggg读完需要3分钟速读仅需 1 分钟大家好，我是你们的校长。我之前讲过，这年头，只要肯动脑，肯行动，程序员凭借自己的技术，赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

MySQL数据库面试题（2020最新版）

Redis核心原理与应用实践

Redis核心原理与应用实践 在很多场景下都会使用Redis，但是到了深层次的时候就了解的不是那么深刻，以至于在面试的时候经常会遇到卡壳的现象，学习知识要做到系统和深入，不要把Redis想象的过于复杂，和Mysql一样，是个读取数据的软件。 有一个理解是Redis是key value缓存服务器，更多的优点在于对value的操作更加丰富。 安装 yum install redis #yum安装 b...

!大部分程序员只会写3年代码

2020阿里全球数学大赛：3万名高手、4道题、2天2夜未交卷

HTTP与HTTPS的区别