| ||||||||||
| 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 | |||||||||
我快疯了,我在linux里面用g++运行很正常啊。莫非有什么变态的数据?#include "iostream"
#include "vector"
using namespace std;
using std::vector;
int main()
{
int n,pow,tmp=0;
char bit;
vector<int> res;
cin>>n;
for(int i=0;i!=n;i++){
for(int count=0;count!=32;count++){
if(count%8==0){
if(count)res.push_back(tmp);
pow=128;
tmp=0;
}
cin>>bit;
if(bit!='0'&&bit!='1')continue;
tmp+=(bit-48)*pow;
pow/=2;
}
res.push_back(tmp);
}
for(vector<int>::size_type idx=0;idx!=res.size();idx++){
cout<<res[idx]<<".";
if((idx+1)%4==0){
cout<<"\b\n";
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator