【正文】
ex++。x39。bool A()。+39。)39。}return 0。int b=findRoot(E[i].b)。int ans=0。sort(E+1,E+1+m,Cmp)。i++)scanf(%d%d%d,amp。n)!=EOF){scanf(%d,amp。}int main(){int n。else{int tmp=findRoot(Tree[x])。int cost。i++)printf(%d\n,num[pos[i]])。pos[i])。k)。i=n。int i。s a number N (1=N=100000), in the next N lines there are numbers of the database one in each line in an arbitrary order. A sequence of queries is written simply as well: in the first line of the sequence a number of queries K (1 = K = 100) is written, and in the next K lines there are queries one in each line. The query Which element is ith by its value? is coded by the number i. Output The output should consist of K lines. In each line there should be an answer to the corresponding query. The answer to the query i is an element from the database, which is ith by its value (in the order from the least up to the greatest element). Sample Input 5712112371213325 Sample Output 1217123includeincludealgorithmusing namespace std。printf(%d %d\n,getgcd(a,b),a*b/(getgcd(a,b)))。while(scanf(%d,amp。gcd=t1%t2。t2=b。}}return 0。prime[n+1i]==true)sum++。for(i=2。c)!=EOF){while(c){scanf(%d,amp。}}}}int main(){int c。i=10005。i=10005。int j。}printf(\n)。str[i]=39。i++){if(str[i]=39。while(gets(str)){l=strlen(str)。 } printf(%d\n,an++)。b)。while(scanf(%d,amp。2009機(jī)試 2計(jì)算和的數(shù)位 2大寫(xiě)改小寫(xiě) 3素?cái)?shù)對(duì) 4求最大公約數(shù)和最小公倍數(shù) 6排序后求位置處的數(shù) 7*路由器連接 8*編譯原理 10*分開(kāi)連接 132010機(jī)試 17ECNU的含義 17空瓶換啤酒 18統(tǒng)計(jì)字符 202010機(jī)試熱身 21粽子買(mǎi)三送一,買(mǎi)五送二 21工程流水線問(wèn)題 222011機(jī)試 24hello world 24Special judge 26查詢(xún)成績(jī) 282011機(jī)試熱身 30貪吃蛇 30仰望星空 34*編輯距離 362012機(jī)試 38字母排序 38幸運(yùn)數(shù) 39十六進(jìn)制的加法 42電話號(hào)碼簿合并排序 42*五子棋 43*正則表達(dá)式匹配 452013機(jī)試 46斐波那契數(shù)列的素?cái)?shù)個(gè)數(shù) 46*將a字符變成b字符最少修改次數(shù) 472013機(jī)試熱身 49去重排序 49蛇形圖案 51數(shù)學(xué)手稿 542009機(jī)試計(jì)算和的數(shù)位Sum of digit Description Write a program which putes the digit number of sum of two integers a and b. Input The first line of input gives the number of cases, N(1 ≤ N ≤ 100). N test cases follow.Each test case consists of two integers a and b which are separeted by a space in a line. (0=a,b=100000000). Output For each test case, print the number of digits of a + b. Sample Input 35 71 991000 999 Sample Output 234 includeint main(){int n。n)!=EOF){while(n){ int an=0。 sum=a+b。}}return 0。int i。a39。z39。}return 0。prime[0]=prime[1]=false。i+=2){prime[i]=true。i+=2){if(prime[i]==true)//是素?cái)?shù){j=i+i。int n。n)。i=n/2。}sum*=2。}求最大公約數(shù)和最小公倍數(shù)GCD and LCM Description Write a program which putes the greatest mon divisor (GCD) and the least mon multiple (LCM) of given a and b (0 a, b ≤ 44000). Input The first line of input gives the number of cases, N(1 ≤ N ≤ 100). N test cases follow.Each test case contains two interger a and b separated by a single space in a line. Output For each test case, print GCD and LCM separated by a single space in a line. Sample Input 28 65000 3000 Sample Output 2 241000 15000 includeint getgcd(int a,int b){int gcd。gcd=t1%t2。}return t2。n)!=EOF){while(n){scanf(%d%d,amp。}}return 0。int num[100010]。int k。i++)scanf(%d,amp。for(i=1。sort(num+1,num+1+n)。}return 0。}E[15010]。Tree[x]=tmp。int m。m)。E[i].a,amp。//排序for(i=1。for(i=1。if(a!=b){Tree[a]=b。}*編譯原理Principles of Compiler Description After learnt the Principles of Compiler,partychen thought that he can solve a simple expression he give you strings of less than 100 characters which strictly adhere to the following grammar (given in EBNF): A:= 39。|39。A}.Can you solve them too? Input The first line of input gives the number of cases, N(1 ≤ N ≤ 100). N test cases follow.The next N lines will each contain a string as described above. Output For each test case,if the expression is adapt to the EBNF above output “Good”,else output “Bad”. Sample Input 3(x)(x+(x+x))()(x) Sample Output GoodGoodBad include cstdioinclude cstringinclude cstdlibinclude vectorinclude cmathinclude iostreaminclude algorithminclude functionalinclude stringinclude mapinclude cctype using namespace std。bool B()。) { index++。 return true。 while(ex[index]==39。amp。 while(ex[index]==39。 } } return false。}bool C(){ while(ex[index]==39。 39。 } return true。 getchar()。amp。 } return 0。N39。int match[MAXN],pre[MAXN],base[MAXN]。 if(match[u]==1)break。 v=pre[match[v]]。 v=pre[v]。 SET(inblossom,0)。 if(base[v]!=anc)pre[v]=u。 if(!inque[i]) { (i)。 i++)pre[i]=1,inque[i]=0,base[i]=i。 while(!()) { int u=()。 v++) { if(g[u][v]amp。match[u]!=v) { if(v==S||(match[v]!=1amp。 if(match[v]!=1)(match[v]),inque[match[v]]=1。 match[u]=v。 } } } } } return false。 i=n。 return ans。 scanf(%d,amp。 scanf(%d,amp。i++) { scanf(%s,tmp+1)。Y39。 } return 0。 represents Excellent, 39。 represents Nice, 39。m possibleAccept More includeincludechar str[20]。while(N){scanf(%s,str)。else if(strcmp(str,U)==0)printf(Ultimate\n)。}return 0。 int t。e,amp。//空瓶數(shù)量 while(empty=c)//空瓶數(shù)量可換 { sum+=empty/c。}統(tǒng)計(jì)字符統(tǒng)計(jì)字符 Description 輸入一行字符,分別統(tǒng)計(jì)其中 英文字母、空格、數(shù)字和其他字符的個(gè)數(shù)。int ,nn,on。//清除上一個(gè)換行符while(t){gets(str)。il。amp。else if(str[i]=39。str[i]=39。amp。)++。printf(others:%d\n,on)。嚴(yán)格的買(mǎi)三送一,買(mǎi)五送二。 Output 輸出ECNU最多能買(mǎi)到的粽子數(shù)量。 int a,b。n)。//輸入錢(qián)數(shù)和粽子單價(jià) zn=a/b。 } if(zn/3!=0) { num+=zn/3。總廠有一條生產(chǎn)線,現(xiàn)在生產(chǎn)流水線上排隊(duì)的零件總數(shù)為M。 int M,K。