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:WA了N次,终于过了,给后来人一点提醒。。In Reply To:WA了N次,终于过了,给后来人一点提醒。。 Posted by:zhaohongde at 2006-12-16 21:34:05 > 他的输入中可能有空格等不是0和1的字符,假设不是的话,就不能计算入这个串中间, 我也是WA了几次,不过测试数据没有什么特别的啊: #include<stdio.h> #include<stdlib.h> #include<string.h> main() { int s[]={128,64,32,16,8,4,2,1}; int n,i,j,res; char t[100]; scanf("%d",&n); getchar(); while(n-->0) { gets(t); for(i=0;i<4;i++) { res=0; for(j=0;j<8;j++) res+=s[j]*(t[j+8*i]-'0'); if(i!=0) printf("."); printf("%d",res); } printf("\n"); } system("pause"); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator