Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:大佬们帮忙看一下为什么编译错误,我在我的编译器上编译没问题In Reply To:大佬们帮忙看一下为什么编译错误,我在我的编译器上编译没问题 Posted by:TIX1922451756 at 2017-12-01 01:24:56 > #include<stdio.h> > #include<string.h> > #include<stdlib.h> > #include<math.h> > #define swap(a,b){a=a+b;b=a-b;a=a-b;} > > int CheckAndReturnNum(char *s); > int main(void) { > int n,i,j,q,count=0,*data; > scanf("%d", &n); > data = (int *)malloc(n*sizeof(int)); > char s[30]; > > for (i = 0; i <n; i++) > { > scanf("%s",s); > data[i]=CheckAndReturnNum(s); > } > //printf("%03d-%04d %d\n", data[i] / 10000, data[i] % 10000); > for (i = 0; i < n; i++) { > for (j = i + 1; j < n; j++) > { > if (data[i] > data[j]) > swap(data[i], data[j]); > } > } > for ( i = 0; i < n; i++) > { > count = 1; > while (data[i]==data[i+1]) > { > i++; > count++; > } > if (count > 1) > printf("%03d-%04d %d\n", data[i] / 10000, data[i] % 10000, count); > } > free(data); > return 0; > } > int CheckAndReturnNum(char *s) { > int i, sum = 0,m=0; > for (i = strlen(s) - 1; i >= 0; i--) > { > if (s[i] >= '0'&&*(s + i) <= '9' || *(s + i) >= 'A'&&*(s + i) <= 'Z') { > if (s[i] >= '0'&&*(s + i) <= '9') > { > sum += (s[i] - '0') * pow(10, m); > > } > if (*(s + i) >= 'A'&&*(s + i) < 'Z'&&*(s+i)!='Q') > { > if (s[i] > 'Q') > sum += ((s[i] - 'A' - 1) / 3 + 2)*pow(10, m); > else > sum += ((s[i] - 'A') / 3 + 2)*pow(10,m); > > } > m++; > } > } > return sum; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator