2014年重庆市非计算机专业计算机等级考试上机第四批的答案
第一题
#include
#include
main()
{ int num[26],i;
char c;
for (i=0;i<26;i++) num[i]=0;
while ((c=getchar())!=' ')
if (isupper(c)) num[c-65]+=1;
for (i=0;i<26;i++)
if (num[i]) printf("%c:%d\n",i+65,num[i]);
}
第二题
第一个答案:long fun(long x);
第二个答案:fun(n)
第三个答案:fun(x-1) + x*x;
第三题:
1、n=3*A*1000+4*100+B*10+5 改为n=3*10000+A*1000+4*100+B*10+5
2、if(n\178<193) 改为if(n/178<193)
3、continue 改为break