av在线观看网站免费,欧美成人aaa片一区国产精品,精品国产乱码久久久久久免费,麻豆果冻传媒2021精品传媒一区,国产精品自在欧美一区

電子文檔交易市場
安卓APP | ios版本
電子文檔交易市場
安卓APP | ios版本

程序設(shè)計(jì)復(fù)習(xí)

51頁
  • 賣家[上傳人]:m****
  • 文檔編號(hào):548919040
  • 上傳時(shí)間:2023-09-22
  • 文檔格式:DOC
  • 文檔大小:304.50KB
  • 下載文檔到電腦,查找使用更方便

    20 金貝

    還剩頁未讀,繼續(xù)閱讀

    / 51 舉報(bào) 版權(quán)申訴 馬上下載
  • 文本預(yù)覽
  • 下載提示
  • 常見問題
    • 1、輸出圖形(本題100分) 22、旋轉(zhuǎn)數(shù)字(本題100分) 33、求和(本題100分) 54、多項(xiàng)式相乘 75、二叉樹 106、二叉樹1 147、哈夫曼樹及編碼(100分) 168、哈夫曼樹、編碼及譯碼(100分) 199、判定連通圖(100分) 2110、Least Time (最短時(shí)間,100分) 2411、取序號(hào)判定素?cái)?shù) 2612、名次與分?jǐn)?shù) 2813、快速排序(100分) 3214、堆排序(100分) 3315、歸并排序(100分) 3516、基數(shù)排序(100分) 3717、表達(dá)式求值 4018、取數(shù)相加 4219、大整數(shù)排序 451、輸出圖形(本題100分)(graph.cpp)【題目描述】 編寫程序打印n行如下圖形,其中1≤n≤26 n=4輸出圖形如下: D DCD DCBCDDCBABCD【輸入】 輸入文件graph.in包含1個(gè)整數(shù)輸出】 輸出文件graph.out輸入輸出樣例1】 graph.in graph.out4 D DCD DCBCDDCBABCD【輸入輸出樣例2】 graph.in graph.out7 G GFG GFEFG GFEDEFG GFEDCDEFG GFEDCBCDEFGGFEDCBABCDEFG【限制】 1≤n≤26#includeusing namespace std;int main(){ freopen("graph.in","r",stdin); freopen("graph.out","w",stdout); int i,j,n; cin>>n; for(j=1;j<=n;j++) { for(i=1;i<=n-j;i++) cout<<" "; for(i=1;i<=j;i++) cout<<(char)('A'+n-i); for(i=1;i<=j-1;i++) cout<<(char)('A'+n+i-j); cout<

      提醒:圖案中沒有數(shù)字的地方用空格填滿,每行最后一個(gè)數(shù)字后面沒有多余的空格輸入】 輸入文件rotation.in包含1個(gè)整數(shù)n輸出】 輸出文件rotation.out是一個(gè)菱形圖形,圖形從第1行的中間開始,數(shù)字分別是n*n, n*n-1,n*n-2,……1,并且順時(shí)針向中間轉(zhuǎn)入輸入輸出樣例1】 例如n=7,輸出: 01 24 02 23 25 03 22 40 26 04 21 39 41 27 05 20 38 48 42 28 0619 37 47 49 43 29 07 18 36 46 44 30 08 17 35 45 31 09 16 34 32 10 15 33 11 14 12 13【限制】 1≤n≤99【提示】 m=4 i=15;.printf("%0*d", m, i);  //這里用*表示系數(shù)待定,m即為指定的寬度//上面語句輸出“0015”,數(shù)據(jù)寬度為4,不足4位,前補(bǔ)0printf("%*c", m, ‘ ‘); //左邊語句輸出“ ”,即輸出4個(gè)空格#include "stdio.h"const int N0=2*100-1+10;int a[N0][N0]={ 0 };struct node{ int row,col;}dir[4]={ {1,1},{1,-1},{-1,-1},{-1,1} };int main(){ int i,j,n; int row,col,row1, col1,d,m=0; freopen("rotation.in", "r", stdin); freopen("rotation.out","w", stdout); scanf("%d", &n); row=1; col=n; d=0; int t=n*n; while( t!=0 ) { m++; t/=10; } for( i=1; i<=n*n; i++) { a[row][col]=i; row1=row+dir[d].row; col1=col+dir[d].col; if( row1<1 || col1<1 || row1>2*n-1 || col1>2*n-1 || a[row1][col1]!=0 ) { d=(d+1)%4; row1=row+dir[d].row; col1=col+dir[d].col; } row=row1; col=col1; } for( i=1; i<=2*n-1; i++) { for( j=1; j<=2*n-1; j++ ) if( a[i][j]!=0 ) printf("%0*d", m, a[i][j]); else if( i<=n && jn && j<3*n-i) printf("%*c", m, ' '); printf("\n"); } return 0;}3、求和(本題100分)(total.cpp)【問題描述】有1個(gè)n×n的矩陣,從左上到右下稱為主斜線(傾角135o),從右上到左下稱為次斜線(傾角45o),在主斜線上最大,次斜線上最小的元素稱為該矩陣的斜線鞍點(diǎn),求出該矩陣所有斜線鞍點(diǎn)的和。

      如5×5的矩陣: 3 2 5 98 10 44 12 1 12 8 67 61 45 7 19 12 21 33 56 3 35 36 78 90 19 次斜線 主斜線元素7為上面矩陣的一個(gè)斜線鞍點(diǎn), 元素10和19也是上面矩陣的斜線鞍點(diǎn)輸入】輸入文件total.in第一行是一個(gè)整數(shù)n((1≤n≤100)),接下去是n行×n列的矩陣,矩陣的每個(gè)元素都是整數(shù)輸出】輸出文件total.out也只有1個(gè)整數(shù),即該矩陣所有斜線鞍點(diǎn)的和(0≤和≤1010)輸入輸出樣例1】total.intotal.out53 2 5 98 1044 12 1 12 8 67 61 45 7 1912 21 33 56 335 36 78 90 1936【輸入輸出樣例2】total.intotal.out41 2 17 1310 15 16 918 8 19 511 7 9 100#include#define NO 100int main(){ freopen("total.in","r",stdin); freopen("total.out","w",stdout); int i,j,x,y,max,min,n=0,sum=0; scanf("%d",&n); int**a=new int*[n]; i=-1; while(++i0&&y>0){x--;y--;} while(xa[i][j]) { max=0; break; } x++;y++; } x=i,y=j; while(x>0&&y=0) { if(a[x][y]

      多項(xiàng)式的輸入輸出格式為:系數(shù)在前,指數(shù)在后,各項(xiàng)按指數(shù)遞增排列,每個(gè)多項(xiàng)式輸入時(shí)以兩個(gè)0結(jié)束系數(shù)為0的項(xiàng)不輸出例如:1+4X3-9X5輸入格式為:1 0 0 1 0 2 4 3 0 4 -9 5 0 0或者 1 0 4 3 -9 5 0 0,其輸出只能是:1 0 4 3 -9 5【輸入】 輸入文件conv.in每行為一個(gè)多項(xiàng)式,多項(xiàng)式輸入時(shí)以兩個(gè)0結(jié)束數(shù)據(jù)為若干行的多項(xiàng)式,例如:1 0 1 1 0 01 0 -1 1 0 01 0 1 2 0 0表示 (1+x)(1-x)(1+x2)【輸出】 輸出文件conv.out包含1行,為上述多項(xiàng)式相乘結(jié)果上例的輸出為:1 0 -1 4表示1-x4【輸入輸出樣例1】 conv.in conv.out1 0 1 1 0 01 0 -1 1 0 01 0 1 2 0 01 0 -1 4【數(shù)據(jù)限制】所有系數(shù)、指數(shù)均為整數(shù)(int類型)#include "stdio.h"typedef struct node{ int c,e; struct node *next;}ND;ND *createLink(){ ND *head, *p; head=p=new ND; int c,e; while( true ) { if( scanf("%d%d", &c, &e)!=2 ) break; if( c==0 && e==0 ) break; 。

      點(diǎn)擊閱讀更多內(nèi)容
    關(guān)于金鋤頭網(wǎng) - 版權(quán)申訴 - 免責(zé)聲明 - 誠邀英才 - 聯(lián)系我們
    手機(jī)版 | 川公網(wǎng)安備 51140202000112號(hào) | 經(jīng)營許可證(蜀ICP備13022795號(hào))
    ?2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.