本文目錄一覽:
藍橋杯c語言b組什麼水平
藍橋杯c語言b組中等水平。根據查詢相關資料顯示,藍橋杯分為ABC三個組別,分別是A:985、211B:本科C:專科,這樣分級的好處是,獲獎比較容易,採取的是OI賽制,即賽後才能知道結果。
藍橋杯C語言題目
#includestdio.h
int main(){
char code[]={‘Z’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’U’,’V’,’W’,’X’,’Y’};
char num[10];
int sgln=0,sang,yu,len=0;
sang=2019/26;
yu=2019%26;
num[len]=code[yu];
len++;
while(sang!=0){
if(sang!=0yu==0)
yu=(sang-1)%26;
else
yu=sang%26;
sang=sang/26;
num[len]=code[yu];
len++;
}
len–;
for(;len=0;len–){
printf(“%c”,num[len]);
}
}
求2013藍橋杯C語言本科組B的第七題錯誤票據的程序答案
樓上的網友說的很簡單,實際上因為每一行不確定到底要放多少個數,很難計算。
我是一個字符一個字符輸入的,如果是數字就儲存,如果遇到\0就進行atoi(),如果遇到\n就結束
最後用判斷\n是否與輸入相等。
思路很簡單,實現很複雜。。
考試的時候這道題我也沒做出來。。
現在運行成功。
#includestdio.h
#includestdlib.h
const int N=10000;
int mysort(const void *a,const void*b)
{
return *(int*)a-*(int*)b;
}
int main()
{
int count=0;
int n,i=0,j=0,k=0;
int a[N];
char ch[7];
scanf(“%d\n”,n);
for(count=0;countn;)
{
scanf(“%c”,ch[j]);
if(ch[j]=’9’ch[j]=’0′)
j++;
else if(ch[j]==’ ‘)
{
a[k++]=atoi(ch);
j=0;
}
else if(ch[j]==’\n’)
{
count++;
a[k++]=atoi(ch);
j=0;
}
}
k–;
qsort(a,k,sizeof(int),mysort);
i=a[0];
for(j=1;jk;j++)
{
if(a[j]==i||a[j]==i+2)
printf(“%d”,a[j]);
i=a[j];
}
return 0;
}
原創文章,作者:OVKT,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/139003.html