We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
標簽: represented integers group items
上傳時間: 2016-01-17
上傳用戶:jeffery
The XML Toolbox converts MATLAB data types (such as double, char, struct, complex, sparse, logical) of any level of nesting to XML format and vice versa. For example, >> project.name = MyProject >> project.id = 1234 >> project.param.a = 3.1415 >> project.param.b = 42 becomes with str=xml_format(project, off ) "<project> <name>MyProject</name> <id>1234</id> <param> <a>3.1415</a> <b>42</b> </param> </project>" On the other hand, if an XML string XStr is given, this can be converted easily to a MATLAB data type or structure V with the command V=xml_parse(XStr).
標簽: converts Toolbox complex logical
上傳時間: 2016-02-12
上傳用戶:a673761058
shc是一個加密shell腳本的工具.它的作用是把shell腳本轉換為一個可執行的二進制文件. 用shell腳本對系統進行自動化維護,簡單,便捷而且可移植性好. 但shell腳本是可讀寫的,很有可能會泄露敏感信息,如用戶名,密碼,路徑,IP等. 同樣,在shell腳本運行時會也泄露敏感信息. shc是一個加密shell腳本的工具.它的作用是把shell腳本轉換為一個可執行的二進制文件. 這就很好的解決了上述問題. tar zxvf shc-3.8.tgz cd shc-3.8 make test make make test make strings make install 這一步需要root權限 使用方法: shc -r -f script-name 注意:要有-r選項, -f 后跟要加密的腳本名. 運行后會生成兩個文件,script-name.x 和 script-name.x.c script-name.x是加密后的可執行的二進制文件. ./script-name 即可運行. script-name.x.c是生成script-name.x的原文件(c語言)
上傳時間: 2013-12-21
上傳用戶:wfeel
很完整的51串口程序 包括如下: 串口中斷服務程序,僅需做簡單調用即可完成串口輸入輸出的處理 出入均設有緩沖區,大小可任意設置。 可供使用的函數名: char getbyte(void) 從接收緩沖區取一個byte,如不想等待則在調用前檢測inbufsign是否為1。 getline(char idata *line, unsigned char n) 獲取一行數據回車結束,必須定義最大輸入字符數 putbyte(char c) 放入一個字節到發送緩沖區 putbytes(unsigned char *outplace,j) 放一串數據到發送緩沖區,自定義長度 putstring(unsigned char code *puts) 發送一個定義在程序存儲區的字符串到串口 puthex(unsigned char c) 發送一個字節的hex碼,分成兩個字節發。 putchar(uchar c,uchar j) 輸出一個無符號字符數的十進制表示,必須標示小數點的位置,自動刪除前面無用的零 putint(uint ui,uchar j) 輸出一個無符號整型數的十進制表示,必須標示小數點的位置,自動刪除前面無用的零 delay(unsigned char d) 延時n x 100ns putinbuf(uchar c) 人工輸入一個字符到輸入緩沖區 CR 發送一個回車換行
上傳時間: 2016-06-13
上傳用戶:epson850
設計一個復雜的計算器,能實現Window中計算器的功能,如下圖: ⑴定義組件:0~9,+、-、*、/、sqrt()、1/x、%、C=按鈕;顯示屏文本行;菜單; ⑵要求能關閉窗口;點擊按鈕,或鍵盤數字會在顯示屏上輸出結果。 ⑶具有進制轉換功能;
標簽: 計算器
上傳時間: 2014-01-08
上傳用戶:英雄
【問題描述】 在一個N*N的點陣中,如N=4,你現在站在(1,1),出口在(4,4)。你可以通過上、下、左、右四種移動方法,在迷宮內行走,但是同一個位置不可以訪問兩次,亦不可以越界。表格最上面的一行加黑數字A[1..4]分別表示迷宮第I列中需要訪問并僅可以訪問的格子數。右邊一行加下劃線數字B[1..4]則表示迷宮第I行需要訪問并僅可以訪問的格子數。如圖中帶括號紅色數字就是一條符合條件的路線。 給定N,A[1..N] B[1..N]。輸出一條符合條件的路線,若無解,輸出NO ANSWER。(使用U,D,L,R分別表示上、下、左、右。) 2 2 1 2 (4,4) 1 (2,3) (3,3) (4,3) 3 (1,2) (2,2) 2 (1,1) 1 【輸入格式】 第一行是數m (n < 6 )。第二行有n個數,表示a[1]..a[n]。第三行有n個數,表示b[1]..b[n]。 【輸出格式】 僅有一行。若有解則輸出一條可行路線,否則輸出“NO ANSWER”。
標簽: 點陣
上傳時間: 2014-06-21
上傳用戶:llandlu
實驗源代碼 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("請輸入矩陣第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可傳遞閉包關系矩陣是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元關系的可傳遞閉包\n"); void warshall(int,int); int k , n; printf("請輸入矩陣的行數 i: "); scanf("%d",&k); 四川大學實驗報告 printf("請輸入矩陣的列數 j: "); scanf("%d",&n); warshall(k,n); }
上傳時間: 2016-06-27
上傳用戶:梁雪文以
含t h r e a d x,u c o s 的b s p
標簽:
上傳時間: 2015-06-29
上傳用戶:xfbs821
追趕法解周期性方程 輸入:a[],b[],c[],x[] 輸出:求解結果X在x[]中
上傳時間: 2015-10-14
上傳用戶:thuyenvinh
一、 一元三次回歸方程 CubicMultinomialRegress.cs 方程模型為Y=a*X(3)+b*X(2)+c*X(1)+d public override double[] buildFormula() 得到系數數組,存放順序與模型系數相反,即該數組中系數的值依次是d,c,b,a。 以后所述所有模型的系數存放均與此相同(多元線性回歸方程除外)。 public override double forecast(double x) 預測函數,根據模型得到預測結果 public override double computeR2() 計算相關系數(決定系數),系數越接近1,數據越滿足該模型。
標簽: CubicMultinomialRegress override public double
上傳時間: 2015-11-25
上傳用戶:13215175592