Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73835 彭慕允 二进制小数转十进制 C++ Compile Error 0 MS 0 KB 750 2024-05-19 17:57:31

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { strint s; cin>>s; int len=s.size(); int dian; for(int i=0;; i<len; i++) { if(s[i]=='.') { dian=i; break; } } double sum=0; if(dian==-1) { int a[len]; int j=0; for(int i=len-1; i>=0; i--) { a[j]=s[i]-'0'; j++; } for(int i=0; i<len; i++) { sum+=pow(2,1)*a[i]; } for(int i=0; i<len; i++) { sum+=pow(2,i)*a[i]; } cout<<sum; return 0; } else { int a[dian]; int j=0; for(int i=dian-1; i>=0; i--) { a[j]=s[i]-'0'; j++; } for(int i=0; i<dian; i++) { sum+=pow(2,i)*a[i]; } int k=1; for(int i=dian+1; i<len; i++) { sum+=pow(2,-k)*(s[i]-'0'); k++; } cout<<sum; } }


Run Info:

Main.cc:44:4: error: stray '\357' in program
    sum+=pow(2,-k)*(s[i]-'0');
    ^
Main.cc:44:4: error: stray '\274' in program
Main.cc:44:4: error: stray '\214' in program
Main.cc: In function 'int main()':
Main.cc:6:2: error: 'strint' was not declared in this scope
  strint s;
  ^
Main.cc:7:7: error: 's' was not declared in this scope
  cin>>s;
       ^
Main.cc:10:17: warning: for increment expression has no effect [-Wunused-value]
  for(int i=0;; i std::_Expr, _Tp> std::pow(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   candidate expects 2 arguments, 1 provided
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, _Tp> std::pow(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, _Tp> std::pow(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   candidate expects 2 arguments, 1 provided
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, typename _Dom::value_type> std::pow(const std::valarray&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   candidate expects 2 arguments, 1 provided
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:544:1: note: candidate: template std::_Expr, typename _Dom1::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/5/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:1875:5: note: candidate: template std::complex::__type> std::pow(const std::complex<_Tp>&, const std::complex<_Up>&)
     pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/5/complex:1875:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::complex<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:1867:5: note: candidate: template std::complex::__type> std::pow(const _Tp&, const std::complex<_Up>&)
     pow(const _Tp& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/5/complex:1867:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   candidate expects 2 arguments, 1 provided
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:1859:5: note: candidate: template std::complex::__type> std::pow(const std::complex<_Tp>&, const _Up&)
     pow(const std::complex<_Tp>& __x, const _Up& __y)
     ^
/usr/include/c++/5/complex:1859:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::complex<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:1038:5: note: candidate: template std::complex<_Tp> std::pow(const _Tp&, const std::complex<_Tp>&)
     pow(const _Tp& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/5/complex:1038:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   candidate expects 2 arguments, 1 provided
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:1027:5: note: candidate: template std::complex<_Tp> std::pow(const std::complex<_Tp>&, const std::complex<_Tp>&)
     pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/5/complex:1027:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::complex<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:993:5: note: candidate: template std::complex<_Tp> std::pow(const std::complex<_Tp>&, const _Tp&)
     pow(const complex<_Tp>& __x, const _Tp& __y)
     ^
/usr/include/c++/5/complex:993:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::complex<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:984:5: note: candidate: template std::complex<_Tp> std::pow(const std::complex<_Tp>&, int)
     pow(const complex<_Tp>& __z, int __n)
     ^
/usr/include/c++/5/complex:984:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   mismatched types 'const std::complex<_Tp>' and 'int'
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:41:0,
                 from Main.cc:1:
/usr/include/c++/5/cmath:434:5: note: candidate: template constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^
/usr/include/c++/5/cmath:434:5: note:   template argument deduction/substitution failed:
Main.cc:44:19: note:   candidate expects 2 arguments, 1 provided
    sum+=pow(2,-k)*(s[i]-'0');
                   ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:41:0,
                 from Main.cc:1:
/usr/include/c++/5/cmath:411:3: note: candidate: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^
/usr/include/c++/5/cmath:411:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/5/cmath:407:3: note: candidate: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^
/usr/include/c++/5/cmath:407:3: note:   candidate expects 2 arguments, 1 provided