-
某市進(jìn)行了一次英語競賽,一共有N個(gè)人報(bào)名參加(N<1000000),按照報(bào)名順序分別是1號~N號。英語競賽的得分范圍是0~100分,可能會有0.5分存在。現(xiàn)在給你N的值和按照號碼排列的得分,要求輸出第一名的號碼。若是有并列第一名則需要同屬輸出多個(gè)第一名的號碼。
標(biāo)簽:
C語言代碼
上傳時(shí)間:
2016-03-29
上傳用戶:我是鑫鑫
-
輸入N*N(N<100)的矩陣,輸出它的轉(zhuǎn)置矩陣。
第一行為整數(shù)N。
接著是一個(gè)N*N的矩陣
標(biāo)簽:
矩陣轉(zhuǎn)置
上傳時(shí)間:
2016-03-29
上傳用戶:我是鑫鑫
-
簡單命令使用grep等的使用
[zorro@isch ~]$ history
1 ifconfig
2 su
3 exit
4 ls
5 cd Desktop/
6 ls
7 tar zxcf VMwareTools-8.4.5-324285.tar.gz
8 tar zxvf VMwareTools-8.4.5-324285.tar.gz
9 cd vmware-tools-distrib/
10 ls
11 ./vmware-install.pl
12 su
13 ls
14 cd ..
15 ls
16 rm VMwareTools-8.4.5-324285.tar.gz
17 rm -r vmware-tools-distrib
18 ls
19 make
20 ls
21 cd redis/
22 quit
23 ls
24 ca redis/
25 cd redis/
26 cd redis-2.8.17
27 make
28 cd redis-2.8.17
29 ls
30 cd redis-2.8.17
31 cd str
32 cd src
33 ls
34 ./redis-cli
35 ls
36 cd redis-2.8.17 tar.gz
37 make
38 cd src
39 ./redis-server .. /redis.conf
40 ./redis-cli
41 ./redis-server ../redis.conf
42 vi test1.sh
43 ./test1.sh
44 vi test.sh
45 ./test.sh
46 ls
47 chmod 777 test.sh
48 ./test.sh
49 vi express
50 $ grep –n ‘the’ express
51 clear
52 grep -n 'the' express
53 vi express
54 grep -n 'the' express
55 grep -vn 'the'express
56 grep -vn 'the' express
57 grep -in 'the' express
58 vi test2.c
59 grep -l 'the' *.c
60 grep -n 't[ae]st' express
61 grep -n 'oo' express
62 grep -n '[^g]oo' express
63 grep -n '[a^z]oo' express
64 grep -n '[0^9]' express
65 grep -n '^the' express
66 vi express
67 sed -e 'd' express
68 sed -e '1d' express
69 sed -e '1~7d' express
70 sed -e '$d' express
71 sed -e '1,/^$/d' express
72 ls
73 cd
74 pwd
75 history
[zorro@isch ~]$
標(biāo)簽:
簡單命令使用
上傳時(shí)間:
2016-05-24
上傳用戶:12345678gan
-
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NULL 0
#define MaxSize 30
typedef struct athletestruct /*運(yùn)動員*/
{
char name[20];
int score; /*分?jǐn)?shù)*/
int range; /**/
int item; /*項(xiàng)目*/
}ATH;
typedef struct schoolstruct /*學(xué)校*/
{
int count; /*編號*/
int serial; /**/
int menscore; /*男選手分?jǐn)?shù)*/
int womenscore; /*女選手分?jǐn)?shù)*/
int totalscore; /*總分*/
ATH athlete[MaxSize]; /**/
struct schoolstruct *next;
}SCH;
int nsc,msp,wsp;
int ntsp;
int i,j;
int overgame;
int serial,range;
int n;
SCH *head,*pfirst,*psecond;
int *phead=NULL,*pafirst=NULL,*pasecond=NULL;
void create();
void input ()
{
char answer;
head = (SCH *)malloc(sizeof(SCH)); /**/
head->next = NULL;
pfirst = head;
answer = 'y';
while ( answer == 'y' )
{
Is_Game_DoMain:
printf("\nGET Top 5 when odd\nGET Top 3 when even");
printf("\n輸入運(yùn)動項(xiàng)目序號 (x<=%d):",ntsp);
scanf("%d",pafirst);
overgame = *pafirst;
if ( pafirst != phead )
{
for ( pasecond = phead ; pasecond < pafirst ; pasecond ++ )
{
if ( overgame == *pasecond )
{
printf("\n這個(gè)項(xiàng)目已經(jīng)存在請選擇其他的數(shù)字\n");
goto Is_Game_DoMain;
}
}
}
pafirst = pafirst + 1;
if ( overgame > ntsp )
{
printf("\n項(xiàng)目不存在");
printf("\n請重新輸入");
goto Is_Game_DoMain;
}
switch ( overgame%2 )
{
case 0: n = 3;break;
case 1: n = 5;break;
}
for ( i = 1 ; i <= n ; i++ )
{
Is_Serial_DoMain:
printf("\n輸入序號 of the NO.%d (0<x<=%d): ",i,nsc);
scanf("%d",&serial);
if ( serial > nsc )
{
printf("\n超過學(xué)校數(shù)目,請重新輸入");
goto Is_Serial_DoMain;
}
if ( head->next == NULL )
{
create();
}
psecond = head->next ;
while ( psecond != NULL )
{
if ( psecond->serial == serial )
{
pfirst = psecond;
pfirst->count = pfirst->count + 1;
goto Store_Data;
}
else
{
psecond = psecond->next;
}
}
create();
Store_Data:
pfirst->athlete[pfirst->count].item = overgame;
pfirst->athlete[pfirst->count].range = i;
pfirst->serial = serial;
printf("Input name:) : ");
scanf("%s",pfirst->athlete[pfirst->count].name);
}
printf("\n繼續(xù)輸入運(yùn)動項(xiàng)目(y&n)?");
answer = getchar();
printf("\n");
}
}
void calculate() /**/
{
pfirst = head->next;
while ( pfirst->next != NULL )
{
for (i=1;i<=pfirst->count;i++)
{
if ( pfirst->athlete[i].item % 2 == 0 )
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 5;break;
case 2:pfirst->athlete[i].score = 3;break;
case 3:pfirst->athlete[i].score = 2;break;
}
}
else
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 7;break;
case 2:pfirst->athlete[i].score = 5;break;
case 3:pfirst->athlete[i].score = 3;break;
case 4:pfirst->athlete[i].score = 2;break;
case 5:pfirst->athlete[i].score = 1;break;
}
}
if ( pfirst->athlete[i].item <=msp )
{
pfirst->menscore = pfirst->menscore + pfirst->athlete[i].score;
}
else
{
pfirst->womenscore = pfirst->womenscore + pfirst->athlete[i].score;
}
}
pfirst->totalscore = pfirst->menscore + pfirst->womenscore;
pfirst = pfirst->next;
}
}
void output()
{
pfirst = head->next;
psecond = head->next;
while ( pfirst->next != NULL )
{
// clrscr();
printf("\n第%d號學(xué)校的結(jié)果成績:",pfirst->serial);
printf("\n\n項(xiàng)目的數(shù)目\t學(xué)校的名字\t分?jǐn)?shù)");
for (i=1;i<=ntsp;i++)
{
for (j=1;j<=pfirst->count;j++)
{
if ( pfirst->athlete[j].item == i )
{
printf("\n %d\t\t\t\t\t\t%s\n %d",i,pfirst->athlete[j].name,pfirst->athlete[j].score);break;
}
}
}
printf("\n\n\n\t\t\t\t\t\t按任意建 進(jìn)入下一頁");
getchar();
pfirst = pfirst->next;
}
// clrscr();
printf("\n運(yùn)動會結(jié)果:\n\n學(xué)校編號\t男運(yùn)動員成績\t女運(yùn)動員成績\t總分");
pfirst = head->next;
while ( pfirst->next != NULL )
{
printf("\n %d\t\t %d\t\t %d\t\t %d",pfirst->serial,pfirst->menscore,pfirst->womenscore,pfirst->totalscore);
pfirst = pfirst->next;
}
printf("\n\n\n\t\t\t\t\t\t\t按任意建結(jié)束");
getchar();
}
void create()
{
pfirst = (struct schoolstruct *)malloc(sizeof(struct schoolstruct));
pfirst->next = head->next ;
head->next = pfirst ;
pfirst->count = 1;
pfirst->menscore = 0;
pfirst->womenscore = 0;
pfirst->totalscore = 0;
}
void Save()
{FILE *fp;
if((fp = fopen("school.dat","wb"))==NULL)
{printf("can't open school.dat\n");
fclose(fp);
return;
}
fwrite(pfirst,sizeof(SCH),10,fp);
fclose(fp);
printf("文件已經(jīng)成功保存\n");
}
void main()
{
system("cls");
printf("\n\t\t\t 運(yùn)動會分?jǐn)?shù)統(tǒng)計(jì)\n");
printf("輸入學(xué)校數(shù)目 (x>= 5):");
scanf("%d",&nsc);
printf("輸入男選手的項(xiàng)目(x<=20):");
scanf("%d",&msp);
printf("輸入女選手項(xiàng)目(<=20):");
scanf("%d",&wsp);
ntsp = msp + wsp;
phead = (int *)calloc(ntsp,sizeof(int));
pafirst = phead;
pasecond = phead;
input();
calculate();
output();
Save();
}
標(biāo)簽:
源代碼
上傳時(shí)間:
2016-12-28
上傳用戶:150501
-
#include <iostream.h>
#include <string.h>
#include <iomanip.h>
#include "Stud.h"
Stud::Stud(){}
char *Stud::getno() //獲取學(xué)號
{
return no;
}
char *Stud::getname() //獲取姓名
{
return name;
}
char *Stud::getsex() //獲取性別
{
return sex;
}
char *Stud::getminzu() //獲取民族
{
return minzu;
}
char *Stud::getaddress() //獲取出生地
{
return address;
}
char *Stud::getbirth() //獲取出生年月
{
return birth;
}
int Stud::gettag() //獲取姓名
{
return tag;
}
void Stud::changeno(char n[]) //設(shè)置學(xué)號
{
strcpy(no,n);
}
void Stud::changename(char na[]) //設(shè)置姓名
{
strcpy(name,na);
}
void Stud::changesex(char s[]) //設(shè)置性別
{
strcpy(sex,s);
}
void Stud::changeminzu(char m[]) //設(shè)置民族
{
strcpy(minzu,m);
}
void Stud::changeaddress(char a[]) //設(shè)置出生地
{
strcpy(address,a);
}
void Stud::changebirth(char b[]) //設(shè)置出生年月
{
strcpy(birth,b);
}
void Stud::addstudent(char *rn,char *rna) //增加學(xué)生
{
strcpy(no,rn);
strcpy(name,rna);
}
void Stud::addstudent(char *rn,char *rna,char *rs,char *rm,char *ra,char *rb) //增加學(xué)生
{
tag=0;
strcpy(no,rn);
strcpy(name,rna);
strcpy(sex,rs);
strcpy(minzu,rm);
strcpy(address,ra);
strcpy(birth,rb);
}
void Stud::delstud() //設(shè)置刪除標(biāo)記
{
tag=1;
}
void Stud::disp() //輸出學(xué)生信息
{
cout<<setw(15)<<no<<setw(10)<<name<<setw(10)<<sex<<setw(10)<<minzu<<setw(10)<<address<<setw(10)<<birth<<endl;
}
void Stud::display() //輸出學(xué)生信息
{
cout<<setw(15)<<no<<setw(10)<<name;
}
標(biāo)簽:
學(xué)生
上傳時(shí)間:
2016-12-29
上傳用戶:767483511
-
module M_GAUSS
!高斯列主元消去法模塊
contains
subroutine LINEQ(A,B,X,N)
!高斯列主元消去法
implicit real*8(A-Z)
integer::I,K,N
integer::ID_MAX !主元素標(biāo)號
real*8::A(N,N),B(N),X(N)
real*8::AUP(N,N),BUP(N)
!A,B為增廣矩陣
real*8::AB(N,N+1)
real*8::VTEMP1(N+1),VTEMP2(N+1)
AB(1:N,1:N)=A
AB(:,N+1)=B
標(biāo)簽:
fortan
Newton
程序
數(shù)值分析
方程
非線性
上傳時(shí)間:
2018-06-15
上傳用戶:answer123
-
:消落帶土壤由于在水陸交替的特殊生境和復(fù)雜的地球化學(xué)共同作用下形成,具有獨(dú)特的理化性質(zhì)和生態(tài)功能。各營養(yǎng)鹽
含量在時(shí)間和空間上具有較高的變異性,土壤中有機(jī)質(zhì)的分布及遷移和轉(zhuǎn)化均受到復(fù)雜的影響。針對官廳水庫流域上游媯水
河段消落帶,選擇典型消落帶落水區(qū),對該區(qū)土壤有機(jī)質(zhì)含量的時(shí)空分布特征進(jìn)行研究。結(jié)果表明:1)研究區(qū)消落帶土壤有機(jī)
質(zhì)含量較為貧瘠,變化范圍在1.64—26∥蠅之間,平均值僅為13.169/kg,變異系數(shù)達(dá)50.59%。說明消落帶由于季節(jié)性干濕交
替的特殊水文條件的影響,土壤養(yǎng)分的分布具有較高的空間異質(zhì)性。淹水頻繁區(qū)有機(jī)質(zhì)含量平均值為15.74∥婦,高于長期出
露區(qū)的10.12∥k,且變異系數(shù)為41.38%,小于長期出露區(qū)的54.98%。說明淹水頻繁區(qū)對土壤養(yǎng)分的持留能力更強(qiáng),且周期性
的淹水條件使得研究區(qū)近岸具有相似的生境類型,不同采樣點(diǎn)土壤有機(jī)質(zhì)含量的差異相對較小。2)不同植物群落下.蘆葦和
香蒲群落土壤有機(jī)質(zhì)含量最高,平均值為17.089/kg;含量最低的是以小葉楊和白羊草為主的中旱生植物帶,平均值為9.12,∥
kg;其次是酸模葉蓼、大刺兒菜為優(yōu)勢物種的濕生植物帶,土壤有機(jī)質(zhì)含量平均值為15.499/kg。3)不同土壤層次有機(jī)質(zhì)含量差
異較大,總體變化趨勢均由表層向下逐漸減少,各層之間體現(xiàn)出顯著差異性(P<0.05)。研究區(qū)土壤C/N變化范圍在1.64—
18.95,平均值為8.95。說明研究區(qū)土壤碳氮比相對較低,有機(jī)質(zhì)的腐殖化程度較高,且長期出露區(qū)土壤有機(jī)質(zhì)更容易發(fā)生分
解,C的累積速度遠(yuǎn)小于N。土壤C/N垂直分布大致呈先增大后減小趨勢,在30cm處達(dá)到最大值,而后隨著土壤深度的增加逐
漸減小。4)消落帶土壤有機(jī)質(zhì)分布的影響因素分析中,土壤有機(jī)質(zhì)與全磷呈極顯著正相關(guān),相關(guān)系數(shù)為0.62(P<0.01):與土壤
全氮和C/N呈顯著正相關(guān)(R=0.57,O.60;P<0.05)。這說明研究區(qū)土壤全磷、全氮、C/N和有機(jī)質(zhì)明顯具有相同的變化趨勢.和
有機(jī)質(zhì)存在相互影響。其次,土壤有機(jī)質(zhì)和濕度在呈顯著負(fù)相關(guān)(R=一O.51;P<0.05),表明研究區(qū)土壤濕度對有機(jī)質(zhì)含量具有
顯著的影響。氣候因子中,溫度對研究區(qū)土壤有機(jī)質(zhì)的分布具有顯著的影響,相關(guān)系數(shù)為一0.51(P<0.05)。植被因子中.植被
覆蓋度和土壤有機(jī)質(zhì)含量呈顯著正相關(guān),相關(guān)系數(shù)為0.64,表明植被因子也是影響土壤有機(jī)質(zhì)分布的重要因素之一。
標(biāo)簽:
水庫
分布
特征
上傳時(shí)間:
2018-08-13
上傳用戶:閩外莯莯
-
% Computation of ST-ZCR and STE of a speech signal.
%
% Functions required: zerocross, sgn, winconv.
%
% Author: Nabin Sharma
% Date: 2009/03/15
[x,Fs] = wavread('so.wav'); % word is: so
x = x.';
N = length(x); % signal length
n = 0:N-1;
ts = n*(1/Fs); % time for signal
% define the window
wintype = 'rectwin';
winlen = 201;
winamp = [0.5,1]*(1/winlen);
標(biāo)簽:
短時(shí)過零率和短時(shí)能量
上傳時(shí)間:
2019-09-23
上傳用戶:minwenji
-
# include<stdio.h>
# include<math.h>
# define N 3
main(){
float NF2(float *x,float *y);
float A[N][N]={{10,-1,-2},{-1,10,-2},{-1,-1,5}};
float b[N]={7.2,8.3,4.2},sum=0;
float x[N]= {0,0,0},y[N]={0},x0[N]={};
int i,j,n=0;
for(i=0;i<N;i++)
{
x[i]=x0[i];
}
for(n=0;;n++){
//計(jì)算下一個(gè)值
for(i=0;i<N;i++){
sum=0;
for(j=0;j<N;j++){
if(j!=i){
sum=sum+A[i][j]*x[j];
}
}
y[i]=(1/A[i][i])*(b[i]-sum);
//sum=0;
}
//判斷誤差大小
if(NF2(x,y)>0.01){
for(i=0;i<N;i++){
x[i]=y[i];
}
}
else
break;
}
printf("經(jīng)過%d次雅可比迭代解出方程組的解:\n",n+1);
for(i=0;i<N;i++){
printf("%f ",y[i]);
}
}
//求兩個(gè)向量差的二范數(shù)函數(shù)
float NF2(float *x,float *y){
int i;
float z,sum1=0;
for(i=0;i<N;i++){
sum1=sum1+pow(y[i]-x[i],2);
}
z=sqrt(sum1);
return z;
}
標(biāo)簽:
C語言
編寫
迭代
上傳時(shí)間:
2019-10-13
上傳用戶:大萌萌撒
-
已知一個(gè)整數(shù)序列A=(a0,a1,…,an-1),其中0≤ai<n(0≤i<n)。若存在ap1=ap2=…=apm=x且m>n/2(0≤pk<n,1≤k≤m),則稱x為A的主元素。例如A= ( 0,5,5,3,5,7,5,5 ),則5為主元素;又如A= ( 0,5,5,3,5,1,5,7 ),則A中沒有主元素。
假設(shè)A中的n個(gè)元素保存在一個(gè)一維數(shù)組中,請?jiān)O(shè)計(jì)一個(gè)盡可能高效的算法,找出A的主元素。若存在主元素,則輸出該元素;否則輸出-1。
標(biāo)簽:
元素
ap1
ap2
apm
an
整數(shù)
序列
上傳時(shí)間:
2020-03-04
上傳用戶:霖1234