submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s499355949
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { int tmp,i,ans=0; long N;cin>>N; int sizN=to_string(N).size(); for(tmp=0;tmp<(1<<(sizN-1));tmp++){ bitset<9> s(tmp); long L=0,copyN=N;A int w=1; for(i=0;i<sizN-1;i++){ w*=10; if(s[i]){L+=copyN%w;copyN/=w;w=1;} } ans+=L+copyN; } if(ans==0)ans+=N; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:9:22: error: 'A' was not declared in this scope 9 | long L=0,copyN=N;A | ^ a.cc:12:7: error: 'w' was not declared in this scope 12 | w*=10; | ^
s432520162
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { int tmp,i; int ans=0; int N; string sN=N.to_string(); cin>>N; for(tmp=0;tmp<(1<<(sN.size()-1));tmp++){ bitset<9> s(tmp); int L=0,w=1,NN=N; for(i=0;i<sN.size()-1;i++){ W*=10; if(s[i]){L+=NN%w;NN/=w;w=1;} } ans+=L; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:8:15: error: request for member 'to_string' in 'N', which is of non-class type 'int' 8 | string sN=N.to_string(); | ^~~~~~~~~ a.cc:14:6: error: 'W' was not declared in this scope 14 | W*=10; | ^
s178973650
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { long int S,ans=0; cin>>S; int N; for(int tmp=0;tmp<(1<<S.size()-1);tmp++){ bitset<10> sub(tmp); long int s=S; int i=0; ans+=s%10; N=1;s/=10; while(s){ if(sub.test(i))N*=10; else N=1; ans+=(s%10)*N; s/=10; i++; } } cout <<ans<<endl; }
a.cc: In function 'int main()': a.cc:8:27: error: request for member 'size' in 'S', which is of non-class type 'long int' 8 | for(int tmp=0;tmp<(1<<S.size()-1);tmp++){ | ^~~~
s159224838
p04001
C++
#include <bits/stdc++.h> using namespace std; int plus(string &S) { string num; int point = 0; for (int i = 1; i < S.size() - 1; i++) { num = ""; for (int j = 0; j < S.size(); j++) { if (j == i) { num.push_back("+"); } num.push_back(S.at(j)); } for (int j = 0; j < num.size(); j++) { int ans = 0; int sum = 0; if (num.at(j) == "+") { ans += sum; sum = 0; j++; } sum *= 10; sum += num.at(j); } point += ans; } } int main() { string S; cin >> S; int ans = 0;
a.cc: In function 'int plus(std::string&)': a.cc:11:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 11 | num.push_back("+"); | ^~~ | | | const char* In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1572:24: note: initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1572 | push_back(_CharT __c) | ~~~~~~~^~~ a.cc:18:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 18 | if (num.at(j) == "+") { | ~~~~~~~~~~^~~~~~ a.cc:26:14: error: 'ans' was not declared in this scope; did you mean 'abs'? 26 | point += ans; | ^~~ | abs a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type] 28 | } | ^ a.cc: In function 'int main()': a.cc:33:15: error: expected '}' at end of input 33 | int ans = 0; | ^ a.cc:30:12: note: to match this '{' 30 | int main() { | ^
s873456924
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int64_t ans = 0; for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ int count = 0, sum = 0; for(int i = 0; i < 10; i++){ sum += (i + 1) * (int)pow(10, count); if(tmp.test(i)) count = 0; else count++; } ans += sum; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:30: error: no match for 'operator<' (operand types are 'std::bitset<9>' and 'int') 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ~~~ ^ ~~~~~~~~ | | | | | int | std::bitset<9> In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:9:39: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:9:39: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::pair<_T1, _T2>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::reverse_iterator<_Iterator>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::reverse_iterator<_Iterator>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::move_iterator<_IteratorL>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'const std::move_iterator<_IteratorL>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:9:39: note: 'std::bitset<9>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:9:39: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 9 | for(bitset<9> tmp = 0; tmp < (1 << 9); tmp++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Trai
s130358537
p04001
Java
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int n = s.length(); int[] a = new int[n]; for(int i = 0;i < n; i++) { a[i] = s.charAt(i) - '0'; } long ans = 0; for (int bit = 0; bit < 1 << (n-1); bit++){ long num = 0; long sum = 0; for (int j = 0; j < n; j++){ num = num * 10 + a[j]; if ((bit >> j & 1) == 1){ sum += num; num = 0; } } sum += num; ans += sum; } System.out.println(ans); } }
Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s744031278
p04001
C++
#include <bits/stdc+;.h> using namespace std; int main(){ string s; cin>>s; int n=s.size(); vector<int> a(n); for(int i=0;i<n;i++){ a.at(i)=s.at(i); } }
a.cc:1:10: fatal error: bits/stdc+;.h: No such file or directory 1 | #include <bits/stdc+;.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s439868718
p04001
C++
#include <bits/stdc++.h> using namespace std; int64_t sum(int i, vector<int>A) { if(i==0) return A.at(0); int a=A.at(i); vector<int> B=A; B.at(i-1)=B.at(i-1)*10+a; return sum(i-1,A)+a*(int)pow(2,i-1)+sum(i-1,B); } int main() { string S; cin >> S; vector<int> A(S.size()); for(int i=0;i<S.size(),i++) A.at(i)=S[i]-'0'; cout << sum(S.size(),A) << endl; }
a.cc: In function 'int main()': a.cc:17:29: error: expected ';' before ')' token 17 | for(int i=0;i<S.size(),i++) | ^ | ;
s245315531
p04001
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; int n = s.size(); ll ans = 0; for (int bit = 0; i < (1 << n-1); i++) { ll temp = 0; for (int i = 0; i < n; i++) { temp = temp * 10 + S.at(i) - '0'; if (bit & (1 << i)) { ans += temp; temp = 0; } } ans += temp; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:21: error: 'i' was not declared in this scope 12 | for (int bit = 0; i < (1 << n-1); i++) { | ^ a.cc:15:26: error: 'S' was not declared in this scope 15 | temp = temp * 10 + S.at(i) - '0'; | ^
s656796087
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum(string s, int n){ if(n == 0) return atoi(s.c_str()); if(s.length() <= n) return 0; if(s.length() == 2 && n == 1) return int(s.at(0) + s.at(1)); int total = 0; for(int i = 1; i < s.length(); i++){ int tmp = sum(s.substr(i), n-1); if(tmp != 0){ total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1); } } return total; } int main() { string s; cin >> s; int result = 0; for(int i = 0; i < s.length(); i++){ result += sum(s, i); } cout << result << endl; }
a.cc: In function 'int sum(std::string, int)': a.cc:13:29: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*' 13 | total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1); | ~~~~~~~~^~~~~~ | | | std::__cxx11::basic_string<char> In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~
s965267091
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum(string s, int n){ if(n == 0) return atoi(s); if(s.lenth() <= n) return 0; if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]); int total = 0; for(int i = 1; i < s.length(); i++){ int tmp = sum(s.substr(i), n-1); if(tmp != 0){ total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1); } } return total; } int main() { string s; cin >> s; int result = 0; for(int i = 0; i < s.length(); i++){ result += sum(s, i); } cout << result << endl; }
a.cc: In function 'int sum(std::string, int)': a.cc:5:26: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 5 | if(n == 0) return atoi(s); | ^ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~ a.cc:6:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenth'; did you mean 'length'? 6 | if(s.lenth() <= n) return 0; | ^~~~~ | length a.cc:7:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenth'; did you mean 'length'? 7 | if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]); | ^~~~~ | length a.cc:7:47: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 7 | if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]); | ^ a.cc:7:57: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 7 | if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]); | ^ a.cc:13:29: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*' 13 | total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1); | ~~~~~~~~^~~~~~ | | | std::__cxx11::basic_string<char> /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~
s804327260
p04001
C++
#include <bits/stdc++.h> #include <string> #include <iostream> using namespace std; int main(){ string s; cin>>s; int ans=0; for(int i=0;i<11;i++){ int y=stoi(s.substr(i)); ans=ans+y; } cout<<ans<<end;: }
a.cc: In function 'int main()': a.cc:13:12: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 13 | cout<<ans<<end;: | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<
s553842639
p04001
C++
#include <bits/stdc++.h> #include <string> #include <iostream> using namespace std; int main(){ string s; cin>>s; int ans=0; for(int i=0;i<11;i++){ int y=stoi(substr(i)); ans=ans+y; } cout<<ans<<end;: }
a.cc: In function 'int main()': a.cc:10:16: error: 'substr' was not declared in this scope; did you mean 'strstr'? 10 | int y=stoi(substr(i)); | ^~~~~~ | strstr a.cc:13:12: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 13 | cout<<ans<<end;: | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::oper
s924646524
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int ans=0; for(int i=0;i<11;i++){ int y=stoi(substr(i)); ans=ans+y; } cout<<ans<<end;: }
a.cc: In function 'int main()': a.cc:8:16: error: 'substr' was not declared in this scope; did you mean 'strstr'? 8 | int y=stoi(substr(i)); | ^~~~~~ | strstr a.cc:11:12: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 11 | cout<<ans<<end;: | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::opera
s233748915
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int ans=0; for(int i=0;i<11;i++){ int y=substr(i); ans=ans+stoi(y); } cout<<ans<<end;: }
a.cc: In function 'int main()': a.cc:8:11: error: 'substr' was not declared in this scope; did you mean 'strstr'? 8 | int y=substr(i); | ^~~~~~ | strstr a.cc:9:17: error: no matching function for call to 'stoi(int&)' 9 | ans=ans+stoi(y); | ~~~~^~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from 'int' to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from 'int' to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:11:12: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 11 | cout<<ans<<end;: | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f)
s902743318
p04001
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) string S; int dfs(int i, int sum) { if (i == n) return sum; return dfs(i + 1, sum) + dfs(i + 1, sum + S[i] - '0'); } int main() { cin >> S; cout << dfs(0, S[0] - '0') << endl; }
a.cc: In function 'int dfs(int, int)': a.cc:8:14: error: 'n' was not declared in this scope 8 | if (i == n) return sum; | ^
s440884619
p04001
C++
#include <bits/stdc++.h> #include <math.h> ////べき乗を使うのに必要 using namespace std; //int S の桁数を求める関数 dig int dig(int S) { int ans = 0; while (true) { S /= 10; ans++; if (S==0) break; } return ans; } //int S の左からx番目(x=0 始まり)の数字を求める関数 dig_at_i int dig_at_i(int S, int x) { int a = pow(10,dig(S)-x); int b = S%a; int c = pow(10, dig(S)-x-1); return b/c; } int num(int x) { if (x==0) return 0; int ans = 0; for (int i=0; i<x; i++) { ans += num(i); } return ans; } int sumA(int S, int x) { if (x=0) return S; int a = 0; for (int i=0; i<x; i++) { ans += sumA(S, i); } int b = pow(10, dig(S)-x); int c = S%b; return num(x-1)*c+a; int main() { int S; cin >> S; int sum=0; for (int i=0; i<dig(S); i++) { sum += sumA(S, i); } cout << sum << endl; }
a.cc: In function 'int sumA(int, int)': a.cc:42:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 42 | ans += sumA(S, i); | ^~~ | abs a.cc:49:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 49 | int main() { | ^~ a.cc:49:9: note: remove parentheses to default-initialize a variable 49 | int main() { | ^~ | -- a.cc:49:9: note: or replace parentheses with braces to value-initialize a variable a.cc:49:12: error: a function-definition is not allowed here before '{' token 49 | int main() { | ^ a.cc:57:2: error: expected '}' at end of input 57 | } | ^ a.cc:36:24: note: to match this '{' 36 | int sumA(int S, int x) { | ^
s135336724
p04001
C++
#include <bits/stdc++.h> using namespace std; void sumA(long long S) { if (S<10) { return S; } return ((S-S%10)/10)+(S%10)+sumA(S); } int main() { long long S; cin >> S; cout << sumA(S)+S << endl; }
a.cc: In function 'void sumA(long long int)': a.cc:6:12: error: return-statement with a value, in function returning 'void' [-fpermissive] 6 | return S; | ^ a.cc:9:30: error: invalid operands of types 'long long int' and 'void' to binary 'operator+' 9 | return ((S-S%10)/10)+(S%10)+sumA(S); | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~ | | | | | void | long long int a.cc: In function 'int main()': a.cc:15:18: error: invalid operands of types 'void' and 'long long int' to binary 'operator+' 15 | cout << sumA(S)+S << endl; | ~~~~~~~^~ | | | | | long long int | void
s889167465
p04001
C++
#include <iostream> #include <string> #include <bitset> using namespace std; int main() { string s; cin >> s; int n = s.size(); int b =0; for (int bit = 0; bit < (1 << n-1); ++bit){ bitset<10> a(bit); int t = 0; t += s.at(n - 1)-'0'; int c = 0; for (int i = 2; i <= n; i++) { if (a.test(i-2) == 1) { c = 0; } else { c++; } t += (s.at(n-i)-'0')*pow(10, c); } b += t; } cout << b << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:46: error: 'pow' was not declared in this scope 27 | t += (s.at(n-i)-'0')*pow(10, c); | ^~~
s186122598
p04001
C++
s = input() n = len(s) ans = 0 i = 1 def dfs(i, s, ans): if i==n: #print(i, 'bottom', s, ans) ans += sum([int(i) for i in s.split('+')]) return False, ans else: #print(i, 'left',s, ans) tf, ans = dfs(i+1, s, ans) if tf: return True, ans else: #print(i, 'right',s, ans) p = i + s.count('+') s = s[:p]+'+'+s[p:] tf, ans = dfs(i+1, s, ans) return tf, ans _, a = dfs(i, s, ans) print(a)
a.cc:8:10: error: invalid preprocessing directive #print 8 | #print(i, 'bottom', s, ans) | ^~~~~ a.cc:12:10: error: invalid preprocessing directive #print 12 | #print(i, 'left',s, ans) | ^~~~~ a.cc:17:14: error: invalid preprocessing directive #print 17 | #print(i, 'right',s, ans) | ^~~~~ a.cc:1:1: error: 's' does not name a type 1 | s = input() | ^
s731193784
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int n, ans = 0; n = (int)S.size(); for (int tmp = 0; tmp < (1 << 9); tmp++) { bitset<9> s(tmp); int start = 0; for (int i = 0; i < n; i++) { if (s.test(i)) { string c = S.substr(start, i - start + 1); start = i + 1; ans += atoi(c.c_str); } } string c = S.substr(start, n - start); ans += atoi(c.c_str); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:21:31: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 21 | ans += atoi(c.c_str); | ~~^~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:2640:7: note: declared here 2640 | c_str() const _GLIBCXX_NOEXCEPT | ^~~~~ a.cc:25:23: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 25 | ans += atoi(c.c_str); | ~~^~~~~ /usr/include/c++/14/bits/basic_string.h:2640:7: note: declared here 2640 | c_str() const _GLIBCXX_NOEXCEPT | ^~~~~
s480661821
p04001
C++
program name implicit none character(10):: s integer(8):: bmax,i,ni,j,ans,nans integer(8),allocatable:: bit(:) read*, s bmax = 2**(len_trim(s)-1)-1 allocate(bit(len_trim(s)-1)) ans=0 do i=0,bmax ni=i do j=1,size(bit) bit(j) = and(ni,1) ni = rshift(ni,1) end do nans = ichar(s(1:1)) - ichar('0') do j=1,size(bit) if (bit(j) == 0)then nans=nans*10 + ichar(s(j+1:j+1)) - ichar('0') else ans=ans+nans nans=ichar(s(j+1:j+1)) - ichar('0') end if end do ans=ans+nans end do print*, ans end program name
a.cc:1:1: error: 'program' does not name a type 1 | program name | ^~~~~~~
s462801616
p04001
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0;i < (n);i++) using namespace std; int main(){ string s; cin >> s; int64_t ans = 0; int64_t tmp; for (int bit = 0; bit < (1<<(s.size()-1)); ++bit) { tmp = S[0] - '0'; for (int i = 0; i < s.size()-1; ++i) { if (bit&(1 << i)) { ans += tmp; tmp = 0; } tmp = tmp * 10 + (s[i + 1] - '0'); } ans += tmp; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:15: error: 'S' was not declared in this scope 11 | tmp = S[0] - '0'; | ^
s445863805
p04001
C
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; long int ans;ans=0; string mstr=""; int n=S.size(); for(int tmp=0;tmp<(1<<S.size()-1);tmp++){ bitset<10>g(tmp); for(int i=0;i<S.size()-1;i++){ //プラスなら、そこまでの文字列を加え、mstrメモ用のstringをリセット if(g.test(i)){ mstr+=S.at(i); ans+=stol(mstr); mstr=""; } //プラスでないなら文字列を伸ばすだけ! else{ mstr+=S.at(i); } } //さいごの一文字の処理は手動 mstr+=S.at(n-1); ans+=stol(mstr); mstr=""; } cout <<ans<<endl; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s489104101
p04001
C++
#include<bits/stdc++.h> #define REP(i, n) for(int i=0; i<n; i++) using namespace std; using ll = long long; int ctoi(char c){ if(c >= '0' && c <= '9'){ return c - '0'; } } ll fullsearch(int n, int(&a)[10]) { int ret = 0; for (int bit = 0; bit < (1<<n-1); ++bit) { ll sum = a[0]; ll tmp = 0; for (int i = 0; i < n-1; ++i) { if (bit & (1<<i)) { sum += tmp; tmp = 0; sum += a[i+1]; }else{ tmp = tmp*10+a[i+1]; } } sum += tmp; ret += sum; } return ret; } int main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; N = S.length(); int a[10]; for (int i = 0; i < N; i++) { a[i] = ctoi(S[i]); } ll ans = fullsearch(N, a); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:39:9: error: 'N' was not declared in this scope 39 | N = S.length(); | ^ a.cc: In function 'int ctoi(char)': a.cc:10:1: warning: control reaches end of non-void function [-Wreturn-type] 10 | } | ^
s389424197
p04001
C++
#include<bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(),v.end() #define INF INT_MAX; typedef long long ll; using namespace std; int N; ll ans; void check_sum(string s,int x,vector<bool> &ope){ if(x==N-1){ ll sum=0; int f=0; for(int i=0;i<N-1;i++){ if(ope.at(i)){ sum += atoll(s.substr(f,i-f+1).c_str()); f = i+1; } } sum += atoll(s.substr(f).c_str()); ans += sum ; //puts("###"); return ; } ope.at(x)=false; check_sum(s,x+1,ope); ope.at(x)=true; check_sum(s,x+1,ope); }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s910160256
p04001
C++
#include<bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(),v.end() #define INF INT_MAX; typedef long long ll; using namespace std; int N; ll ans; void check_sum(string s,int x,vector<bool> &ope){ if(x==N-1){ ll sum=0; int f=0; for(int i=0;i<N-1;i++){ if(ope.at(i)){ sum += (ll)(atoi(s.substr(f,i-f+1).c_str())); f = i+1; } } sum += (ll)(atoi(s.substr(f).c_str())); ans += sum ; return ; } ope.at(x)=false; check_sum(s,x+1,ope); ope.at(x)=true; check_sum(s,x+1,ope); }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s076836257
p04001
C++
#include<bits/stdc++.h> using namespace std; int main(){ int S; cin>>S; long ans; int len=to_string(S).length; for(int i=0;i<(1<<len;i++){ int dig=1; for(int i=0;i<len;i++){ if(bit & (1<<i){ ans+=S/10*dig; dig=1; }else{ dig++; } } } // int n = 10; // // // {0, 1, ..., n-1} の部分集合の全探索 // for (int bit = 0; bit < (1<<n); ++bit) // { // /* bit で表される集合の処理を書く */ // // // /* きちんとできていることを確認してみる */ /* // bit の表す集合を求める vector<int> S; for (int i = 0; i < n; ++i) { if (bit & (1<<i)) { // i が bit に入るかどうか S.push_back(i); } } // bit の表す集合の出力 cout << bit << ": {"; for (int i = 0; i < (int)S.size(); ++i) { cout << S[i] << " "; } cout << "}" << endl; }*/ return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int' 8 | int len=to_string(S).length; | ^~~~~~ a.cc:9:24: error: expected ')' before ';' token 9 | for(int i=0;i<(1<<len;i++){ | ~ ^ | ) a.cc:12:10: error: 'bit' was not declared in this scope 12 | if(bit & (1<<i){ | ^~~ a.cc:12:22: error: expected ')' before '{' token 12 | if(bit & (1<<i){ | ~ ^ | ) a.cc:18:5: error: expected primary-expression before '}' token 18 | } | ^
s591638026
p04001
C++
#include <iostream> #include <math.h> #include <string> #include <sstream> using namespace std; istringstream iss; int sum, num, c; string S; int summary(string s, int x){ //cout << s << " " << s.size() << " " << x << endl; if(x == s.size()){ iss = istringstream(s.substr(0,1)); iss >> num; //cout << x; for(int i=1;i<=s.size()-1;i++){ if(s.substr(i,1)=="+"){ //printf("%s \n", s.substr(i,1)); sum += num; num = 0; } else{ iss = istringstream(s.substr(i,1)); iss >> c; num *= 10; num += c; } //cout << "num = " << num << endl; } sum += num; //cout << "sum=" << sum << endl; } else { string s2 = s; summary(s.insert(x,"+"), x+2); s = s2; summary(s, x+1); } } int main(){ cin >> S; /* if(S.size()==1){ iss = istringstream(S.substr(0,1)); iss >> sum; } */ else if(S.size()==2){ int x, y, z; iss = istringstream(S.substr(0,1)); iss >> x; iss = istringstream(S.substr(1,1)); iss >> y; iss = istringstream(S.substr(0,2)); iss >> z; sum = x + y + z; } /* else{ sum = 0; summary(S, 1); } */ cout << sum; //S.insert(1,"+"); //cout << S; cout << endl; }
a.cc: In function 'int summary(std::string, int)': a.cc:43:1: warning: no return statement in function returning non-void [-Wreturn-type] 43 | } | ^ a.cc: In function 'int main()': a.cc:54:5: error: 'else' without a previous 'if' 54 | else if(S.size()==2){ | ^~~~
s777061052
p04001
C++
#include <bits/stdc++.h> using namespace std; char s[12345]; int main() { cin >> s; int n = s.size(); long long ans = 0; for(int t = 0; t < (1 << (n-1)); t++){ long long num = s[0]; for(int i = 0; i < n-1; i++){ if (t & (1 << i)) { ans = ans + num; num = 0; } num = num*10 + s[i+1]; } ans = ans + num; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:7:13: error: request for member 'size' in 's', which is of non-class type 'char [12345]' 7 | int n = s.size(); | ^~~~
s757832139
p04001
C++
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int calculate(string s) { int sum = 0; if (s.size()==1) return stoi(s); sum += stoi(s) + (int)(s.at(s.size()-1)); s.pop_back(); sum += calculate(s); return sum; } int main() { string s; cin >> s; cout << calculate(s) << endl; } }
a.cc:19:1: error: expected declaration before '}' token 19 | } | ^
s345815325
p04001
C++
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int calculate(string s) { int sum = 0; if (s.size()==1) return stoi(s); sum += stoi(s) + ctoi(s.at(s.size()-1)) + calculate(s.pop_back()); return sum; } int main() { string s; cin >> s; cout << calculate(s) << endl; } }
a.cc: In function 'int calculate(std::string)': a.cc:8:22: error: 'ctoi' was not declared in this scope; did you mean 'atoi'? 8 | sum += stoi(s) + ctoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ^~~~ | atoi a.cc:8:67: error: invalid use of void expression 8 | sum += stoi(s) + ctoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ~~~~~~~~~~^~ a.cc: At global scope: a.cc:17:1: error: expected declaration before '}' token 17 | } | ^
s691651305
p04001
C++
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int calculate(string s) { int sum = 0; if (s.size()==1) return stoi(s); sum += stoi(s) + stoi(s.at(s.size()-1)) + calculate(s.pop_back()); return sum; } int main() { string s; cin >> s; cout << calculate(s) << endl; } }
a.cc: In function 'int calculate(std::string)': a.cc:8:26: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 8 | sum += stoi(s) + stoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ~~~~^~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:2: /usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)' 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)' 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~ /usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:8:67: error: invalid use of void expression 8 | sum += stoi(s) + stoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ~~~~~~~~~~^~ a.cc: At global scope: a.cc:17:1: error: expected declaration before '}' token 17 | } | ^
s952383969
p04001
C++
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int calculate(string s) { int sum = 0; if (s.size()==1) return atoi(s); sum += atoi(s) + atoi(s.at(s.size()-1)) + calculate(s.pop_back()); return sum; } int main() { string s; cin >> s; cout << calculate(s) << endl; } }
a.cc: In function 'int calculate(std::string)': a.cc:7:34: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 7 | if (s.size()==1) return atoi(s); | ^ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:2: /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~ a.cc:8:17: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 8 | sum += atoi(s) + atoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ^ | | | std::string {aka std::__cxx11::basic_string<char>} /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~ a.cc:8:31: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive] 8 | sum += atoi(s) + atoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ~~~~^~~~~~~~~~~~ | | | __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char} /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~ a.cc:8:67: error: invalid use of void expression 8 | sum += atoi(s) + atoi(s.at(s.size()-1)) + calculate(s.pop_back()); | ~~~~~~~~~~^~ a.cc: At global scope: a.cc:17:1: error: expected declaration before '}' token 17 | } | ^
s832200010
p04001
C++
#include <bits/stdc++.h> using namespace std; int main () { string S; cin >> S; int sum; string num; int count = 0 int N = S.size() - 1; for (int i = 0; i < (1 << N); i++) { bitset<N> s(i); for (int j = 0; j < S.size(); j++) { if (s.test(j) || j == N) { for (k = 0; k < count; k++) { num += S.at(N - j + k); } sum += stoi(num); cout << sum << endl; } else { count++; } } } }
a.cc: In function 'int main()': a.cc:10:3: error: expected ',' or ';' before 'int' 10 | int N = S.size() - 1; | ^~~ a.cc:11:29: error: 'N' was not declared in this scope 11 | for (int i = 0; i < (1 << N); i++) { | ^ a.cc:14:13: error: request for member 'test' in 's', which is of non-class type 'int' 14 | if (s.test(j) || j == N) { | ^~~~ a.cc:15:14: error: 'k' was not declared in this scope 15 | for (k = 0; k < count; k++) { | ^
s591340913
p04001
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; ll answer;//returnする int size = s.size()-1;//数列のサイズ-1 for (int tmp = 0; tmp < (1 << (size)); tmp++) {//+の分布を与える、右からi番目が1のときその後は+ ll c = s[0];//+が来るまでの入れ物 for (int i = 0; i < size; i++) {//+の分布に対して和を返す ll sum = 0; if (tmp & (1 << i)) {//i番目の後が+ならそこまで保持した値を和に加算し、次の値を保持しはじめる sum += c; c = s[i+1]; } else {//+でないなら10倍して足す c *= 10; c -= '0'; c += s[i+1]; } if (i == size-1) { sum += c;//最後に保持していた分も足す answer += sum;//1計算あたりのループに対して和を答えに足す } } } cout << answer << endl }
a.cc: In function 'int main()': a.cc:32:25: error: expected ';' before '}' token 32 | cout << answer << endl | ^ | ; 33 | } | ~
s978226589
p04001
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; ll answer;//returnする int size = s.size()-1;//数列のサイズ-1 for (int tmp = 0; tmp < (1 << (size)); tmp++) { bitset<size> plus(tmp);//+の分布を与えるbitset、右からi番目が1のときその後は+ ll c = s[0];//+が来るまでの入れ物 for (int i = 0; i < size; i++) {//+の分布に対して和を返す ll sum = 0; if (plus.test(i)) {//i番目の後が+ならそこまで保持した値を和に加算し、次の値を保持しはじめる sum += c; c = s[i+1]; } else {//+でないなら10倍して足す c *= 10; c -= '0'; c += s[i+1]; } if (i == size-1) { sum += c;//最後に保持していた分も足す answer += sum;//1計算あたりのループに対して和を答えに足す } } } cout << answer << endl }
a.cc: In function 'int main()': a.cc:11:16: error: the value of 'size' is not usable in a constant expression 11 | bitset<size> plus(tmp);//+の分布を与えるbitset、右からi番目が1のときその後は+ | ^ a.cc:9:7: note: 'int size' is not const 9 | int size = s.size()-1;//数列のサイズ-1 | ^~~~ a.cc:11:16: note: in template argument for type 'long unsigned int' 11 | bitset<size> plus(tmp);//+の分布を与えるbitset、右からi番目が1のときその後は+ | ^ a.cc:15:16: error: request for member 'test' in 'plus', which is of non-class type 'int' 15 | if (plus.test(i)) {//i番目の後が+ならそこまで保持した値を和に加算し、次の値を保持しはじめる | ^~~~ a.cc:33:25: error: expected ';' before '}' token 33 | cout << answer << endl | ^ | ; 34 | } | ~
s801405722
p04001
C++
#include <iostream> using namespace std; int main(){ int S; int a[10], k, b, c; cin >> S; for(int i=0;i<11;i++) { if(S%10!=0) { a[i] = S - S/10*10; S = S /10; } if(S%10==0) { a[i] = S; k = i - 1; } int l = 0; for(int bit=0;bit < (1 << k);++bit) { for(int j=0; j < k; ++j) { if(bit&&(1<<j)==1) { for(l; l<=j;) { if(l!=j) { c = a[l]; b = c*10; } if(l==j&&l!=0) { b = b + a[l]; S = S + b; ++l; } } } } } cout << S; }
a.cc: In function 'int main()': a.cc:36:4: error: expected '}' at end of input 36 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s772306633
p04001
C++
#include <iostream> using namespace std; int main(){ int S; int a[10], k, b, c; cin >> S; for(int i=0;i<11;i++) { if(S%10!=0) { a[i] = S - S/10*10; S = S /10; } if(S%10==0) { a[i] = S; k = i - 1; } int l = 0; for(int bit=0;bit < (1 << k);++bit) { for(int j=0; j < k; ++j) { if(bit&&(1<<j)==1) { for(l; l<=j;) { if(l!=j) { c = a[l]; b = c*10; } if(l==j&&l!=0) { b = b + a[l]; S = S + b; ++l; } } } } cout << S; }
a.cc: In function 'int main()': a.cc:35:4: error: expected '}' at end of input 35 | } | ^ a.cc:8:25: note: to match this '{' 8 | for(int i=0;i<11;i++) { | ^ a.cc:35:4: error: expected '}' at end of input 35 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s616704516
p04001
C++
#include <iostream> using namespace std; int main(){ int S; int a[10], k, b, c; cin >> S; for(int i=0;i<11;i++) { if(S%10!=0) { a[i] = S - S/10*10; S = S /10; } if(S%10==0) { a[i] = S; k = i - 1; } int l = 0; for(int bit=0;bit < (1 << k);++bit) { for(int j=0; j < k; ++j) { if(bit&&(1<<j)==1) { for(l; l<=j;) { if(l!=j) { c = a[l]; b = c*10; } if(l==j&&l!=0) { b = b + a[l]; S = S + b; ++l: } } } } cout << S; }
a.cc: In function 'int main()': a.cc:29:16: error: expected ';' before ':' token 29 | ++l: | ^ | ; a.cc:35:4: error: expected '}' at end of input 35 | } | ^ a.cc:8:25: note: to match this '{' 8 | for(int i=0;i<11;i++) { | ^ a.cc:35:4: error: expected '}' at end of input 35 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s871467369
p04001
C++
#include <iostream> using namespace std; int main(){ int S; int a[10], k, b, c; cin >> S; for(i=0;i<11;i++) { if(S%10!=0) { a[i] = S - S/10*10; S = S /10; } if(S%10==0) { a[i] = S; k = i - 1; } int l = 0; for(int bit=0;bit < (1 << k);++bit) { for(int j=0; j < k; ++j) { if(bit&&(1<<j)==1) { for(l; l<=j;) { if(l!=j) { c = a[l]; b = c*10; } if(l==j&&l!=0) { b = b + a[l]; S = S + b; ++l: } } } } cout << S; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i<11;i++) { | ^ a.cc:29:16: error: expected ';' before ':' token 29 | ++l: | ^ | ; a.cc:35:4: error: expected '}' at end of input 35 | } | ^ a.cc:8:21: note: to match this '{' 8 | for(i=0;i<11;i++) { | ^ a.cc:35:4: error: expected '}' at end of input 35 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s075629741
p04001
C++
#include <bits/stdc++.h> using namespace std; string S; long long ans; void DFS(int a,string s,int b) { if (a != s.size()){ return (a + 1,s,b * 10 + int(s[a - 1] - 48)); return (a + 1,s,int(s[a - 1] - 48)); ans += b; } } int main() { cin >> S; DFS(1,S,0); cout << ans << endl; return 0; }
a.cc: In function 'void DFS(int, std::string, int)': a.cc:8:20: error: return-statement with a value, in function returning 'void' [-fpermissive] 8 | return (a + 1,s,b * 10 + int(s[a - 1] - 48)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:9:20: error: return-statement with a value, in function returning 'void' [-fpermissive] 9 | return (a + 1,s,int(s[a - 1] - 48)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
s566628210
p04001
C++
#include <bits/stdc++.h> using namespace std; string S; long long ans; void DFS(int a,string s,int b) { if (a != s.size()){ return (a + 1,s,b * 10 + int(s[i] - 48)); return (a + 1,s,int(s[i] - 48)); ans += b; } } int main() { cin >> S; DFS(1,S,0); cout << ans << endl; return 0; }
a.cc: In function 'void DFS(int, std::string, int)': a.cc:8:36: error: 'i' was not declared in this scope 8 | return (a + 1,s,b * 10 + int(s[i] - 48)); | ^
s448205288
p04001
C++
#include <iostream> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <bitset> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define INF 2000000000 #define rep(i,n) for(int i=0;i<(n);i++) typedef pair<int, int> P; const ll MOD=1000000007; using Graph = vector<vector<int>>; int main() { string s; cin >> s; int n = s.size()-1; ull ans = 0; for (int tmp = 0; tmp < (1 << n); tmp++) { string m[10]; int j = 0; bitset<10> t(tmp); ull sum = 0; for (int i = 0; i < n+1; i++) { if (i>0 && t[i-1]) j++; m[j] += s[i]; } for (int i = 0; i <= j; i++) { ull a = stoull(m[i]); //cout << "/" << a << endl; sum += a; } ans += sum; //cout << sum << endl; } cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:57:18: error: expected '}' at end of input 57 | return 0; | ^ a.cc:26:12: note: to match this '{' 26 | int main() { | ^
s475361634
p04001
C++
//#include <bits/stdc++.h> #include <vector> #include <iostream> #include<algorithm> #include<string> using namespace std; long long sum_plus(string s) { long long ans = 0; char* endptr; ans+= strtoll(s.c_str(), &endptr, 10); for (int i = 1; i < s.size(); i++) { string left = s.substr(0, i); ans += strtoll(left.c_str(), &endptr,10)*(pow(2,(s.size()-i-1))) + sum_plus(s.substr(i)); } return ans; } int main() { string s; cin >> s; cout << sum_plus(s) << endl; }
a.cc: In function 'long long int sum_plus(std::string)': a.cc:15:51: error: 'pow' was not declared in this scope 15 | ans += strtoll(left.c_str(), &endptr,10)*(pow(2,(s.size()-i-1))) + sum_plus(s.substr(i)); | ^~~
s907675474
p04001
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ string s; cin >> s; int n = s.size(); ll ans = 0; for(int bit = 0; bit < (1<<n-1); bit++){ ll t = s[0] - '0'; rep(i,n-1){ if(bit & (1 << i)){ ans += t; t = s[i+1] - '0'; }else{ t *= 10; t *= s[i+1] - '0'; } } ans += t } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:17: error: expected ';' before '}' token 21 | ans += t | ^ | ; 22 | } | ~
s422935500
p04001
C++
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> using namespace std; int main(){ string s; cin >> s; int ans=0; int a=s.size()-1; int r; for(int tmp=0;tmp<(1<<a);tmp++){ bitset<9> bit(tmp); r = s[0]-'0'; for(int i=0;i<a;i++){ if(bit.test(i)){ ans += r; r = 0; } r = r*10 + s[i+1]-'0'; } ans += r; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:17:9: error: 'bitset' was not declared in this scope 17 | bitset<9> bit(tmp); | ^~~~~~ a.cc:6:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>' 5 | #include<cmath> +++ |+#include <bitset> 6 | using namespace std; a.cc:17:19: error: 'bit' was not declared in this scope 17 | bitset<9> bit(tmp); | ^~~
s568586062
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; string A; long long ans = 0; for(int i = 0; i < (1 << (s.size() - 1)); i++){ bitset<11> p(i); A = s[0] for(int j = 0; j < (s.size() - 1); j++){ if(p[j]){ ans += stoll(A); A = s[j + 1]; } else{ A += s[j + 1]; } } ans += stoll(A); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:13: error: expected ';' before 'for' 11 | A = s[0] | ^ | ; 12 | for(int j = 0; j < (s.size() - 1); j++){ | ~~~ a.cc:12:20: error: 'j' was not declared in this scope 12 | for(int j = 0; j < (s.size() - 1); j++){ | ^
s808632229
p04001
C++
t
a.cc:1:1: error: 't' does not name a type 1 | t | ^
s839821951
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum_from(string S, int start) { if(start == S.size() - 1) return S.at(start) - '0'; int sum = 0; for(int i = start; i < S.size(); i++) sum = sum * 10 + S.at(i) - '0'; return sum + sum_from(S, start + 1); int main() { string S; cin >> S; cout << sum_from(S, 0) << endl; }
a.cc: In function 'int sum_from(std::string, int)': a.cc:12:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 12 | int main() | ^~ a.cc:12:9: note: remove parentheses to default-initialize a variable 12 | int main() | ^~ | -- a.cc:12:9: note: or replace parentheses with braces to value-initialize a variable a.cc:13:1: error: a function-definition is not allowed here before '{' token 13 | { | ^ a.cc:17:2: error: expected '}' at end of input 17 | } | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s787687559
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum_from(string S, int start) { if(S.at(start + 1) == '¥n') return S.at(start); return sum_from(S. start + 1) + S.at(start); } int main() { string S; cin >> S; cout << sum_from(S, 0) << endl; }
a.cc:6:25: warning: multi-character character constant [-Wmultichar] 6 | if(S.at(start + 1) == '¥n') | ^~~~ a.cc: In function 'int sum_from(std::string, int)': a.cc:8:22: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'start' 8 | return sum_from(S. start + 1) + S.at(start); | ^~~~~
s751026952
p04001
C++
#include<iostream> #include<math.h> #include<stdlib.h> #include<string> using namespace std; int main() { string s; cin >> s; long long sum = 0; int n = s.size(); for (int temp = 0; temp < (1 << n - 1); temp++) { long long t = s[0] - '0'; for (int i = 0; i < n - 1; i++) { if (temp & (1 << i)) { sum += t; t = s[i + 1] - '0'; } else { t *= 10; t += s[i + 1] - '0'; } } sum += t } cout << sum; return 0; }
a.cc: In function 'int main()': a.cc:24:25: error: expected ';' before '}' token 24 | sum += t | ^ | ; 25 | } | ~
s383039944
p04001
C++
#include<iostream> #include<math.h> #include<string> using namespace std; int main() { string s; cin >> s; long long sum = 0; int n = s.size(); for (int temp = 0; temp < (1 << n - 1); temp++) { long long t = s[0] - '0'; for (int i = 0; i < n - 1; i++) { if (temp & (1 << i)) { sum += t; t = s[i + 1] - '0'; } else { t *= 10; t += s[i + 1] - '0'; } } sum += t } cout << sum; return 0; }
a.cc: In function 'int main()': a.cc:23:25: error: expected ';' before '}' token 23 | sum += t | ^ | ; 24 | } | ~
s464940870
p04001
C++
#include<iostream> #include<string> using namespace std; int main(){ string S; cin >> S; int sum = 0; for (int i = 0; i < (1 << n-1); i++){ int t = S[0} - '0'; for (int j = 0; j < (n-1); j++){ if (i & (1 << j)){ sum += S[j] - '0'; t = S[j+1] - '0'; }else { t *= 10; t = S[j+1] - '0'; } } } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:9:29: error: 'n' was not declared in this scope 9 | for (int i = 0; i < (1 << n-1); i++){ | ^ a.cc:10:16: error: expected ']' before '}' token 10 | int t = S[0} - '0'; | ^ | ] a.cc:10:16: error: expected ',' or ';' before '}' token a.cc:11:26: error: 'n' was not declared in this scope 11 | for (int j = 0; j < (n-1); j++){ | ^ a.cc:12:11: error: 'i' was not declared in this scope 12 | if (i & (1 << j)){ | ^ a.cc:14:9: error: 't' was not declared in this scope 14 | t = S[j+1] - '0'; | ^ a.cc:16:9: error: 't' was not declared in this scope 16 | t *= 10; | ^ a.cc: At global scope: a.cc:21:3: error: 'cout' does not name a type 21 | cout << sum << endl; | ^~~~ a.cc:22:15: error: expected declaration before '}' token 22 | } | ^
s421095628
p04001
C++
s = input() ans = 0 def dfs(index, ret): if index == len(s) - 1: ret += s[index] ret2 = map(int, ret.split("+")) global ans ans += sum(ret2) return dfs(index + 1, ret + s[index]) or dfs(index + 1, ret + s[index] + "+") dfs(0, "") print(ans)
a.cc:1:1: error: 's' does not name a type 1 | s = input() | ^
s113349061
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; long long sum = 0; string A // string B; for (int i = 0; i < (1 << (S.size()-1)); i++) { bitset<10> p(i); A = S.at(0); // B = ""; for (int j = 0; j<(S.size()-1); j++){ if(p.test(j)){ sum += stoi(A); // B = B + A +'+'; A = S.at(j+1); } else { A = A + S.at(j+1); } } // B = B + A; // cout << i << ':' << B << endl; sum += stoi(A); // cout << sum << endl; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:12:3: error: expected initializer before 'for' 12 | for (int i = 0; i < (1 << (S.size()-1)); i++) { | ^~~ a.cc:12:19: error: 'i' was not declared in this scope 12 | for (int i = 0; i < (1 << (S.size()-1)); i++) { | ^
s780508818
p04001
C++
#include <iostream> #include <string> #include <bitset> #include <cmath> #include <algorithm> using namespace std; int main(void){ string str; long long sum = 0; cin >> str; // 各計算の式のプラスが入る場所を作る for(int tmp = 0; tmp < (1 << (str.size()-1)); tmp++){ bitset<10> s(tmp); string now_Str = ""; now_Str = str[0]; // 各計算の式を作る場所、bitset<>でプラスがある場所を設定 for(int i = 0; i < (str.size()-1); i++){ if(s.test(i)) now_Str += "+"; now_Str += str[i+1]; } int pos = 0; // 現在地、find()で現在見ている場所が変化するから。 // プラス前までの数を sum に加える while(now_Str.find("+", pos) != string::npos){ int next_Pos = now_Str.find("+", pos); sum += stoll(now_Str.substr(pos, next_Pos - pos)); pos = next_Pos + 1; } // 最後プラス後の数を sum に加える sum += stoll(now_Str.substr(pos)); } cout << sum << endl; }
a.cc:25:21: error: extended character   is not valid in an identifier 25 | int pos = 0; // 現在地、find()で現在見ている場所が変化するから。 | ^ a.cc: In function 'int main()': a.cc:25:21: error: '\U00003000' was not declared in this scope 25 | int pos = 0; // 現在地、find()で現在見ている場所が変化するから。 | ^~
s103001159
p04001
C++
#include<cstdio> #include<cmath> #include<algorithm> using namespace std; long long result; int len; char orin[100]; long long temp[100]; void dfs(int x, long long sum,int cnt) { if (x == len) { temp[cnt] = sum; for (int i = 1; i <= cnt; ++i) result += temp[i]; return; } temp[cnt] = sum; dfs(x + 1, orin[x] - '0',cnt+1); if (sum) dfs(x + 1, sum * 10 + orin[x] - '0',cnt); } int main(void) { scanf("%s", orin); len = strlen(orin); dfs(0, 0,0); printf("%lld", result); }
a.cc: In function 'int main()': a.cc:32:15: error: 'strlen' was not declared in this scope 32 | len = strlen(orin); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 |
s920149313
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string N; cin >> N; s=N.size(); bitset<s> bita; for (int bit=0;bit<(1<<(s-1));++bit){ cout << bit<< endl; } }
a.cc: In function 'int main()': a.cc:7:3: error: 's' was not declared in this scope 7 | s=N.size(); | ^
s838444159
p04001
C++
#include<iostream> #include<string> using namespace std; typedef long long ll; vector<vector<ll>> fmr; int ln; const char* num; int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } void addFmr(int cnt, vector<ll> f) { if (cnt >= ln) { fmr.push_back(f); return; } vector<ll> v = f; int add = ctoi(num[cnt]); v[v.size() - 1] = v[v.size() - 1] * 10 + add; f.push_back(add); addFmr(cnt + 1, v); addFmr(cnt + 1, f); return; } int main() { string st; cin >> st; num = st.c_str(); ll sum,tmp; int ix = 0; sum = tmp = 0; while (num[ln] != '\0') { ln++; } vector<ll> f; f.push_back(ctoi(num[0])); addFmr(1, f); for (int i = 0;i < fmr.size();i++) { vector<ll> sp = fmr[i]; tmp = 0; for (int k = 0; k < sp.size(); k++) { tmp += sp[k]; } sum += tmp; } cout << sum << endl; return 0; }
a.cc:7:1: error: 'vector' does not name a type 7 | vector<vector<ll>> fmr; | ^~~~~~ a.cc:18:22: error: 'vector' has not been declared 18 | void addFmr(int cnt, vector<ll> f) { | ^~~~~~ a.cc:18:28: error: expected ',' or '...' before '<' token 18 | void addFmr(int cnt, vector<ll> f) { | ^ a.cc: In function 'void addFmr(int, int)': a.cc:21:17: error: 'fmr' was not declared in this scope 21 | fmr.push_back(f); | ^~~ a.cc:21:31: error: 'f' was not declared in this scope 21 | fmr.push_back(f); | ^ a.cc:25:9: error: 'vector' was not declared in this scope 25 | vector<ll> v = f; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include<iostream> +++ |+#include <vector> 3 | #include<string> a.cc:25:18: error: expected primary-expression before '>' token 25 | vector<ll> v = f; | ^ a.cc:25:20: error: 'v' was not declared in this scope 25 | vector<ll> v = f; | ^ a.cc:25:24: error: 'f' was not declared in this scope 25 | vector<ll> v = f; | ^ a.cc: In function 'int main()': a.cc:59:9: error: 'vector' was not declared in this scope 59 | vector<ll> f; | ^~~~~~ a.cc:59:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:59:18: error: expected primary-expression before '>' token 59 | vector<ll> f; | ^ a.cc:59:20: error: 'f' was not declared in this scope 59 | vector<ll> f; | ^ a.cc:63:28: error: 'fmr' was not declared in this scope 63 | for (int i = 0;i < fmr.size();i++) { | ^~~ a.cc:64:26: error: expected primary-expression before '>' token 64 | vector<ll> sp = fmr[i]; | ^ a.cc:64:28: error: 'sp' was not declared in this scope; did you mean 'st'? 64 | vector<ll> sp = fmr[i]; | ^~ | st
s879194705
p04001
C++
#include<iostream> using namespace std; typedef long long ll; vector<vector<ll>> fmr; int ln; const char* num; int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } void addFmr(int cnt, vector<ll> f) { if (cnt >= ln) { fmr.push_back(f); return; } vector<ll> v = f; int add = ctoi(num[cnt]); v[v.size() - 1] = v[v.size() - 1] * 10 + add; f.push_back(add); addFmr(cnt + 1, v); addFmr(cnt + 1, f); return; } int main() { std::ifstream in("D:\\myDocHome\\AtCoderTest\\input.txt"); std::cin.rdbuf(in.rdbuf()); string st; cin >> st; num = st.c_str(); ll sum,tmp; int ix = 0; sum = tmp = 0; while (num[ln] != '\0') { ln++; } vector<ll> f; f.push_back(ctoi(num[0])); addFmr(1, f); for (int i = 0;i < fmr.size();i++) { vector<ll> sp = fmr[i]; tmp = 0; for (int k = 0; k < sp.size(); k++) { tmp += sp[k]; } sum += tmp; } cout << sum << endl; return 0; }
a.cc:6:1: error: 'vector' does not name a type 6 | vector<vector<ll>> fmr; | ^~~~~~ a.cc:17:22: error: 'vector' has not been declared 17 | void addFmr(int cnt, vector<ll> f) { | ^~~~~~ a.cc:17:28: error: expected ',' or '...' before '<' token 17 | void addFmr(int cnt, vector<ll> f) { | ^ a.cc: In function 'void addFmr(int, int)': a.cc:20:17: error: 'fmr' was not declared in this scope 20 | fmr.push_back(f); | ^~~ a.cc:20:31: error: 'f' was not declared in this scope 20 | fmr.push_back(f); | ^ a.cc:24:9: error: 'vector' was not declared in this scope 24 | vector<ll> v = f; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include<iostream> +++ |+#include <vector> 3 | using namespace std; a.cc:24:18: error: expected primary-expression before '>' token 24 | vector<ll> v = f; | ^ a.cc:24:20: error: 'v' was not declared in this scope 24 | vector<ll> v = f; | ^ a.cc:24:24: error: 'f' was not declared in this scope 24 | vector<ll> v = f; | ^ a.cc: In function 'int main()': a.cc:42:25: error: variable 'std::ifstream in' has initializer but incomplete type 42 | std::ifstream in("D:\\myDocHome\\AtCoderTest\\input.txt"); | ^ a.cc:3:1: note: 'std::ifstream' is defined in header '<fstream>'; this is probably fixable by adding '#include <fstream>' 2 | #include<iostream> +++ |+#include <fstream> 3 | using namespace std; a.cc:60:9: error: 'vector' was not declared in this scope 60 | vector<ll> f; | ^~~~~~ a.cc:60:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:60:18: error: expected primary-expression before '>' token 60 | vector<ll> f; | ^ a.cc:60:20: error: 'f' was not declared in this scope 60 | vector<ll> f; | ^ a.cc:64:28: error: 'fmr' was not declared in this scope 64 | for (int i = 0;i < fmr.size();i++) { | ^~~ a.cc:65:26: error: expected primary-expression before '>' token 65 | vector<ll> sp = fmr[i]; | ^ a.cc:65:28: error: 'sp' was not declared in this scope; did you mean 'st'? 65 | vector<ll> sp = fmr[i]; | ^~ | st
s298904618
p04001
C++
#include<bits/stdc++.h> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; int main(){ string s; cin>>s; ll n=sz(s); for(int bit=0;bit<(1<<n-1);bit++){ ll k=0; rep(i,n-1){ if(i&bit){ k*=10; k+=s[i]-'0'; ans+=k; k=0; } else{ k*=10; k+=s[i]-'0'; } } k*=10; k+=s[n-1]-'0'; ans+=k; } COUT(ans); }
a.cc: In function 'int main()': a.cc:46:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 46 | ans+=k; | ^~~ | abs a.cc:56:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 56 | ans+=k; | ^~~ | abs a.cc:58:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 58 | COUT(ans); | ^~~ a.cc:17:24: note: in definition of macro 'COUT' 17 | #define COUT(x) cout<<(x)<<endl | ^
s053042415
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int N=s.size(); int all_sum=0; for(int i=0;i<N;i++){ int a=stoll(s); int part_number=s[0]; if(N>1){ for(int tmp=0;tmp<(1<<N-1);tmp++){ bitset<9>cord(tmp); for(int i=0;i<N-1;i++){ if(cord.test(N-2-i)){ all_sum+=part_number; part_number=s[i+1]; }else { part_number*=10; part_number+=s[i+1]; } if(i==N-2)all_sum+=part_number; } } } else all_sum=s[0]; cout<<all_sum<<endl; }
a.cc: In function 'int main()': a.cc:30:2: error: expected '}' at end of input 30 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s095221653
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ char s[11]; scanf("%s",s); int i,j; long long ans=0; long long tmp; // ’+’で分割したものを代入 for(i=0;i<( 1 << ( strlen(s) - 1 ) );i++){ // S="125"なら、i=(00)_2~(11)_2まで。   // strlen(s) にすると、i=(111)_2までになる。 tmp = s[0] - '0'; // Sの1文字目を数値に変換して代入 for(j=0;j<( strlen(s) - 1 );j++){ if( i & ( 1 << j ) ){ // 例:(i,j)=(0,1) ⇒ (00) AND (10) ans += tmp; //     ⇒ (10) ⇒ 12 + 5 tmp = 0; // 分割した分を足して、tmpを初期化 } tmp = tmp*10 + (s[j+1] - '0'); } ans += tmp; // 最後の分割部分を足す。 } printf("%lld",ans); return 0; }
a.cc:13:45: error: extended character   is not valid in an identifier 13 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:22:20: error: extended character   is not valid in an identifier 22 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:13:45: error: '\U00003000' was not declared in this scope 13 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:22:22: error: expected ';' before '}' token 22 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 23 | } | ~
s437042650
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ char s[11]; scanf("%s",s); int i,j; long long ans=0; long long tmp; // ’+’で分割したものを代入 for(i=0;i<( 1 << ( strlen(s) - 1 ) );i++){ // S="125"なら、i=(00)_2~(11)_2まで。   // strlen(s) にすると、i=(111)_2までになる。 tmp = s[0] - '0'; // Sの1文字目を数値に変換して代入 for(j=0;j<( strlen(s) - 1 );j++){ if( i & ( 1 << j ) ){ // 例:(i,j)=(0,1) ⇒ (00) AND (10) ans += tmp; //     ⇒ (10) ⇒ 12 + 5 tmp = 0; // 分割した分を足して、tmpを初期化 } tmp = tmp*10 + (s[j+1] - '0'); } ans += tmp; // 最後の分割部分を足す。 } printf("%lld",ans); return 0;
a.cc:13:45: error: extended character   is not valid in an identifier 13 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:22:20: error: extended character   is not valid in an identifier 22 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:13:45: error: '\U00003000' was not declared in this scope 13 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:22:22: error: expected ';' before '}' token 22 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 23 | } | ~ a.cc:27:14: error: expected '}' at end of input 27 | return 0; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s938039826
p04001
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; long long sum=0; int n.s.size(); for(int temp=0;temp<(1<<n-1);temp++){ long long t=s[0]-'0'; for(int i=0;i<n-1;i++){ if(temp&(1<<i)){ sum+=t; t=s[i+1]-'0'; }else{ t*=10; t=s[i+1]-'0'; } } sum+=t; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:7:8: error: expected initializer before '.' token 7 | int n.s.size(); | ^ a.cc:8:27: error: 'n' was not declared in this scope 8 | for(int temp=0;temp<(1<<n-1);temp++){ | ^
s505883160
p04001
C++
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; const int MOD = 1000000007; const int INF = numeric_limits<int>::max() / 2; signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string S; cin >> S; int N = S.size(); int ans = 0; for(int i=0;i<(1<<(N-1));i++){ int num = S[0] - '0'; for(int j=0;j<N-1;j++){ if((1<<j) & i){ ans += num; num = S[i+1] - '0' } else{ num *= 10; num += S[i+1] - '0'; } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:29: error: expected ';' before '}' token 22 | num = S[i+1] - '0' | ^ | ; 23 | } | ~
s211078345
p04001
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); ++i ) using namespace std; typedef long long ll; ll stoLL(string str){ int digits = str.length(); ll num = 0; for(const char c : str){ num += (c-48) * pow(10,digits-1); digits--; } return num; } ll splitandsum(string str){ string subStr; ll sum = 0; for(const char c : str){ if(c != '+') subStr += c; else{ ll num = stoLL(subStr); sum += num; subStr.clear(); //中身を空っぽにする } } ll num = stoLL(subStr); sum += num; return sum; } int main(){ string S; cin >> S; ll sum = 0; rep(i,pow(2,S.length()-1)){ //bit全探索 string tmp = S; int inserted_idx = 1; rep(bit,S.length()-1){ if(bit >> j & 1){ tmp.insert(inserted_idx,"+"); inserted_idx += 2; } else inserted_idx++; } sum += splitandsum(tmp); } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:42:17: error: 'j' was not declared in this scope 42 | if(bit >> j & 1){ | ^
s876154284
p04001
C++
#include<bits/stdc++.h> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; int main(){ string s; cin>>s; ll si=sz(s); ll ans=0; for(int bit=0;bit<(1<<n);bit++){ ll cu=0; for(int i=0;i<n;i++){ if(i!=0){ if(bit & (1<<i)){ ans+=cu; cu=0; } } cu*=10; cu+=(s[i]-'0'); } } COUT(ans); }
a.cc: In function 'int main()': a.cc:41:25: error: 'n' was not declared in this scope 41 | for(int bit=0;bit<(1<<n);bit++){ | ^
s601223083
p04001
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; #define rep(i, n) for(ll i=0; i<n; i++) #define Rep(i, j, n) for(ll i=j; i<n; i++) #define all(vec) vec.begin(), vec.end() template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} const ll INF = 1LL << 60; int main() { string s; cin >> s; ll ans = 0; rep(i, (1<<s.size()-1)) { ll cur = s[0] - '0'; rep(j, s.size()-1) { if(i & (1<<j)) { ans += cur; cur = 0; } else cur *= 10; cur += s[j+1] - '0'; //cout << i << ' ' << j << ' ' << cur << ' ' << ans << endl; } ans += cur; } cout << ans << endl; }#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; #define rep(i, n) for(ll i=0; i<n; i++) #define Rep(i, j, n) for(ll i=j; i<n; i++) #define all(vec) vec.begin(), vec.end() template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} const ll INF = 1LL << 60; int main() { string s; cin >> s; ll ans = 0; rep(i, (1<<s.size()-1)) { ll cur = s[0] - '0'; rep(j, s.size()-1) { if(i & (1<<j)) { ans += cur; cur = 0; } else cur *= 10; cur += s[j+1] - '0'; //cout << i << ' ' << j << ' ' << cur << ' ' << ans << endl; } ans += cur; } cout << ans << endl; }#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; #define rep(i, n) for(ll i=0; i<n; i++) #define Rep(i, j, n) for(ll i=j; i<n; i++) #define all(vec) vec.begin(), vec.end() template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} const ll INF = 1LL << 60; int main() { string s; cin >> s; ll ans = 0; rep(i, (1<<s.size()-1)) { ll cur = s[0] - '0'; rep(j, s.size()-1) { if(i & (1<<j)) { ans += cur; cur = 0; } else cur *= 10; cur += s[j+1] - '0'; //cout << i << ' ' << j << ' ' << cur << ' ' << ans << endl; } ans += cur; } cout << ans << endl; }
a.cc:28:2: error: stray '#' in program 28 | }#include <bits/stdc++.h> | ^ a.cc:55:2: error: stray '#' in program 55 | }#include <bits/stdc++.h> | ^ a.cc:28:3: error: 'include' does not name a type 28 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:30:32: error: redefinition of 'const ll MM' 30 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~ a.cc:3:32: note: 'const ll MM' previously defined here 3 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~ a.cc:30:51: error: redefinition of 'll mod' 30 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~~ a.cc:3:51: note: 'll mod' previously defined here 3 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~~ a.cc:34:31: error: redefinition of 'template<class T> bool chmin(T&, T)' 34 | template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} | ^~~~~ a.cc:7:31: note: 'template<class T> bool chmin(T&, T)' previously declared here 7 | template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} | ^~~~~ a.cc:35:31: error: redefinition of 'template<class T> bool chmax(T&, T)' 35 | template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} | ^~~~~ a.cc:8:31: note: 'template<class T> bool chmax(T&, T)' previously declared here 8 | template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} | ^~~~~ a.cc:36:10: error: redefinition of 'const ll INF' 36 | const ll INF = 1LL << 60; | ^~~ a.cc:9:10: note: 'const ll INF' previously defined here 9 | const ll INF = 1LL << 60; | ^~~ a.cc:38:5: error: redefinition of 'int main()' 38 | int main() { | ^~~~ a.cc:11:5: note: 'int main()' previously defined here 11 | int main() { | ^~~~ a.cc:55:3: error: 'include' does not name a type 55 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:57:32: error: redefinition of 'const ll MM' 57 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~ a.cc:3:32: note: 'const ll MM' previously defined here 3 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~ a.cc:57:51: error: redefinition of 'll mod' 57 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~~ a.cc:3:51: note: 'll mod' previously defined here 3 | typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7; | ^~~ a.cc:61:31: error: redefinition of 'template<class T> bool chmin(T&, T)' 61 | template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} | ^~~~~ a.cc:7:31: note: 'template<class T> bool chmin(T&, T)' previously declared here 7 | template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;} | ^~~~~ a.cc:62:31: error: redefinition of 'template<class T> bool chmax(T&, T)' 62 | template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} | ^~~~~ a.cc:8:31: note: 'template<class T> bool chmax(T&, T)' previously declared here 8 | template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;} | ^~~~~ a.cc:63:10: error: redefinition of 'const ll INF' 63 | const ll INF = 1LL << 60; | ^~~ a.cc:9:10: note: 'const ll INF' previously defined here 9 | const ll INF = 1LL << 60; | ^~~ a.cc:65:5: error: redefinition of 'int main()' 65 | int main() { | ^~~~ a.cc:11:5: note: 'int main()' previously defined here 11 | int main() { | ^~~~
s481126577
p04001
C++
#include <algorithm> #include <iostream> #include <set> #include <vector> typedef long long ll; #define _GLIBCXX_DEBUG #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) using namespace std; const ll INF = 1 << 30; const ll INFll = 1ll << 60; ll calc(string s) { ll d = 0; ll sum = 0; for (ll i = 0; i < s.size(); i++) { if (s[i] == '+') { sum += d; d = 0; } else { d *= 10; d += s[i] - '0'; } } sum += d; return sum; } ll msum(string s, ll i) { if (i == s.size()) { return calc(s); } ll sum = 0; if (s[i - 1] != '+') { s.insert(i, "+"); sum += msum(s, i + 2); s.erase(i, 1); } sum += msum(s, i + 1); return sum; } ll main() { string s; cin >> s; if (s.size() == 1) { cout << ll(s[0] - '0') << endl; return 0; } cout << msum(s, 1) << endl; return 0; }
a.cc:43:1: error: '::main' must return 'int' 43 | ll main() { | ^~
s818179844
p04001
C++
#include <algorithm> #include <iostream> #include <set> #include <vector> typedef long long ll; #define _GLIBCXX_DEBUG #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) using namespace std; const int INF = 1 << 30; const ll INFll = 1ll << 60; int calc(string s) { int d = 0; int sum = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '+') { sum += d; d = 0; } else { d *= 10; d = s[i] - '0'; } } sum += d; return sum; } int msum(string s, int i) { if (i == s.size() - 1) { return calc(s); } int sum = 0; char tmp = s[i]; if (s[i - 1] != '+') { s[i] = '+'; sum += msum(s, i + 1); } s[i] = tmp; sum += msum(s, i + 1); return sum; } int main() { string s; cin >> s; if (s.size() == 1) { cout << int(s[0] - '0') << endl; return 0; } cout << msum(s, 1) << endl; return 0;
a.cc: In function 'int main()': a.cc:53:12: error: expected '}' at end of input 53 | return 0; | ^ a.cc:44:12: note: to match this '{' 44 | int main() { | ^
s397900648
p04001
C++
#include <iostream> #include <string> using namespace std; int main(void) { string S; cin >> S; unsigned int len = S.length(); unsigned int bitmax = (unsigned int)pow(2, len-1); long long ans = 0; for (unsigned int i = 0; i <= (bitmax-1); i++) { bool plus_pos[10] = {false}; for (int j = 0; j < 9; j++) { if (((i>>j)&1)==1) { plus_pos[j+1] = true; } else { plus_pos[j+1] = false; } } long long val = 0; for (unsigned int str_pos = 0; str_pos < S.length(); str_pos++) { if (plus_pos[str_pos]) { ans += val; val = 0; } val = val * 10 + (int)((unsigned char)S[str_pos] - (unsigned char)'0'); } ans += val; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:45: error: 'pow' was not declared in this scope 11 | unsigned int bitmax = (unsigned int)pow(2, len-1); | ^~~
s883003686
p04001
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) signed main(){ string S; cin>>S; int N=S.size(),ans=0; rep(i,0,(1<<N-1)){ bitset<10> A(i); int sum=0; string X; X+=S[0]; rep(i,0,N-1){ if(A.test(i)){ sum+=stoi(X); X=null; } X+=S[i+1]; } sum+=stoi(X); ans+=sum; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:26:11: error: 'null' was not declared in this scope 26 | X=null; | ^~~~
s519187004
p04001
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) signed main(){ string S; cin>>S; int N=S.size(),ans=0; rep(i,0,(1<<N-1)){ bitset<10> A(i); int sum=0; string X=(string)S[0]; rep(i,0,N-1){ if(A.test(i)){ sum+=stoi(X); X=(string)S[i+1]; } else X+=S[i+1]; } sum+=stoi(X); ans+=sum; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:21:25: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 21 | string X=(string)S[0]; | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:21:25: note: cannot convert 'S.std::__cxx11::basic_string<char>::operator[](0)' (type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}) to type 'const char*' 21 | string X=(string)S[0]; | ^ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a
s377968558
p04001
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) signed main(){ string S; cin>>S; int N=S.size(),ans=0; rep(i,0,(1<<N-1)){ bitset<10> A(i); int sum=0; string X=S[0]; rep(i,0,N-1){ if(A.test(i)){ sum+=stoi(X); X=S[i+1]; } else X+=S[i+1]; } sum+=stoi(X); ans+=sum; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:21:17: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 21 | string X=S[0]; | ^
s261774751
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long ans = 0; long n = s.length(); for (int bit = 0; bit < (1 << n - 1); bit++) { string save = s[0]; for(int i = 0; i < n - 1; i++) { if (bit & (1 << i)) { ans += stoll(save); save = s[i+1]; } else { save += s[i+1]; } } ans += stoll(save); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:22: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 10 | string save = s[0]; | ^
s186582512
p04001
C++
#include<bits/stdc++.h> using namespace std ; long int keisan(bitset<9> pl){ } int main(){ string s ; cin >> s ; long int str = stoli(s) ; long int sum = 0 ; for(int i=0;i<(1<<s.size())){ bitset<9> pl(i) ; } }
a.cc: In function 'long int keisan(std::bitset<9>)': a.cc:5:1: warning: no return statement in function returning non-void [-Wreturn-type] 5 | } | ^ a.cc: In function 'int main()': a.cc:9:18: error: 'stoli' was not declared in this scope 9 | long int str = stoli(s) ; | ^~~~~ a.cc:11:30: error: expected ';' before ')' token 11 | for(int i=0;i<(1<<s.size())){ | ^ | ;
s742516326
p04001
C++
#include <bits/stdc++.h> using namespace std; int S; int main() { cin >> S; int l = S.size(); int sum = 0; for (int tmp = 0; tmp < (1 << l - 1); tmp++) { int t = S.at(l - 1); for (int i = 0; i < l ; i++) { if ((tmp << i) & 1) { sum += t; } else { t *= 10; } } sum += t; } }
a.cc: In function 'int main()': a.cc:7:13: error: request for member 'size' in 'S', which is of non-class type 'int' 7 | int l = S.size(); | ^~~~ a.cc:10:15: error: request for member 'at' in 'S', which is of non-class type 'int' 10 | int t = S.at(l - 1); | ^~
s154745554
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int sum = 0; for (int tmp = 0; tmp (1 << S.size() - 1); tmp++) { bitset<S.size() - 1> s(tmp); int sum_tmp = 0; for (int i = 0; i < S.size() - 1; i++) { if (s.set(i) == 1) { sum_tmp += 10*S.at(i); } } } }
a.cc: In function 'int main()': a.cc:8:25: error: 'tmp' cannot be used as a function 8 | for (int tmp = 0; tmp (1 << S.size() - 1); tmp++) { | ~~~~^~~~~~~~~~~~~~~~~~~ a.cc:9:18: error: call to non-'constexpr' function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 9 | bitset<S.size() - 1> s(tmp); | ~~~~~~^~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1076:7: note: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' declared here 1076 | size() const _GLIBCXX_NOEXCEPT | ^~~~ a.cc:9:18: error: call to non-'constexpr' function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 9 | bitset<S.size() - 1> s(tmp); | ~~~~~~^~ /usr/include/c++/14/bits/basic_string.h:1076:7: note: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' declared here 1076 | size() const _GLIBCXX_NOEXCEPT | ^~~~ a.cc:9:21: note: in template argument for type 'long unsigned int' 9 | bitset<S.size() - 1> s(tmp); | ~~~~~~~~~^~~ a.cc:12:13: error: request for member 'set' in 's', which is of non-class type 'int' 12 | if (s.set(i) == 1) { | ^~~
s193993221
p04001
C++
s = input() n = len(s) - 1 answers = [] sl = [s[i] for i in range(len(s))] for i in range(2 ** n): tmp = [] for j in range(n): if ((i >> j) & 1): tmp.append(j) ll = ['*']*len(s) for k in tmp: ll[k] = '+' ans = [] for k, _ in zip(sl, ll): ans.append(k) ans.append(_) ans = [_ for _ in ans if _ != '*'] ans = ''.join(ans) ans = ans.split('+') ans = [int(_) for _ in ans if _ != '+'] ans = sum(ans) answers.append(ans) print(sum(answers))
a.cc:18:11: error: empty character constant 18 | ans = ''.join(ans) | ^~ a.cc:1:1: error: 's' does not name a type 1 | s = input() | ^
s913260823
p04001
C
/* submission # - User: herp_sy https://atcoder.jp/contests/ coding: utf-8 lang: C (GCC 5.4.1) */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdbool.h> #define _CRT_SECURE_NO_WARNINGS #define TLong long long #define TBMod 1000000007 TLong getSum(TLong n,TLong i,TLong sum) { if(n / i == 0) return (n + sum); return getSum(n / i, 10, sum + n % i) + getSum(n, i * 10, sum); } int main(int argc, char const *argv[]) { TLong n; scanf("%lld", &n); printf("%lld", sum(n, 10, 0)); return 0; }
main.c: In function 'main': main.c:29:24: error: implicit declaration of function 'sum' [-Wimplicit-function-declaration] 29 | printf("%lld", sum(n, 10, 0)); | ^~~
s025874637
p04001
C
/* submission # - User: herp_sy https://atcoder.jp/contests/ coding: utf-8 lang: C (GCC 5.4.1) */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdbool.h> #define _CRT_SECURE_NO_WARNINGS #define TLong long long #define TBMod 1000000007 TLong sum(TLong n,TLong i,TLong sum) { if(n / i == 0) return (n + sum); return sum(n / i, 10, sum + n % i) + sum(n, i * 10, sum); } int main(int argc, char const *argv[]) { TLong n; scanf("%lld",&n); printf("%lld", sum(n, 10, 0)); return 0; }
main.c: In function 'sum': main.c:22:16: error: called object 'sum' is not a function or function pointer 22 | return sum(n / i, 10, sum + n % i) + sum(n, i * 10, sum); | ^~~ main.c:19:33: note: declared here 19 | TLong sum(TLong n,TLong i,TLong sum) | ^ main.c:22:46: error: called object 'sum' is not a function or function pointer 22 | return sum(n / i, 10, sum + n % i) + sum(n, i * 10, sum); | ^~~ main.c:19:33: note: declared here 19 | TLong sum(TLong n,TLong i,TLong sum) | ^
s105637606
p04001
C
/* submission # - User: herp_sy https://atcoder.jp/contests/ coding: utf-8 lang: C (GCC 5.4.1) */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <stdbool.h> #define _CRT_SECURE_NO_WARNINGS #define TLong long long #define TBMod 1000000007 TLong sum(TLong n,TLong i,TLong sum) { if(n / i == 0) return (n + sum); return sum(n / i, 10, sum + n % i) + cal_sum(n, i * 10, sum); } int main(int argc, char const *argv[]) { TLong n; scanf("%lld",&n); printf("%lld", sum(n, 10, 0)); return 0; }
main.c: In function 'sum': main.c:22:16: error: called object 'sum' is not a function or function pointer 22 | return sum(n / i, 10, sum + n % i) + cal_sum(n, i * 10, sum); | ^~~ main.c:19:33: note: declared here 19 | TLong sum(TLong n,TLong i,TLong sum) | ^ main.c:22:46: error: implicit declaration of function 'cal_sum' [-Wimplicit-function-declaration] 22 | return sum(n / i, 10, sum + n % i) + cal_sum(n, i * 10, sum); | ^~~~~~~
s870559726
p04001
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var S = Console.ReadLine(); Console.WriteLine(Plus(S,0)); } static long Plus(string s ,long n) { long retnum = 0; if(s.Length == 1) { return n + long.Parse(s); } retnum = n + long.Parse(s); for(int i =1; i < s.Length; i++) { retnum += Plus(s.Substring(i), n+long.Parse(s.Substring(0,i))); } return retnum; } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.Threading.Tasks; | ^~~~~~ a.cc:11:26: error: 'string' has not been declared 11 | static void Main(string[] args) | ^~~~~~ a.cc:11:35: error: expected ',' or '...' before 'args' 11 | static void Main(string[] args) | ^~~~ a.cc:18:26: error: 'string' has not been declared 18 | static long Plus(string s ,long n) | ^~~~~~ a.cc:36:6: error: expected ';' after class definition 36 | } | ^ | ; a.cc: In static member function 'static void ConsoleApp1::Program::Main(int*)': a.cc:13:13: error: 'var' was not declared in this scope 13 | var S = Console.ReadLine(); | ^~~ a.cc:14:13: error: 'Console' was not declared in this scope 14 | Console.WriteLine(Plus(S,0)); | ^~~~~~~ a.cc:14:36: error: 'S' was not declared in this scope 14 | Console.WriteLine(Plus(S,0)); | ^ a.cc: In static member function 'static long int ConsoleApp1::Program::Plus(int, long int)': a.cc:21:18: error: request for member 'Length' in 's', which is of non-class type 'int' 21 | if(s.Length == 1) | ^~~~~~ a.cc:23:28: error: expected primary-expression before 'long' 23 | return n + long.Parse(s); | ^~~~ a.cc:23:28: error: expected ';' before 'long' a.cc:23:32: error: expected unqualified-id before '.' token 23 | return n + long.Parse(s); | ^ a.cc:26:26: error: expected primary-expression before 'long' 26 | retnum = n + long.Parse(s); | ^~~~ a.cc:28:33: error: request for member 'Length' in 's', which is of non-class type 'int' 28 | for(int i =1; i < s.Length; i++) | ^~~~~~ a.cc:30:34: error: request for member 'Substring' in 's', which is of non-class type 'int' 30 | retnum += Plus(s.Substring(i), n+long.Parse(s.Substring(0,i))); | ^~~~~~~~~ a.cc:30:50: error: expected primary-expression before 'long' 30 | retnum += Plus(s.Substring(i), n+long.Parse(s.Substring(0,i))); | ^~~~
s877802159
p04001
C++
#include <iostream> #include<vector> #include<algorithm> #include <queue> #include <string> #include <set> #include <bitset> using namespace std; #define ff(i,n,m) for(int i=n;i<m;i++) #define i64 int64_t #define tos(x) to_string(x) int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } int main() { string s; cin >> s; vector<int> a(s.size()+1); int ans = 0; ff(i, 0, s.size()) { a.at(i) = ctoi(s.at(i)); } ff(i, 0, 1 << s.size()-1) { bitset<9> data(i); ff(j, 0, s.size()) { int x = 0; ff(k, j, s.size()-1) { if (!data.test(k)) { x++; } else { break; } } ans += a.at(j) * pow(10, x); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:41:42: error: 'pow' was not declared in this scope 41 | ans += a.at(j) * pow(10, x); | ^~~
s393283917
p04001
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String S = scanner.nextLine(); scanner.close(); int length = S.length(); long total = 0; // bit全探索 // 集合 (1, 2, 3) の部分集合(1, 12, 123 など) の種類で回す (2のn乗 == Math.pow(2, S)) for (int i = 0; i < (1 << length - 1); i++) { String first = String.valueOf(S.charAt(0)); StringBuilder sb = new StringBuilder(first); for (int j = 0; j < length - 1; j++) { if (((i >> j) & 1) == 1) { // 間に+を挿入 sb.append("+"); } sb.append(S.charAt(j + i)); } String[] ss = sb.toString().split("\\+"); for (String s : ss) { total += Long.parseLong(s); } } System.out.println(total); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s969658483
p04001
C++
include<bits/stdc++.h> using namespace std; using ll =long long; #define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i) #define rep(i,n) REP(i,0,n) #define SORT(i) sort((i).begin(),(i).end()) constexpr int INF = 2000000000; constexpr int mod = 1000000007; int main() { string s; cin >> s; ll ans = 0; rep(bit, (1 << (s.size() - 1))) { ll a = s[0] - '0'; rep(i, s.size() - 1) { if (bit & (1 << i)) { ans += a; a = 0; } a = a * 10 + s[i + 1] - '0'; } ans += a; } cout << ans << "\n"; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:11:9: error: 'string' was not declared in this scope 11 | string s; cin >> s; | ^~~~~~ a.cc:11:19: error: 'cin' was not declared in this scope 11 | string s; cin >> s; | ^~~ a.cc:11:26: error: 's' was not declared in this scope 11 | string s; cin >> s; | ^ a.cc:24:9: error: 'cout' was not declared in this scope 24 | cout << ans << "\n"; | ^~~~
s449312351
p04001
C++
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); long n = Long.valueOf(s); System.out.println(dfs(n,1,0)); } static long dfs(long n, int m, long sum) {//mは何桁目まで調べたか if(NumberOfDigit(n) == m) { return sum + n; } sum = dfs(n,m+1,sum); sum = (int)Math.pow(2, NumberOfDigit(n)-m-1) * (n%(int)Math.pow(10,m)) + dfs(n/(int)Math.pow(10,m),1,sum); return sum; } static int NumberOfDigit(long num) { int i = 0; while(num != 0) { num /= 10; i++; } return i; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:15: error: expected ':' before 'static' 4 | public static void main(String[] args) { | ^~~~~~~ | : a.cc:4:33: error: 'String' has not been declared 4 | public static void main(String[] args) { | ^~~~~~ a.cc:4:42: error: expected ',' or '...' before 'args' 4 | public static void main(String[] args) { | ^~~~ a.cc:34:2: error: expected ';' after class definition 34 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:5:17: error: 'Scanner' was not declared in this scope 5 | Scanner scan = new Scanner(System.in); | ^~~~~~~ a.cc:7:17: error: 'String' was not declared in this scope 7 | String s = scan.next(); | ^~~~~~ a.cc:8:26: error: 'Long' was not declared in this scope; did you mean 'long'? 8 | long n = Long.valueOf(s); | ^~~~ | long a.cc:8:39: error: 's' was not declared in this scope 8 | long n = Long.valueOf(s); | ^ a.cc:10:17: error: 'System' was not declared in this scope 10 | System.out.println(dfs(n,1,0)); | ^~~~~~ a.cc: In static member function 'static long int Main::dfs(long int, int, long int)': a.cc:21:28: error: 'Math' was not declared in this scope 21 | sum = (int)Math.pow(2, NumberOfDigit(n)-m-1) * (n%(int)Math.pow(10,m)) + dfs(n/(int)Math.pow(10,m),1,sum); | ^~~~
s481349920
p04001
C++
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); long n = Long.valueOf(s); System.out.println(dfs(n,1,0)); } static long dfs(long n, int m, long sum) {//mは何桁目まで調べたか if(NumberOfDigit(n) == m) { return sum + n; } sum = dfs(n,m+1,sum); sum = (int)Math.pow(2, NumberOfDigit(n)-m-1) * (n%(int)Math.pow(10,m)) + dfs(n/(int)Math.pow(10,m),1,sum); return sum; } static int NumberOfDigit(long num) { int i = 0; while(num != 0) { num /= 10; i++; } return i; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main{ | ^~~~~~
s986786091
p04001
C++
#include <bits/stdc++.h> using namespace std; long long ManyFormula(long long S, long long head, long long cnt){ long long sum = 0; if(cnt == 1){ return 0; } else{ for(long long i=1; i < cnt; i++){ long long cnt_next=0; long long S_next = S % (long long)pow(10, cnt - i); long long head_next = head + S / (long long)pow(10, cnt - i); for(long long j=0; j < S_next; j++){ if(S_next / (long long)pow(10, j) == 0){ break; } cnt_next++; } // cout << S << " " << S_next << " " << head_next << " " << cnt_next << " " << sum << endl; if(cnt_next == 1){ sum += S_next + head_next; } else{ sum += S_next + head_next + ManyFormula(S_next, head_next, cnt_next); } } } return sum; } long long main() { long long S = 0; cin >> S; long long cnt = 0; for(long long i=0; i < S; i++){ if(S / (long long)pow(10, i) == 0){ break; } cnt++; // 125 : 3 } long long sum = S; long long head=0; sum += ManyFormula(S, head, cnt); cout << sum << endl; }
cc1plus: error: '::main' must return 'int'
s016756919
p04001
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<int> vint; typedef pair<int, int> pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) int main() { string s; cin >> s; ll sum=0; rep(i,1 << s.size()-1){ int next=0,count=1; for (int j=0; j < s.size()-1;j++){ s2=s; if ( i & 1 << j){ sum+=stoll(s.substr(next,count)); next=j+1; count=1; }else{ count++; } } sum+=stoll(s.substr(next)); } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:11: error: 's2' was not declared in this scope; did you mean 's'? 20 | s2=s; | ^~ | s
s692034766
p04001
C++
S = int(input()) numbers = str(S) L = len(numbers) prev = 0 for bit in range(1<<L-1): now = int(numbers[0]) for i in range(L-1): if bit & (1<<i): prev += now now = int(numbers[i+1]) else: now = now * 10 + int(numbers[i+1]) prev += now print(prev)
a.cc:1:1: error: 'S' does not name a type 1 | S = int(input()) | ^
s270172362
p04001
C++
#include "stdafx.h" #include <iostream> #include <string> #include <vector> #include <algorithm> //#include <bits/stdc++.h> using namespace std; // +を入れるか入れないかを分岐させて再帰する関数 void ReFunc(vector<int> vec, int place, int left, int right, long long &sum) { // 最後まで終わったら算出する。 if (place == vec.size() - 1) { sum += left + right; } else { //足し算の場合、今考えている左辺と右辺を足して左辺を作り、次を右辺とする(例:123)の場合、(vec, 1, 1, 2)→(vec, 2, 3, 3) ReFunc(vec, place + 1, left + right, vec.at(place + 1), sum); //なしの場合、今考えている左辺はそのままにして、右辺を10倍して次の右辺に足して、次の演算を行う (vec, 1, 0, 12)→(vec, 2, 0, 123) ReFunc(vec, place + 1, left, right * 10 + vec.at(place + 1), sum); } } int main() { string S; cin >> S; vector<int> vec(S.size()); for (int i = 0; i < S.size(); i++) { vec.at(i) = S.at(i) - '0'; } long long sum = 0; ReFunc(vec, 0, 0, vec.at(0), sum); cout << sum << endl; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s347796490
p04001
C++
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <functional> #include <iomanip> #include <stdlib.h> #include <string.h> #include <cstring> #include <cmath> #include <map> #include <queue> #include <deque> #include <stack> #include <set> #include <stdio.h> #include <tuple> #include <bitset> #include <cfloat> #include <fstream> #include <limits.h> #include <list> #include <math.h> #include <random> #include <unordered_map> #include <unordered_set> #include <bitset> #include <numeric> #include <utility> #include <sstream> #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define FORR(i,a,b)for(int i=(a);i<=(b);i++) #define repR(i,n) for(int i=n;i>=0;i--) #define P pair<int, int> #define sz(x) x.size() #define ALL(x) (x).begin(),(x).end() #define ALLR(x) (x).rbegin(),(x).rend() #define VE vector<int> #define COUT(x) cout<<(x)<<endl #define MA map<int,int> #define SE set<int> #define PQ priority_queue #define COUT(x) cout<<(x)<<endl #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; typedef long long ll; using Graph = vector<vector<int>>; ll gcd(ll a, ll b) { if (a < b)swap(a, b); if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; } bool prime(int n) { for (int i = 2; i <= sqrt(n); i++) { if (n%i == 0)return false; } return n != 1; } const long long MOD = 1000000007; const long long INF = 1LL << 50; // pair -> vector<pair<int,int>> // AandB.push_back(make_pair(a[i],b[i])) int n; int s[10]; int ans = 0; void dfs(int i, int sum, int now) { if (i == n - 1) { ans += sum + now; } else { dfs(i + 1, sum + now, s[i + 1]); dfs(i + 1, sum, now * 10 + s[i + 1]); } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); string str; cin >> str; n = str.size(); rep(i, n){ s[i] = str[i] - '0'; } dfs(0, 0, s[0]); cout << ans << endl; return 0; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); string str; cin >> str; n = str.size(); rep(i, n){ s[i] = str[i] - '0'; } dfs(0, 0, s[0]); cout << ans << endl; return 0; }
a.cc:116:1: error: expected declaration before '}' token 116 | } | ^ a.cc:118:8: error: redefinition of 'int main()' 118 | signed main() { | ^~~~ a.cc:104:8: note: 'int main()' previously defined here 104 | signed main() { | ^~~~
s978874598
p04001
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) typedef long long ll; using vi=vector<int>; using vvi=vector<vector<int>>; void chmin(int a,int b){if(b<a)a=b;} void chmax(int a,int b){if(a<b)a=b;} int ans,n; int a[11]; void dfs(int i,int sum,int s){ ans+=sum; s*=10; if(i<n-1){ dfs(i+1,sum+s*9,s+a[i]); dfs(i+1,0,0); } } int main(){ string s;cin>>s;n=s.size(); int d=stoi(s); rep(i,n){ sum+=d%10; a[n-i-1]=d%10; d/=10; } ans=sum; dfs(0,sum,0); }
a.cc: In function 'int main()': a.cc:24:5: error: 'sum' was not declared in this scope 24 | sum+=d%10; | ^~~ a.cc:28:7: error: 'sum' was not declared in this scope 28 | ans=sum; | ^~~
s876258278
p04001
C++
#include <stdio.h> #include <string> #include <bits/stdc++.h> using namespace std; int sum(string S) { int a,b; a = S.size(); if (a >= 2){ for (int i=0; i<a-1; ++i) { string c = S.substr(0,i+1); int d; sscanf(c.c_str(),"%d",&d); b += d+sum(S.substr(i+1)); } } else if (S == "1") { b = 1; } else if (S == "2") { b = 2; } else if (S == "3") { b = 3; } else if (S == "4") { b = 4; } else if (S == "5") { b = 5; } else if (S == "6") { b = 6; } else if (S == "7") { b = 7; } else if (S == "8") { b = 8; } else if (S == "9") { b = 9; } return b; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s445148989
p04001
C++
#include <bits/stdc++.h> #include <stdio.h> #include <string> using namespace std; int sum(string S) { int a,b; a = S.size(); if (a >= 2){ for (int i=0; i<a-1; ++i) { string c = S.substr(0,i+1); int d = atoi(c.c_str()); b += d+sum(S.substr(i+1)); } } else if (S == "1") { b = 1; } else if (S == "2") { b = 2; } else if (S == "3") { b = 3; } else if (S == "4") { b = 4; } else if (S == "5") { b = 5; } else if (S == "6") { b = 6; } else if (S == "7") { b = 7; } else if (S == "8") { b = 8; } else if (S == "9") { b = 9; } return b; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s182672373
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum(string S) { int a,b; a = S.size(); if (a >= 2){ for (int i=0; i<a-1; ++i) { string c = S.substr(0,i+1); int d = atoi(c.c_str()); b += d+sum(S.substr(i+1)); } } else if (S == "1") { b = 1; } else if (S == "2") { b = 2; } else if (S == "3") { b = 3; } else if (S == "4") { b = 4; } else if (S == "5") { b = 5; } else if (S == "6") { b = 6; } else if (S == "7") { b = 7; } else if (S == "8") { b = 8; } else if (S == "9") { b = 9; } return b; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s581913508
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int n = s.size(); long long ans = 0; for(int bit = 0; i < (1 << n-1); bit++){ int l = 0; for(int r = 0; r < n; r++){ if(r == n-1){ ans += stoll(s.substr(l, r-l+1)); } else if(bit & (1 << r)){ ans += stoll(s.substr(l, r-l+1)); l = r+1; } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:22: error: 'i' was not declared in this scope 10 | for(int bit = 0; i < (1 << n-1); bit++){ | ^