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 |
为什么一直w呢,大牛帮忙一下;#include<stdio.h> int main() { int time,i,j,sum; char str[32]; scanf("%d",&time); for(i=0;i<time;i++) { scanf("%s",str); for( j=0;j<3;j++) { sum=0; sum=(str[j*8]-'0')*128+(str[j*8+1]-'0')*64+(str[j*8+2]-'0')*32+(str[j*8+3]-'0')*16+(str[j*8+4]-'0')*8+(str[j*8+5]-'0')*4+(str[j*8+6]-'0')*2+(str[j*8+7]-'0'); printf("%d.",sum); } sum=0; sum=(str[3*8]-'0')*128+(str[3*8+1]-'0')*64+(str[3*8+2]-'0')*32+(str[3*8+3]-'0')*16+(str[3*8+4]-'0')*8+(str[3*8+5]-'0')*4+(str[3*8+6]-'0')*2+(str[3*8+7]-'0'); printf("%d\n",sum); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator