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 |
我得,怎么就有wa#include<iostream.h> #include<stdio.h> int cf(int a); int main() { int t; cin>>t; if(t<0||t>9) return 0; while(t--) { int temp=0,res; int g=0; char byte[32]; for(int j=0;j<32;j++) { char c; while(1) { c=getchar(); if(c=='0'||c=='1') break; else continue; } byte[g++]=c; } for(int v=1;v<=3;v++) { res=0; for(int i=7;i>=0;i--) { res=res+cf(i)*(byte[temp++]-'0'); } cout<<res<<'.'; } res=0; for(int i=7;i>=0;i--) { res=res+cf(i)*(byte[temp++]-'0'); } cout<<res<<endl; } return 0; } int cf(int a) { int sum=1; for(int i=0;i<a;i++) { sum=sum*2; } return sum; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator