| ||||||||||
| 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:纪念100题,pku的pow函数第一个参数必须为double或者float型,不能为int,又粗心贡献了一次WA,汗~In Reply To:纪念100题,pku的pow函数第一个参数必须为double或者float型,不能为int,又粗心贡献了一次WA,汗~ Posted by:zxzhangxin at 2009-04-21 20:44:03 > #include<stdio.h>
> #include<math.h>
> #include<memory.h>
> int main()
> {
> int n;
> char str[50];
> int a[4];
> int i,j,k,temp;
> scanf("%d",&n);
> getchar();
> while(n--){
> gets(str);
> memset(a,0,sizeof(a));
> j = 0;
> for(i=0;i<32;i++){
> temp = str[i] - '0';
> k = 7 - i%8;
> a[j] += temp * (int)pow(2.0,k);
> if(i%8==7)
> j++;
> }
> printf("%d.%d.%d.%d\n",a[0],a[1],a[2],a[3]);
> }
> return 0 ;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator