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 |
为什么一直Compile Error 求大神指点Main.cpp F:\temp\13239684.78121\Main.cpp(69) : error C2668: 'pow' : ambiguous call to overloaded function math.h(575): could be 'long double pow(long double,int)' math.h(527): or 'float pow(float,int)' math.h(489): or 'double pow(double,int)' while trying to match the argument list '(int, int)' #include<cstring> #include<cmath> #include<algorithm> #include<iostream> #include<cstdio> using namespace std; int change() { int sum , i, j, n, m, lun; char a[20], b[20]; memset(a, 0, sizeof(a)); memset(b, 0, sizeof(b)); gets(a); n = strlen(a); for(i = 0, j = 0; i < n; i++) //把里面的字母转换成数字存入字符数组中 { if(a[i]=='A'||a[i]=='B'||a[i]=='C'||a[i]=='2') { b[j]='2'; j++; } else if(a[i]=='D'||a[i]=='E'||a[i]=='F'||a[i]=='3') { b[j]='3'; j++; } else if(a[i]=='G'||a[i]=='H'||a[i]=='I'||a[i]=='4') { b[j]='4'; j++; } else if(a[i]=='J'||a[i]=='K'||a[i]=='L'||a[i]=='5') { b[j]='5'; j++; } else if(a[i]=='M'||a[i]=='N'||a[i]=='O'||a[i]=='6') { b[j]='6'; j++; } else if(a[i]=='P'||a[i]=='R'||a[i]=='S'||a[i]=='7') { b[j]='7'; j++; } else if(a[i]=='T'||a[i]=='U'||a[i]=='V'||a[i]=='8') { b[j]='8'; j++; } else if(a[i]=='W'||a[i]=='X'||a[i]=='Y'||a[i]=='9') { b[j]='9'; j++; } else if(a[i]=='0'||a[i]=='1') { b[j]=a[i]; j++; } } n = strlen(b); sum=0; m=n; for(j = 0; j < m; j++) //把字符数组转换成一个整数 存入 num中 { lun=pow(10,n); sum = sum + ((int)b[j]-48)*lun; n--; } sum=sum/10; return sum; //把整数当做返回值返回到主函数中 } int main() { long long num; int i, j, count, digel[100010], st[1000], en[1000]; char w; while(scanf("%lld",&num)!=EOF) { w=getchar(); memset(digel, 0, sizeof(digel)); memset(st, 100001, sizeof(st)); memset(en, 0, sizeof(en)); for(i = 0; i < num; i++) digel[i]=change(); sort(digel, digel+num); //对digel函数进行排序 j=0; for(i = 0; i < num; i++) { if(digel[i]==digel[i+1]) { st[j]=i; for( i=i; digel[i] == digel[i+1]; i++) en[j] = i + 1; j++; } } //对重复的进行标记 j=0; for(i = 0; i < num; i++) //结果的输出 { if(st[j]==i) { printf("%d-%d %d\n",digel[i]/10000, digel[i]%10000,en[j]-st[j]+1); i=en[j]; j++; } } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator