submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s154109144
p03999
C++
#include <iostream> #include <vector> #include <string> #include <cmath> #include <cstdlib> using namespace std; int main(){ string str_input; cin >> str_input; long long result_sum = 0; for(int bit = 0; bit < (1 << (str_input.size()-1)); bit++){ vector<long long> num_list; vector <bool> add_opp(str_input.size()-1, false); for(unsigned int i = 0; i < add_opp.size(); i++){ if(bit & (1 << i)) { add_opp[i] = true; } } unsigned int start_digit = 0; unsigned int digit_len = 1; for(unsigned int k = 0; k < add_opp.size(); k++) { if(k == add_opp.size() - 1) { if(add_opp[k] == true) { result_sum += atoll(str_input.substr(start_digit, digit_len).c_str()); start_digit = k+1; } result_sum += atoll(str_input.substr(start_digit).c_str()); continue; } if(add_opp[k] == false) { digit_len++; continue; } result_sum += atoll(str_input.substr(start_digit, digit_len).c_str()); start_digit = k+1; digit_len = 1; } } cout << result_sum << endl; return 0;
a.cc: In function 'int main()': a.cc:47:14: error: expected '}' at end of input 47 | return 0; | ^ a.cc:8:11: note: to match this '{' 8 | int main(){ | ^
s743022467
p03999
C++
s=input() n=len(s) ans=0 for i in range(1<<(n-1)): tmp=int(s[0]) for j in range(n-1): if (i&(1<<j)): tmp*=10 tmp+=int(s[j+1]) else: ans+=tmp tmp=int(s[j+1]) ans+=tmp print(ans)
a.cc:1:1: error: 's' does not name a type 1 | s=input() | ^
s545607946
p03999
C++
#include <iostream> using namespace std; int main(){ string S; cin >> S; int n = S.size(); int ans = S-'0'; printf("%d", ans); /* for(int bit=0; bit<<(1<<n); bit++){ for(int i=0; i<n; i++){ } } */ }
a.cc: In function 'int main()': a.cc:7:14: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 7 | int ans = S-'0'; | ~^~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 7 | int ans = S-'0'; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 7 | int ans = S-'0'; | ^~~
s109524768
p03999
C++
#include <stdio.h> #include <stdlib.h> #include <string.h> 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:14:45: error: extended character   is not valid in an identifier 14 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:23:20: error: extended character   is not valid in an identifier 23 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:14:45: error: '\U00003000' was not declared in this scope 14 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:23:22: error: expected ';' before '}' token 23 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 24 | } | ~
s374731030
p03999
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; long long ans=0LL; // long long(でかい整数)は0LLで初期化 for(int i=0; i<(1<<S.size()-1); ++i){ // bit全探索 string tmp = ""; tmp += s[0]; for(int j=0; j<S.size()-1; ++j){ // jはiと同じだけ回す // 例えばbitset<4>に対しi=3を表示するなら0011になるが、これはj=1,3の時に引っかかりif内の処理が行われる if((i&(1<<j) != 0){ tmp += "+"; tmp += S[j+1]; }else{ tmp += S[j+1]; } } long long ad = 0; for(int j=0; j<tmp.size(); ++j){ if(tmp[j] == '+'){ ans += ad; ad = 0; }else{ ad = 10*ad + (tmp[j] - '0'); // - '0'でsting型をint型に変換 if(j == tmp.size()-1) ans += ad; // 最後まできたら足す(12+13なら3に引っかかったところで13が足される) } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:16: error: 's' was not declared in this scope 11 | tmp += s[0]; | ^ a.cc:15:31: error: expected ')' before '{' token 15 | if((i&(1<<j) != 0){ | ~ ^ | ) a.cc:21:9: error: expected primary-expression before '}' token 21 | } | ^
s805414491
p03999
C++
#include <bits/stdc++.h using namespace std; int N; string s; long long res; void calc(long long p, long long q){ long long ret = 0; if(p == N){ res += q; return; } for(int i=p; i<N; ++i){ ret = 10*ret + (s[i] - '0'); calc(i+1, q+ret); } return; } int main(){ ios_base::sync_with_stdio(false); cin >> s; N = s.length(); calc(0, 0); cout << res << "\n"; return 0; }
a.cc:1:24: error: missing terminating > character 1 | #include <bits/stdc++.h | ^
s270357323
p03999
C++
#include <iostream> #include <sstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <ctime> #include <cstring> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <bitset> #include <numeric> #include <utility> #include <iomanip> #include <algorithm> #include <functional> #include <unordered_map> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v.begin(), v.end()) #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) { return s << '<' << P.first << ", " << P.second << '>'; } template<class T> ostream& operator << (ostream &s, vector<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template<class T> ostream& operator << (ostream &s, set<T> P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } typedef long long ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) void algo( string & s, int pocz, long long sum ) { if( pocz>=s.size() ) return; long long n=0, x=0; for( int i=pocz; i<s.size(); i++ ) { n=n*10+s[i]-'0'; algo( s, i+1, sum+n ); } wy+=sum+n; } int main() { string s; cin >> s; algo( s, 0, 0 ); cout << wy; return 0; }
a.cc: In function 'void algo(std::string&, int, long long int)': a.cc:55:5: error: 'wy' was not declared in this scope 55 | wy+=sum+n; | ^~ a.cc: In function 'int main()': a.cc:63:13: error: 'wy' was not declared in this scope 63 | cout << wy; | ^~
s748401397
p03999
C++
#include <iostream> #include <sstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <ctime> #include <cstring> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <bitset> #include <numeric> #include <utility> #include <iomanip> #include <algorithm> #include <functional> #include <unordered_map> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v.begin(), v.end()) #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) { return s << '<' << P.first << ", " << P.second << '>'; } template<class T> ostream& operator << (ostream &s, vector<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template<class T> ostream& operator << (ostream &s, set<T> P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } typedef long long ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) void algo( string & s, int pocz, long long sum ) { if( pocz>=s.size() ) return; long long n=0, x=0; for( int i=pocz; i<s.size(); i++ ) { n=n*10+s[i]-'0'; algo( s, i+1, sum+n ); } wy+=sum+n; } int main() { string s; cin >> s; algo( s, 0, 0 ); cout << wy; return 0; } #include <iostream> using namespace std; long long wy; void algo( string & s, int pocz, long long sum ) { if( pocz>=s.size() ) return; long long n=0, x=0; for( int i=pocz; i<s.size(); i++ ) { n=n*10+s[i]; algo( s, i+1, sum+n ); } wy+=sum+n; } int main() { string s; cin >> s; algo( s, 0, 0 ); cout << wy; return 0; }
a.cc: In function 'void algo(std::string&, int, long long int)': a.cc:55:5: error: 'wy' was not declared in this scope 55 | wy+=sum+n; | ^~ a.cc: In function 'int main()': a.cc:63:13: error: 'wy' was not declared in this scope 63 | cout << wy; | ^~ a.cc: At global scope: a.cc:72:6: error: redefinition of 'void algo(std::string&, int, long long int)' 72 | void algo( string & s, int pocz, long long sum ) { | ^~~~ a.cc:47:6: note: 'void algo(std::string&, int, long long int)' previously defined here 47 | void algo( string & s, int pocz, long long sum ) { | ^~~~ a.cc:83:5: error: redefinition of 'int main()' 83 | int main() | ^~~~ a.cc:58:5: note: 'int main()' previously defined here 58 | int main() | ^~~~
s446645031
p03999
C++
#include <iostream> using namespace std; string s; long long dfs(int n,long long nw,long long tmp){ long long ans = nw + tmp * 10 + (s[n] - '0'); if(s.size()-1 == n){ return ans; } return (long long)dfs(n + 1, ans, 0) + dfs(n + 1, nw, ans - nw)); } int main() { cin >> s; cout << (long long)dfs(0 ,0 ,0) << endl; }
a.cc: In function 'long long int dfs(int, long long int, long long int)': a.cc:12:66: error: expected ';' before ')' token 12 | return (long long)dfs(n + 1, ans, 0) + dfs(n + 1, nw, ans - nw)); | ^ | ; a.cc:12:66: error: expected primary-expression before ')' token
s505291402
p03999
C++
#define ipair pair<int,int> #define rep(I,N) for(int I=0; I<N; I++) #define rrep(I,N) for(int I=N; I>=0; I--) #define repj(i,j,n) for(int i=j;i<n;i++) #define PB(a,i) (a).push_back(i) #define ALL(a) (a).begin(),(a).end() #define OK(i) cout<<"OK "<<i<<endl #define Yes cout<<"Yes"<<endl #define YES cout<<"YES"<<endl #define No cout<<"No"<<endl #define NO cout<<"NO"<<endl int main() { char s[11]; cin >> s; int N = strlen(s); long res = 0; rep(i, 1 << (N-1)) { long sm = 0; long a = s[0] - '0'; rep(j, N-1) { if (i & (1 << j)) { sm += a; a = 0; } a = a * 10 + (s[j+1] - '0'); } sm += a; res += sm; } printf("%ld\n", res); return 0; }
a.cc: In function 'int main()': a.cc:17:3: error: 'cin' was not declared in this scope 17 | cin >> s; | ^~~ a.cc:18:11: error: 'strlen' was not declared in this scope 18 | int N = strlen(s); | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | #define ipair pair<int,int> a.cc:35:3: error: 'printf' was not declared in this scope 35 | printf("%ld\n", res); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #define ipair pair<int,int>
s642589901
p03999
C++
s = input().rstrip() length = len(s) - 1 ans = 0 for i in range(2**length): val = 0 nums = s[:] prev_j = 0 for j in range(length): if i >> j & 1: val += int(nums[prev_j:j+1]) prev_j = j+1 val += int(nums[prev_j:]) ans += val print(ans)
a.cc:1:1: error: 's' does not name a type 1 | s = input().rstrip() | ^
s815903248
p03999
C
#include<iostream> #include<bitset> using namespace std; int main(){ string s; cin>>s; bitset<9>b(0); long ans=0,l,r; for(int i=0;i<(1<<s.size()-1);i++){ b=i; l=0,r=1; for(int i=0;i<s.size();i++,r++,b>>=1)if(b[0])ans+=stol(s.substr(l,r-l)),l=r; ans+=stol(s.substr(l,r-l)); } cout<<ans<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s690151748
p03999
C++
lude <iostream> #include <string> #include <algorithm> #include <cmath> using namespace std; long dfs(const string& s, long& g) { cout << s << endl; if(s.size() == 1) return stol(s); g++; long sum = stol(s) * g; for (int i = 1; i < s.size(); ++i ) { g++; cout << sum << endl; sum += dfs(s.substr(i, s.size() - i), g); sum += stol(s.substr(0,i)) * g; cout << sum << endl; } return sum; } int main() { string s; cin >> s; cout << dfs(s, 0) << endl; return 0; }
a.cc:1:1: error: 'lude' does not name a type 1 | lude <iostream> | ^~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type 198 | _GLIBCXX14_CONSTEXPR std::size_t |
s801412334
p03999
C
#include <iostream> #include <string> #include <cmath> using namespace std; typedef long long ll; string s; ll Sum(int pre, int now, ll sum) { ll ans = 0; for (int i = 0; i < now - pre; i++) ans += (s[now - i] - '0')*ll(pow(10, i)); if (now == s.size() - 1) return ans + sum; return Sum(pre, now + 1, sum) + Sum(now, now + 1, sum + ans); } int main(void) { cin >> s; cout << Sum(-1, 0, 0) << "\n"; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s574938352
p03999
C++
#include <iostream> #include <string> using namespace std; typedef long long ll; string s; ll Sum(int pre, int now, ll sum) { ll ans = 0; for (int i = 0; i < now - pre; i++) ans += (s[now - i] - '0')*ll(pow(10, i)); if (now == s.size() - 1) return ans + sum; return Sum(pre, now + 1, sum) + Sum(now, now + 1, sum + ans); } int main(void) { cin >> s; cout << Sum(-1, 0, 0) << "\n"; return 0; }
a.cc: In function 'll Sum(int, int, ll)': a.cc:12:46: error: 'pow' was not declared in this scope; did you mean 'now'? 12 | ans += (s[now - i] - '0')*ll(pow(10, i)); | ^~~ | now
s953355973
p03999
C++
// 挑戦中なので、わざと間違っている
/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
s967935810
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll ans = 0; ll tmp; for(int i = 0; i< (1 << n); i++){ tmp = s[0] - '0'; for(int j = 0; j < n; j++){ if( i & ( 1 << j )){  ans += tmp;  tmp = 0; } tmp = tmp*10 + (s[j+1] - '0'); } ans += tmp; } cout << ans << endl; }
a.cc:131:15: error: extended character   is not valid in an identifier 131 |  ans += tmp; | ^ a.cc:132:15: error: extended character   is not valid in an identifier 132 |  tmp = 0; | ^ a.cc: In function 'int main()': a.cc:131:15: error: '\U00003000ans' was not declared in this scope 131 |  ans += tmp; | ^~~~~ a.cc:132:15: error: '\U00003000tmp' was not declared in this scope 132 |  tmp = 0; | ^~~~~
s442292370
p03999
C
#include <stdio.h> #include <stdlib.h> #include <string.h> 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; }
main.c: In function 'main': main.c:14:45: error: stray '\343' in program 14 | <U+3000> // strlen(s) <U+306B><U+3059><U+308B><U+3068><U+3001>i=(111)_2<U+307E><U+3067><U+306B><U+306A><U+308B><U+3002> | ^~~~~~~~ main.c:23:20: error: stray '\343' in program 23 | ans += tmp;<U+3000>// <U+6700><U+5F8C><U+306E><U+5206><U+5272><U+90E8><U+5206><U+3092><U+8DB3><U+3059><U+3002> | ^~~~~~~~
s952128400
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll ans = 0; ll tmp; // ’+’で分割したものを代入 for(int i = 0; i< (1 << n); i++){ //S="125"なら、i=(00)_2~(11)_2まで。 tmp = s[0] - '0';// Sの1文字目を数値に変換して代入 for(int j = 0; j < n; 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; // 最後の分割部分を足す。 } cout << ans << endl; }
a.cc:132:15: error: extended character   is not valid in an identifier 132 |  ans += tmp; //     ⇒ (10) ⇒ 12 + 5 | ^ a.cc:133:15: error: extended character   is not valid in an identifier 133 |  tmp = 0; // 分割した分を足して、tmpを初期化 | ^ a.cc:137:20: error: extended character   is not valid in an identifier 137 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:132:15: error: '\U00003000ans' was not declared in this scope 132 |  ans += tmp; //     ⇒ (10) ⇒ 12 + 5 | ^~~~~ a.cc:133:15: error: '\U00003000tmp' was not declared in this scope 133 |  tmp = 0; // 分割した分を足して、tmpを初期化 | ^~~~~ a.cc:137:20: error: '\U00003000' was not declared in this scope 137 | ans += tmp; // 最後の分割部分を足す。 | ^~
s608426457
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll ans = 0; ll tmp; // ’+’で分割したものを代入 for(int i = 0; i< (1 << n); i++){ // S="125"なら、i=(00)_2~(11)_2まで。   // strlen(s) にすると、i=(111)_2までになる。 tmp = s[0] - '0'; // Sの1文字目を数値に変換して代入 for(int j = 0; j < n; 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; // 最後の分割部分を足す。 } cout << ans << endl; }
a.cc:129:45: error: extended character   is not valid in an identifier 129 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:138:20: error: extended character   is not valid in an identifier 138 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:129:45: error: '\U00003000' was not declared in this scope 129 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:138:22: error: expected ';' before '}' token 138 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 139 | } | ~
s190881188
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll ans = 0; ll tmp; // ’+’で分割したものを代入 for(int i = 0; i< (1 << n); i++){ // S="125"なら、i=(00)_2~(11)_2まで。   // strlen(s) にすると、i=(111)_2までになる。 tmp = s[0] - '0'; // Sの1文字目を数値に変換して代入 for(int j = 0; j < n; 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; // 最後の分割部分を足す。 } cout << ans << endl; }
a.cc:129:45: error: extended character   is not valid in an identifier 129 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:138:20: error: extended character   is not valid in an identifier 138 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:129:45: error: '\U00003000' was not declared in this scope 129 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:138:22: error: expected ';' before '}' token 138 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 139 | } | ~
s948058691
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll ans = 0; ll tmp; // ’+’で分割したものを代入 for(i = 0; i< (1 << n); i++){ // S="125"なら、i=(00)_2~(11)_2まで。   // strlen(s) にすると、i=(111)_2までになる。 tmp = s[0] - '0'; // Sの1文字目を数値に変換して代入 for(j = 0; j < n; 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; // 最後の分割部分を足す。 } cout << ans << endl; }
a.cc:129:45: error: extended character   is not valid in an identifier 129 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:138:20: error: extended character   is not valid in an identifier 138 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:128:9: error: 'i' was not declared in this scope 128 | for(i = 0; i< (1 << n); i++){ // S="125"なら、i=(00)_2~(11)_2まで。 | ^ a.cc:129:45: error: '\U00003000' was not declared in this scope 129 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:131:13: error: 'j' was not declared in this scope 131 | for(j = 0; j < n; j++){ | ^ a.cc:138:22: error: expected ';' before '}' token 138 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 139 | } | ~
s701354809
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll sum = 0; // {0, 1, ..., n-1} の部分集合の全探索 for (int bit = 0; bit < (1<<n); ++bit) { int l = 0; ll tmp = 0; for (int r = 0; r < n; ++r) { if (bit & (1<<r)) { // i が bit に入るかどうか string t = s.substr(l, r - l + 1); ll num = stoll(t); tmp += num; l = r + 1; } } string t = s.substr(l, r - l + 1); ll num = stoll(t); tmp += num; sum += tmp; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:140:32: error: 'r' was not declared in this scope 140 | string t = s.substr(l, r - l + 1); | ^
s407469554
p03999
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(){ string s; cin >> s; int n = s.size()-1; ll sum = 0; // {0, 1, ..., n-1} の部分集合の全探索 for (int bit = 0; bit < (1<<n); ++bit) { int l = 0; ll tmp = 0; for (int r = 0; r < n; ++r) { if (bit & (1<<i)) { // i が bit に入るかどうか string t = s.substr(l, r - l + 1); ll num = stoll(t); tmp += num; l = r + 1; } } } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:133:26: error: 'i' was not declared in this scope 133 | if (bit & (1<<i)) { // i が bit に入るかどうか | ^
s861658802
p03999
Java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) throws IOException { new Main().solve(); } private void solve() throws IOException { try { // solveA(); // solveB(); solveC(); // solveD(); // solveE(); // solveF(); } finally { if (in != null) { in.close(); } if (out != null) { out.flush(); out.close(); } } } private void solveA() { int numA = nextInt(); int numB = nextInt(); int numH = nextInt(); out.println((numA + numB) * numH / 2); } private void solveB() { char[] a = next().toCharArray(); char[] b = next().toCharArray(); char[] c = next().toCharArray(); int cntA = 0; int cntB = 0; int cntC = 0; char num = 'a'; while (true) { switch (num) { case 'a': if (cntA < a.length) { num = a[cntA]; cntA++; } else { out.println("A"); return; } break; case 'b': if (cntB < b.length) { num = b[cntB]; cntB++; } else { out.println("B"); return; } break; case 'c': if (cntC < c.length) { num = c[cntC]; cntC++; } else { out.println("C"); return; } break; } } } private void solveC() { String first = next(); String[] input = first.split(""); int[] wk = Arrays.stream(input).mapToInt(i -> Integer.parseInt(i)).toArray(); System.out.println(chkC(input)); // System.out.println(dfs(first, 0, 1, 0)); } private long chkC(String[] number) { long res = 0; /* * +-は最大9個 * 000000000から、111111111までの配列を作成。2の剰余を入れていけば2進数に変換できる。 */ int maskMax = number.length; int max = (int) Math.pow(2, maskMax - 1); for (int i = 0; i < max; i++) { int[] plusMinus = new int[maskMax - 1]; int wkBit = i; for (int j = 0; j < maskMax - 1; j++) { plusMinus[j] = wkBit % 2; wkBit /= 2; } StringBuilder builder = new StringBuilder(); for (int j = 0; j < maskMax; j++) { builder.append(number[j]); if (j < plusMinus.length && plusMinus[j] == 1) { builder.append("@"); } } String[] numS = builder.toString().split("@"); for (String long1 : numS) { res += Long.parseLong(long1); } } // StringBuilder builderAll = new StringBuilder(); // for (int i = 0; i < number.length; i++) { // builderAll.append(number[i]); // } return res + Long.parseLong(builderAll.toString()); } public static long dfs(String number, int start, int last, long sum) { long num = Long.parseLong(number.substring(start, last)); System.out.printf("number : %s / start : %5d / last : %5d / sum : %5d / num : %5d", number, start, last, sum, num); System.out.println(); if (last == number.length()) { return sum + num; } return dfs(number, start, last + 1, sum) + dfs(number, last, last + 1, sum + num); } private void solveD() { int numN = nextInt(); out.println(""); } private void solveE() { int numN = nextInt(); out.println(""); } private void solveF() { int numN = nextInt(); out.println(""); } private final PrintWriter out = new PrintWriter(System.out); private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public int nextInt() { return Integer.parseInt(next()); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } }
Main.java:128: error: cannot find symbol return res + Long.parseLong(builderAll.toString()); ^ symbol: variable builderAll location: class Main 1 error
s819185935
p03999
C++
def main(): S = input() n = len(S)-1 val_sum = 0 for i in range(2**n): idx = 0 for j in range(n): if 1 & (i >> j) == 1: val_sum += int(S[idx:j+1]) idx = j+1 val_sum += int(S[idx:]) print(val_sum) if __name__ == "__main__": main()
a.cc:1:1: error: 'def' does not name a type 1 | def main(): | ^~~
s115876576
p03999
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; cin>>s; long long ans=0,t; for(int i=0;i<(1<<s.size-1);i++){ t=s[0]-'0'; for(int j=0;j<s.size();j++){ if(j==s.size()-1||i&1<<j){ ans+=t; t=0; } t*=10; t+=s[j+1]-'0'; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:23: error: invalid use of member 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]' (did you forget the '()' ?) 8 | for(int i=0;i<(1<<s.size-1);i++){ | ~~^~~~ | ()
s101598423
p03999
C++
#include<iostream> using namespace std; int k(int a) { int k = 0; while(a) { a /= 10; k ++; } return k; } int main () { int N; cin >> N; int bi[10]; bi[0] = 1; for (int i = 0; i < 9; i ++) bi[i + 1] = bi[i] * 2; int ju = keta(N); int ans = 0; for (int i_ = 0; i_ < bi[ju]; i_ ++) { int i = i_ int a = N; int b = 10; for (int j = 0; j < ju; j ++) { if (i % 2) { ans += a % b; a /= b; } i /= 2; } ans += a; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:12: error: 'keta' was not declared in this scope 18 | int ju = keta(N); | ^~~~ a.cc:22:5: error: expected ',' or ';' before 'int' 22 | int a = N; | ^~~ a.cc:26:16: error: 'a' was not declared in this scope 26 | ans += a % b; | ^ a.cc:31:12: error: 'a' was not declared in this scope 31 | ans += a; | ^
s266581299
p03999
C++
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <bitset> #include <cmath> #include <iomanip> #include <string> typedef long long ll; using namespace std; int main() { ios::sync_with_stdio(false); string s; cin >> s; reverse(s.begin(), s.end()); ll l = s.size(), sum = 0; if (n = 1){ cout << s[0] - '0'; //数字に変換 return 0; } for(int i = 0; i < (1 << l - 1); i++) { ll tmp = 1; sum += s[0] - '0'; for(int j = 0; j < n - 1; j++){ if(i & (1 << j)) tmp = 1; else tmp *= 10; sum += tmp * (s[j + 1] - '0'); } tmp = 1; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'n' was not declared in this scope 21 | if (n = 1){ | ^ a.cc:30:28: error: 'n' was not declared in this scope 30 | for(int j = 0; j < n - 1; j++){ | ^
s945470609
p03999
C++
//file_name:ABC45_C.cpp #include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define limit(x,l,r) max(l,min(x,r)) #define lims(x,l,r) (x = max(l,min(x,r))) #define isin(x,l,r) ((l) <= (x) && (x) < (r)) #define pb push_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)),x.end()) #define snuke srand((unsigned)clock()+(unsigned)time(NULL)); #define show(x) cout<<#x<<" = "<<x<<endl; #define PQ(T) priority_queue<T,v(T),greater<T> > #define bn(x) ((1<<x)-1) #define dup(x,y) (((x)+(y)-1)/(y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; inline int in() { int x; scanf("%d",&x); return x;} template<typename T>inline istream& operator>>(istream&i,v(T)&v) {rep(j,sz(v))i>>v[j];return i;} template<typename T>string join(const v(T)&v) {stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);} template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v) {if(sz(v))o<<join(v);return o;} template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v) {return i>>v.fi>>v.se;} template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v) {return o<<v.fi<<","<<v.se;} template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;} const double eps = 1e-10; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} const int MX = 200005; // int scan /* int x; scanf("%d",&x); int y; scanf("%d",&y); int z; scanf("%d",&z); // matrix scan /* ll a[n] = {}; rep(i,n){ scanf("%lld",&a[i]); } */ // string scan /* string s; cin >> s; */ int main() { ll n; scanf("%lld",&n); int keta = 0; ll nn = n; while(nn>0){ keta++; nn/=10; } ll ans = 0; rep(i,keta){ rep() } cout << ans << endl; return 0; }
a.cc:93:13: error: macro "rep" requires 2 arguments, but only 1 given 93 | rep() | ^ a.cc:5:9: note: macro "rep" defined here 5 | #define rep(i,n) for(int i = 0; i < (n); ++i) | ^~~ a.cc: In function 'int main()': a.cc:93:9: error: 'rep' was not declared in this scope 93 | rep() | ^~~
s343140781
p03999
C++
#include<iostream> #include<vector> #include<string> using namespace std; long long ctoi(char num) { return num - '0'; } long long eval(vector<char>s) { vector<long long> num; vector<char>ope; long long number = ctoi(s[0]); for (int i = 1; i < s.size(); i++) { if (s[i] == '+') { ope.push_back('+'); num.push_back(number); number = 0; } else if (s[i] == '-') { ope.push_back('-'); num.push_back(number); number = 0; } else { number = number * 10 + ctoi(s[i]); } if (i == s.size() - 1) { num.push_back(number); } } long long ans = num[0]; for (int i = 1; i < num.size(); i++) { if (ope[i - 1] == '+') { ans += num[i]; } else if (ope[i - 1] == '-') { ans -= num[i]; } } return ans; } int main() { string s; cin >> s; vector<char> k; int num; long long ans = 0; for (int i = 0; i < pow(2, s.length()-1); i++) { num = i; k = {}; for (int j = 0; j < s.length()-1; j++) { k.push_back(s[j]); if (num % 2 == 1) { k.push_back('+'); } num /= 2; } k.push_back(s[s.length() - 1]); ans += eval(k); k = {}; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:49:29: error: 'pow' was not declared in this scope 49 | for (int i = 0; i < pow(2, s.length()-1); i++) { | ^~~
s726631826
p03999
C++
S=input() ans=0 for i in range(2**(len(S)-1)): tmp=S[0] for j in range(len(S)-1): if i&(1<<j):tmp+="+" tmp+=S[j+1] ans+=eval(tmp) print(ans)
a.cc:1:1: error: 'S' does not name a type 1 | S=input() | ^
s443198643
p03999
C++
#include <iostream> #include <set> #include <map> #include <vector> #include <algorithm> #include <iomanip> #include <numeric> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; int main(int argc, const char * argv[]) { string s; cin >> s; int a[20]; memset(a, 0, sizeof(a)); for (int i = 0; i < s.size(); i++) { a[i] = s[i] - '0'; } int n = s.size() -1; ll ans = 0; for (int i = 0; i < (1 << n); i++) { ll t = a[0]; for (int j = n - 1; j >= 0; j--) { if (i & (1 << j)) { ans += t; t = a[n - j]; } else { t = t * 10 + a[n - j]; } } ans += t; } cout << ans << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:17:3: error: 'memset' was not declared in this scope 17 | memset(a, 0, sizeof(a)); | ^~~~~~ a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <numeric> +++ |+#include <cstring> 8 |
s182619261
p03999
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin>>s; int len = s.size(); int n = 1<<(len-1); ll sum = 0; for(int i=0 ; i<n; i++) { int cnt = s[0] - '0';//将字符ascii转换 for(int j=0; j<len; j++) { if(j==len-1||i&1<<j)//从左往右数去i+1上那一个值 { ll +=cnt; cnt = 0;//加完后清0 if(j==len-1) { break; } } cnt*=10; cnt+=s[j+1]-'0'; } } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:20: error: expected unqualified-id before '+=' token 21 | ll +=cnt; | ^~
s342243952
p03999
C++
ans = 0 def dfs(S, i, cur, sum_v): global ans if i == len(S)-1: ans += sum_v return dfs(S, i+1, int(S[i+1]), sum_v+int(S[i+1])) dfs(S, i+1, cur*10+int(S[i+1]), sum_v+cur*9+int(S[i+1])) S = input() dfs(S, 0, int(S[0]), int(S[0])) print(ans)
a.cc:1:1: error: 'ans' does not name a type 1 | ans = 0 | ^~~
s502556641
p03999
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM 1000000000; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 1000000005 #define NIL -1 ll mod = 1e9+7; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int dp[201010]; int main(){ string s; cin >> s; ll ans = atoi(s); for(int i = 1; i < s.size(); i++){ string t = s.substr(0, i); string u = s.substr(i, s.size()-i); ans += (t - '0')+(u - '0'); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:15:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 15 | ll ans = 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:19:19: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 19 | ans += (t - '0')+(u - '0'); | ~ ^ ~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 19 | ans += (t - '0')+(u - '0'); | ^~~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:19:21: note: mismatched types 'const std::complex<_Tp>' and 'char' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:19:21: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'char' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:19:21: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'char' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:19:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 19 | ans += (t - '0')+(u - '0'); | ^~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1:
s065834233
p03999
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM 1000000000; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 1000000005 #define NIL -1 ll mod = 1e9+7; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int dp[201010]; int main(){ string s; cin >> s; ll ans = atoi(s); for(int i = 1; i < s.size(); i++){ string t = s.substr(0, i); string u = s.substr(i, s.size()-i); ans += atoi(t)+atoi(u); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:15:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 15 | ll ans = 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:19:21: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 19 | ans += atoi(t)+atoi(u); | ^ | | | 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:19:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 19 | ans += atoi(t)+atoi(u); | ^ | | | 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) | ~~~~~~~~~~~~^~~~~~
s113469568
p03999
C++
#include <iostream> #include <string.h> using namespace std; int main(void){ char str[15]; cin>>str; int N; int ans=0; N=strlen(str); for(int i=0;i<(1<<(N-1));i++){ int add=s[0]-'0'; int sum=0; for(int j=0;j<N-1;j++){ if(i&(1<<j)){ sum+=a; add=0; } add=add*10+s[j]-'0'; } sum+=add; ans+=sum; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:11:16: error: 's' was not declared in this scope 11 | int add=s[0]-'0'; | ^ a.cc:15:21: error: 'a' was not declared in this scope 15 | sum+=a; | ^
s619481405
p03999
C++
#include <cstdio> #include <vector> #include <algorithm> #include <iostream> #include <cstring> using namespace std ; typedef long long ll ; #define rep (i , n ) for ( int i =0; i < n ; i++) #define _sort(arg) sort(begin(arg), end(arg)) #define MOD 1000000007 #define pb push_back #define DEBUG(x) cout << #x << ": " << x << endl; /* __attribute__((constructor)) void initial() { cin.tie(NULL); ios::sync_with_stdio(false); } */ int main() { cin.tie(NULL); ios::sync_with_stdio(false); ll s; cin >> s; int n = s.size(); ll c = 0; for (int i = 0; i < (1 << (n-1)); i++) { ll num = s[0] - '0'; for(int j = 0; j < n-1; j++) { if (i & (1<<j)) { c+=num; num=0; } num = num * 10 + (s[j+1] - '0'); } c+=num; } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:19: error: request for member 'size' in 's', which is of non-class type 'll' {aka 'long long int'} 32 | int n = s.size(); | ^~~~ a.cc:38:27: error: invalid types 'll {aka long long int}[int]' for array subscript 38 | ll num = s[0] - '0'; | ^ a.cc:46:44: error: invalid types 'll {aka long long int}[int]' for array subscript 46 | num = num * 10 + (s[j+1] - '0'); | ^
s679497786
p03999
C++
s = input() ans = 0 for i in range((len(s) - 1) ** 2): tmp = '' for j in range(len(s)): tmp += s[j] if i >> j & 1: tmp += '+' else: ans += eval(tmp) else: print(ans)
a.cc:4:11: error: empty character constant 4 | tmp = '' | ^~ a.cc:1:1: error: 's' does not name a type 1 | s = input() | ^
s994042502
p03999
C
#include<iostream> #include<string> #include<algorithm> using namespace std; int main() { string g,p,q; long long x=0,a,b,i; cin>>g; for(i=0;i<g.length();i++) { p=g.substr(0,i); q=g.substr(0+i,g.length()-(0+i)); a=atoi( p.c_str() ); b=atoi( q.c_str() ); x=x+a+b; } if(atoi(g.c_str())>=10) for(i=0;i<g.length();i++) { a=g[i]-'0'; x+=a; } printf("%lld",x); return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s688969000
p03999
C++
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<list> #include<cmath> #include<map> using namespace std; using ll = long long; const int INF = 1e9; #define rep(i,n)for(int i=0;i<n;++i) #define p pair<int,int> int main() { string S; cin >> S; ll ans = 0; for (int i = 0; i < 1 << S.size() - 1; ++i) { ll sm = 0; ll a = S[0] - '0'; rep(j, 0, S.size() - 1) { if (i&(1 << j)) { sm += a; a = 0; } a = a * 10 + S[j - 1] - '0'; } sm += a; ans += sm; } cout << ans << endl; return 0; }
a.cc:20:39: error: macro "rep" passed 3 arguments, but takes just 2 20 | rep(j, 0, S.size() - 1) { | ^ a.cc:11:9: note: macro "rep" defined here 11 | #define rep(i,n)for(int i=0;i<n;++i) | ^~~ a.cc: In function 'int main()': a.cc:20:17: error: 'rep' was not declared in this scope 20 | rep(j, 0, S.size() - 1) { | ^~~
s977457753
p03999
C++
#include<stdio.h> #include<iostream> #include<string.h> #include<cmath> using namespace std; char s[15]; int n; long long int sum=0,op,p,q; int main() { int i,j,k; //freopen("we.in","r",stdin); //freopen("we.out","w",stdout); gets(s+1); n=strlen(s+1); for(i=1;i<=n;i++) s[i]-=48; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { op=0; for(k=i;k<=j;k++) op=op*10+s[k]; if(i==1) p=1; else p=pow(2,i-2); if(j==n) q=1; else q=pow(2,n-j-1); sum+=p*q*op; } } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 14 | gets(s+1); | ^~~~ | getw
s058563140
p03999
C++
#include<iostream> using namespace std; typedef long long ll; int main(){ string s; cin >>s; int N=s.size(); ll ans=0; for(int i=0;i<N;i++){ ll num=s[0] - '0'; for(int j=0;j<n-1;j++){ if(i&(1<<j)){ ans += num; num=0; } num = num * 10 +a[j+1] - '0'; } ans += num; } cout << ans << ensdl; }
a.cc: In function 'int main()': a.cc:12:19: error: 'n' was not declared in this scope 12 | for(int j=0;j<n-1;j++){ | ^ a.cc:17:23: error: 'a' was not declared in this scope 17 | num = num * 10 +a[j+1] - '0'; | ^ a.cc:21:18: error: 'ensdl' was not declared in this scope 21 | cout << ans << ensdl; | ^~~~~
s692491397
p03999
C++
#include<iostream> using namespace std; int main() { string s; cin >> s; int n = s.size(); long long ans = 0; for (int i = 0;i < 1 << n - 1; i++) { long long num = s[0] - '0'; for (int i = 0;i < n - 1;i++) { if (t & (1 << i)) { ans += num; num = 0; } num = num * 10 + s[i + 1] - '0'; } ans += num; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:29: error: 't' was not declared in this scope 12 | if (t & (1 << i)) { | ^
s865155178
p03999
C++
#include <iostream> #include <cstdint> #include <string> #include <vector> #include <iterator> #include <algorithm> int main() { std::string s; std::cin >> s; std::vector<std::int_fast64_t> digits; std::transform(s.begin(), s.end(), std::back_inserter(digits), [](const char c) { return std::stoi(std::string({c})); }); std::int_fast64_t result = 0; for (std::uint_fast64_t bit_flags = 0; bit_flags < tools::pow2<std::uint_fast64_t>(digits.size() - 1); ++bit_flags) { std::int_fast64_t buffer = 0; for (std::int_fast64_t i = 0; i < static_cast<std::int_fast64_t>(digits.size()) - 1; ++i) { buffer = 10 * buffer + digits[i]; if ((bit_flags & tools::pow2<std::uint_fast64_t>(i)) != 0) { result += buffer; buffer = 0; } } buffer = 10 * buffer + digits.back(); result += buffer; } std::cout << result << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:17:54: error: 'tools' has not been declared 17 | for (std::uint_fast64_t bit_flags = 0; bit_flags < tools::pow2<std::uint_fast64_t>(digits.size() - 1); ++bit_flags) { | ^~~~~ a.cc:17:84: error: expected primary-expression before '>' token 17 | for (std::uint_fast64_t bit_flags = 0; bit_flags < tools::pow2<std::uint_fast64_t>(digits.size() - 1); ++bit_flags) { | ^ a.cc:21:24: error: 'tools' has not been declared 21 | if ((bit_flags & tools::pow2<std::uint_fast64_t>(i)) != 0) { | ^~~~~ a.cc:21:54: error: expected primary-expression before '>' token 21 | if ((bit_flags & tools::pow2<std::uint_fast64_t>(i)) != 0) { | ^
s809934461
p03999
C++
#include <bits/stdc++.h> //#include <mylib.h> using namespace std; //cin.sync_with_stdio(false); #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define FOR_EQ(i,a,b) for(int i = (a); i <= (b); ++i) #define FOR_RE(i,a,b) for(int i = (a); i > (b); --i) #define rep(i,n) FOR(i,0,n) #define rep_eq(i,n) FOR_EQ(i,0,n) #define rep_re(i,n) FOR_RE(i,n,0) //1個上から時計周り const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1}; //上右下左 const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0}; typedef unsigned long long ull; typedef long long ll; typedef vector<int> Vector; typedef vector<Vector> DVector; int n; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; n = S.length(); ll ans = 0; rep(i, 1 << (n - 1)) { ll sm = 0; ll a = S[0] - '0'; rep(j, N - 1) { if (i & (1 << j)) { sm += a; a = 0; } a = a * 10 + S[j + 1] - '0'; } sm += a; ans += sm; } cout << ans << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:38:16: error: 'N' was not declared in this scope 38 | rep(j, N - 1) { | ^ a.cc:6:42: note: in definition of macro 'FOR' 6 | #define FOR(i,a,b) for(int i = (a); i < (b); ++i) | ^ a.cc:38:9: note: in expansion of macro 'rep' 38 | rep(j, N - 1) { | ^~~
s922673664
p03999
C++
#include<cstdio> #include<cmath> #include<algorithm> #include<cstring> using namespace std; char s[102]; long long ans,n,t; long long ww(int b,int l) { int ret=0,e=b+l-1; for(int i=b;i<=e;i++) ret=ret*10+s[i]-'0'; return ret; } int main() { scanf("%s",s+1); int len=strlen(s+1); sscanf(s+1,"%lld",&n); for(int i=1;i<=len;i++) for(int j=1;j+i-1<=len;j++) { int c=len-i-1; if(1<j&&j<len-i+1) c--; max(0,c) t=ww(j,i)*pow(2,c); ans+=t; } printf("%lld",ans); return 0; }
a.cc: In function 'int main()': a.cc:26:21: error: expected ';' before 't' 26 | max(0,c) | ^ | ; 27 | t=ww(j,i)*pow(2,c); | ~ a.cc:26:16: warning: ignoring return value of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result] 26 | max(0,c) | ~~~^~~~~ In file included from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: declared here 257 | max(const _Tp& __a, const _Tp& __b) | ^~~
s384027618
p03999
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> #include <stack> #include <queue> #include <deque> #include <numeric> using namespace std; using ll = long long; map <int ,int> mpa,mpb; typedef pair<ll, ll> P; priority_queue<P, vector<P>, greater<P>> pque; string S; ll ans=0; void solve(int a,int b,int c){ if(!S[a]){ ans+=b+c; return; } solve(a+1,b+c,S[a]-'0'); solve(a+1,b,c*10+(S[a]-'0')); } return; } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> S; solve(0,0,0); cout << ans/2 << endl; return 0; }
a.cc:33:3: error: expected unqualified-id before 'return' 33 | return; | ^~~~~~ a.cc:34:1: error: expected declaration before '}' token 34 | } | ^
s883814372
p03999
C++
#include <bits/stdc++.h> using namespace std; #define LL long long char s[15]; int index[15]; LL A(int n) { LL sum=0; index[n-1]=1;//目的就是让其有结束的时候,不写这个,那么像000这个情况就会没考虑到 /*for(int i=0; i<n; i++){ printf("%d",pos[i]); } printf("\n");*/ LL ss=0; for(int i=0; i<n; i++) { if(index[i]==0) ss=ss*10+(s[i]-'0'); else{ sum=sum+(ss*10+(s[i]-'0')); ss=0; } } return sum; } int main() { while(cin>>s) { int n=strlen(s); long long ans=0; int m=(1<<(n-1)); //加号的位置排放就有m种情况; //如125,就有125,1+25,12+5,1+2+5,这4种情况,其实也是0到3的二进制表示(巧妙吧) //cout<<m<<endl; for(int i=0; i<m; i++)//0到m-1的二进制表示 { memset(index,0,sizeof(index)); int k=0; int temp=i; while(temp)//求i的二进制 { pos[k++]=temp%2; temp=temp/2; } ans+=A(n); } printf("%lld\n",ans); } return 0; }
a.cc:5:13: error: 'int index [15]' redeclared as different kind of entity 5 | int index[15]; | ^ In file included from /usr/include/string.h:462, from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)' 50 | extern const char *index (const char *__s, int __c) | ^~~~~ a.cc: In function 'long long int A(int)': a.cc:9:10: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 9 | index[n-1]=1;//目的就是让其有结束的时候,不写这个,那么像000这个情况就会没考虑到 | ^ a.cc:17:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 17 | if(index[i]==0) | ^ a.cc: In function 'int main()': a.cc:38:28: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive] 38 | memset(index,0,sizeof(index)); | ^~~~~~~~~~~~~ a.cc:38:19: error: cannot resolve overloaded function 'index' based on conversion to type 'void*' 38 | memset(index,0,sizeof(index)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:43:17: error: 'pos' was not declared in this scope; did you mean 'pow'? 43 | pos[k++]=temp%2; | ^~~ | pow
s865619991
p03999
C++
#include<iostream> #include<stdio.h> #include<string.h> typedef long long LL; using namespace std; int main() { char s[15]; int a[15]={0}; LL hs=0; int flg1,flg2; gets(s); int n=strlen(s); for(int i=0;i<n;i++) { flg1=1;flg2=1; if(i==n-1) { for(int i=0;i<n;i++) { hs+=s[i]-'0'; } //cout<<hs<<endl; break; } else{ for(int k=i;k>=0;k--) { // cout<<s[k]-'0'<<"flg1"<<flg1<<endl; hs+=(s[k]-'0')*flg1; flg1=flg1*10; } for(int j=n-1;j>i;j--) { // cout<<s[j]-'0'<<"flg2"<<flg2<<endl; hs+=(s[j]-'0')*flg2; flg2=flg2*10; } //cout<<hs<<endl; } } //cout<<hs<<endl; flg2=1; for(int i=n-1;i>=0;i--) { hs+=(s[i]-'0')*flg2; flg2=flg2*10; } cout<<hs<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'gets' was not declared in this scope; did you mean 'getw'? 12 | gets(s); | ^~~~ | getw
s750555667
p03999
C
#include<iostream> #include<stdio.h> #include<string.h> typedef long long LL; using namespace std; int main() { char s[15]; int a[15]={0}; LL hs=0; int flg1,flg2; gets(s); int n=strlen(s); for(int i=0;i<n;i++) { flg1=1;flg2=1; if(i==n-1) { for(int i=0;i<n;i++) { hs+=s[i]-'0'; } //cout<<hs<<endl; break; } else{ for(int k=i;k>=0;k--) { // cout<<s[k]-'0'<<"flg1"<<flg1<<endl; hs+=(s[k]-'0')*flg1; flg1=flg1*10; } for(int j=n-1;j>i;j--) { // cout<<s[j]-'0'<<"flg2"<<flg2<<endl; hs+=(s[j]-'0')*flg2; flg2=flg2*10; } //cout<<hs<<endl; } } //cout<<hs<<endl; flg2=1; for(int i=n-1;i>=0;i--) { hs+=(s[i]-'0')*flg2; flg2=flg2*10; } cout<<hs<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s470563126
p03999
C++
#include<iostream> #include<stdio.h> #include<string.h> typedef long long LL; using namespace std; int main() { char s[15]; int a[15]={0}; LL hs=0; int flg1,flg2; gets(s); int n=strlen(s); for(int i=0;i<n;i++) { flg1=1;flg2=1; if(i==n-1) { for(int i=0;i<n;i++) { hs+=s[i]-'0'; } //cout<<hs<<endl; break; } else{ for(int k=i;k>=0;k--) { // cout<<s[k]-'0'<<"flg1"<<flg1<<endl; hs+=(s[k]-'0')*flg1; flg1=flg1*10; } for(int j=n-1;j>i;j--) { // cout<<s[j]-'0'<<"flg2"<<flg2<<endl; hs+=(s[j]-'0')*flg2; flg2=flg2*10; } //cout<<hs<<endl; } } //cout<<hs<<endl; flg2=1; for(int i=n-1;i>=0;i--) { hs+=(s[i]-'0')*flg2; flg2=flg2*10; } cout<<hs<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'gets' was not declared in this scope; did you mean 'getw'? 12 | gets(s); | ^~~~ | getw
s935918279
p03999
C++
#include <bits/stdc++.h> using namespace std; int main() { char ch[11]; char num[11]={0}; scanf("%s",ch); int l = strlen(ch); int sum=1; long long cnt=0; for(int i=0;i<l-1;i++) sum*=2; for(int i=0;i<sum;i++) { _itoa(i,num,2); int j; int ll =strlen(num); for(j=ll;j<l-1;j++) num[j-ll] = '0'; if(ll!=l-1) { itoa(i,num+j-ll,2); } long long ccnntt=0; for(j=0;j<l;j++) { ccnntt = ccnntt*10+(ch[j]-'0'); int numm=0; if((num[j]-'0')==1) { cnt+=ccnntt; ccnntt = 0; } } cnt+=ccnntt; } printf("%lld\n",cnt); }
a.cc: In function 'int main()': a.cc:17:9: error: '_itoa' was not declared in this scope 17 | _itoa(i,num,2); | ^~~~~ a.cc:24:13: error: 'itoa' was not declared in this scope 24 | itoa(i,num+j-ll,2); | ^~~~
s037084673
p03999
C++
#include <bits/stdc++.h> using namespace std; int main() { char ch[11]; char num[11]={0}; scanf("%s",ch); int l = strlen(ch); int sum=1; long long cnt=0; for(int i=0;i<l-1;i++) sum*=2; for(int i=0;i<sum;i++) { itoa(i,num,2); int j; int ll =strlen(num); for(j=ll;j<l-1;j++) num[j-ll] = '0'; if(ll!=l-1) { itoa(i,num+j-ll,2); } long long ccnntt=0; for(j=0;j<l;j++) { ccnntt = ccnntt*10+(ch[j]-'0'); int numm=0; if((num[j]-'0')==1) { cnt+=ccnntt; ccnntt = 0; } } cnt+=ccnntt; } printf("%lld\n",cnt); }
a.cc: In function 'int main()': a.cc:17:9: error: 'itoa' was not declared in this scope 17 | itoa(i,num,2); | ^~~~
s001569338
p03999
C++
#include <bits/stdc++.h> using namespace std; int main() { char ch[11]; char num[11]={0}; scanf("%s",ch); int l = strlen(ch); int sum=1; long long cnt=0; for(int i=0;i<l-1;i++) sum*=2; for(int i=0;i<sum;i++) { itoa(i,num,2); int j; int ll =strlen(num); for(j=ll;j<l-1;j++) num[j-ll] = '0'; if(ll!=l-1) { itoa(i,num+j-ll,2); } long long ccnntt=0; for(j=0;j<l;j++) { ccnntt = ccnntt*10+(ch[j]-'0'); int numm=0; if((num[j]-'0')==1) { cnt+=ccnntt; ccnntt = 0; } } cnt+=ccnntt; } printf("%lld\n",cnt); }
a.cc: In function 'int main()': a.cc:17:9: error: 'itoa' was not declared in this scope 17 | itoa(i,num,2); | ^~~~
s392101456
p03999
C++
#include <iostream> #include <algorithm> #include <queue> #include <vector> #include <set> #include <stack> #include <map> #include <utility> #include <string> #include <stdio.h> #include <math.h> #include <string.h> #define N 15 using namespace std; long long number[N]; char s[N]; long long sum; int len; void cal() { char t[N]; sum += (s[0]-'0')*number[len-2]; sum += (s[len-1]-'0')*number[len-2]; for (int i=1;i<=len-2;i++) { sum += (s[i] - '0')*number[len-3]; } int n = 2; while (n<len) { for (int i=0;i<=len-n;i++) { int k=0; for (int j=i;j<i+n && j<len;j++) { t[k++] = s[j]; } t[k] = '\0'; long long temp = atoll(t); if (!i || i==len-n) { sum += temp*number[len-3-n+2]; } else { sum += temp*number[len-4-n+2]; } } n++; } sum += atoll(s); return; } int main() { gets(s); sum = 0; len = strlen(s); number[0] = 1; for (int i=1;i<N;i++) { number[i] = number[i-1]*2; } if (len==1) { puts(s); } else { cal(); printf("%lld\n",sum); } return 0; }
a.cc: In function 'int main()': a.cc:60:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 60 | gets(s); | ^~~~ | getw
s522099980
p03999
C++
#include <iostream> #include <algorithm> #include <queue> #include <vector> #include <set> #include <stack> #include <map> #include <utility> #include <string> #include <stdio.h> #include <math.h> #include <string.h> #define N 15 using namespace std; long long number[N]; char s[N]; long long sum; int len; void cal() { char t[N]; sum += (s[0]-'0')*number[len-2]; sum += (s[len-1]-'0')*number[len-2]; for (int i=1;i<=len-2;i++) { sum += (s[i] - '0')*number[len-3]; } int n = 2; while (n<len) { for (int i=0;i<=len-n;i++) { int k=0; for (int j=i;j<i+n && j<len;j++) { t[k++] = s[j]; } t[k] = '\0'; long long temp = atoll(t); if (!i || i==len-n) { sum += temp*number[len-3-n+2]; } else { sum += temp*number[len-4-n+2]; } } n++; } sum += atoll(s); return; } int main() { gets(s); sum = 0; len = strlen(s); number[0] = 1; for (int i=1;i<N;i++) { number[i] = number[i-1]*2; } if (len==1) { puts(s); } else { cal(); printf("%lld\n",sum); } return 0; }
a.cc: In function 'int main()': a.cc:60:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 60 | gets(s); | ^~~~ | getw
s496347884
p03999
C++
#include <iostream> #include <algorithm> #include <queue> #include <vector> #include <set> #include <stack> #include <map> #include <utility> #include <string> #include <stdio.h> #include <math.h> #include <cstring> #define N 15 using namespace std; long long number[N]; char s[N]; long long sum; int len; void cal() { char t[N]; sum += (s[0]-'0')*number[len-2]; sum += (s[len-1]-'0')*number[len-2]; for (int i=1;i<=len-2;i++) { sum += (s[i] - '0')*number[len-3]; } int n = 2; while (n<len) { for (int i=0;i<=len-n;i++) { int k=0; for (int j=i;j<i+n && j<len;j++) { t[k++] = s[j]; } t[k] = '\0'; long long temp = atoll(t); if (!i || i==len-n) { sum += temp*number[len-3-n+2]; } else { sum += temp*number[len-4-n+2]; } } n++; } sum += atoll(s); return; } int main() { gets(s); sum = 0; len = strlen(s); number[0] = 1; for (int i=1;i<N;i++) { number[i] = number[i-1]*2; } if (len==1) { puts(s); } else { cal(); printf("%lld\n",sum); } return 0; }
a.cc: In function 'int main()': a.cc:60:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 60 | gets(s); | ^~~~ | getw
s384288533
p03999
C++
#include <stdio.h> #include <string.h> int sum[15]={0}; char s[11]; int f(int i,int j) { int k,l,d; for(k=i;k<=j;k++) sum[j-k+1]+=s[k]-48; for(l=15;l>=0;l--) if(sum[l]) break; for(d=1;d<=l;d++) if(sum[d]>9) { sum[d+1]+=sum[d]/10; sum[d]%=10; } return 0; } int ff(int x,int y,int d) { int i; if(d==0) { f(x,y); return 0; } for(i=x;i<=y-d;i++) { f(x,i); ff(i+1,y,d-1); } return 0; } int main() { int l,i; scanf("%s",&s) l=strlen(s); for(i=0;i<=l-1;i++) ff(0,l-1,i); for(l=15;l>=0;l--) if(sum[l]) break; for(i=l;i>=1;i--) printf("%d",sum[i]); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:39:23: error: expected ';' before 'l' 39 | scanf("%s",&s) | ^ | ; 40 | l=strlen(s); | ~
s108538148
p03999
C++
#include <stdio.h> #include <string.h> int sum[15]={0}; char s[11]; int f(int i,int j) { int k,l,d; for(k=i;k<=j;k++) sum[j-k+1]+=s[k]-48; for(l=15;l>=0;l--) if(sum[l]) break; for(d=1;d<=l;d++) if(sum[d]>9) { sum[d+1]+=sum[d]/10; sum[d]%=10; } return 0; } int ff(int x,int y,int d) { int i; if(d==0) { f(x,y); return 0; } for(i=x;i<=y-d;i++) { f(x,i); ff(i+1,y,d-1); } return 0; } int main() { int l,i; gets(s); l=strlen(s); for(i=0;i<=l-1;i++) ff(0,l-1,i); for(l=15;l>=0;l--) if(sum[l]) break; for(i=l;i>=1;i--) printf("%d",sum[i]); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:39:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 39 | gets(s); | ^~~~ | getw
s634839946
p03999
C++
#include <stdio.h> #include <string.h> char s[11]; _int64 f(int i,int j) { _int64 sum=0,k,l,d; for(k=i;k<=j;k++) { d=1; for(l=1;l<=j-k;l++) d*=10; sum+=(s[k]-48)*d; } return sum; } _int64 ff(int x,int y,int d) { int i; _int64 sum=0; if(d==0) return f(x,y); for(i=x;i<=y-d;i++) sum+=f(x,i)+ff(i+1,y,d-1); return sum; } int main() { int l,i; _int64 sum=0; gets(s); l=strlen(s); for(i=0;i<=l-1;i++) sum+=ff(0,l-1,i); printf("%I64d\n",sum); return 0; }
a.cc:4:1: error: '_int64' does not name a type 4 | _int64 f(int i,int j) | ^~~~~~ a.cc:16:1: error: '_int64' does not name a type 16 | _int64 ff(int x,int y,int d) | ^~~~~~ a.cc: In function 'int main()': a.cc:29:9: error: '_int64' was not declared in this scope 29 | _int64 sum=0; | ^~~~~~ a.cc:30:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 30 | gets(s); | ^~~~ | getw a.cc:33:17: error: 'sum' was not declared in this scope 33 | sum+=ff(0,l-1,i); | ^~~ a.cc:33:22: error: 'ff' was not declared in this scope; did you mean 'ffs'? 33 | sum+=ff(0,l-1,i); | ^~ | ffs a.cc:34:22: error: 'sum' was not declared in this scope 34 | printf("%I64d\n",sum); | ^~~
s660735106
p03999
C++
#include<iostream> #include<string> #include<stdlib.h> using namespace std; long long ans = 0; void dfs(long long s,long long n) { if (s == 0) ans+=n; else { int t = log10(s); //ans += s; while (t >= 0) { long long a = s / pow(10, t); //ans += a+n; // cout << a << endl; long long b = s - a*pow(10, t); dfs(b, a + n); t--; } } } int main() { long long s; cin >> s; dfs(s,0); cout << ans; }
a.cc: In function 'void dfs(long long int, long long int)': a.cc:10:25: error: 'log10' was not declared in this scope 10 | int t = log10(s); | ^~~~~ a.cc:14:43: error: 'pow' was not declared in this scope 14 | long long a = s / pow(10, t); | ^~~
s367322177
p03999
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <vector> #include <set> #include <cmath> #include <cstdlib> #define FOR(i,a,b) for(int i=a;i<b;i++) #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 #define PI 3.14159265358979323846 using namespace std; // int main(){ cin>>S; for(int i=0;i<S.size();i++){ for(int j=i;j<S.size();j++){ long long num=stoll(S.substr(i,j-i+1)); long long K=1; if(i==0)K*=1;else K*=(1<<(i-1)); long long L=S.size()-j-1; if(L==0)K*=1;else K*=(1<<(L-1)); cnt+=num*K; } } cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:28:8: error: 'S' was not declared in this scope 28 | cin>>S; | ^ a.cc:36:7: error: 'cnt' was not declared in this scope; did you mean 'int'? 36 | cnt+=num*K; | ^~~ | int a.cc:39:9: error: 'cnt' was not declared in this scope; did you mean 'int'? 39 | cout<<cnt<<endl; | ^~~ | int
s977026593
p03999
C++
// code by MC #include<iostream> #include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> #include<sstream> #include<cmath> #include<string> #include<vector> #include<deque> #include<set> #include<bitset> #include<map> #include<functional> #include<utility> #include<cstdio> #include<cstdlib> #include<ctime> #include<algorithm> #include<set> #include<stack> #include<queue> #include<IOS> using namespace std; string s; long long ans; long long num[1000000]; set <string> p; long long dealing(string z) { int l=0,r=0; //memset(num,1000000,0); vector <string> v; long long cnt=0; z+='+'; for (int i=0;i<z.size();i++,r++) if (z[i]=='+') v.push_back(z.substr(l,r)),l=i+1,r=-1; for (int i=0;i<v.size();i++) for (int j=0;j<v[i].size();j++) num[i]*=10,num[i]+=(v[i][j]-'0'); for (int i=0;i<v.size();i++) cnt+=num[i],num[i]=0; //cout<<"b"<<" "<<cnt<<" "<<ans<<endl; return cnt; } void dfs(int x,string z) { string ss=z.substr(0,x)+'+'+z.substr(x,z.size()-x); int t=x+2; while (t<ss.size()) { dfs(t,ss); t++; } if (p.count(ss)) return ; p.insert(ss); ans+=dealing(ss); //cout<<"a"<<" "<<ans<<endl; return ; } int main() { cin>>s; ans+=dealing(s); for (int i=1;i<s.size();i++) dfs(i,s); cout<<ans<<endl; return 0; }
a.cc:24:9: fatal error: IOS: No such file or directory 24 | #include<IOS> | ^~~~~ compilation terminated.
s595146931
p03999
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int len = S.length(); long sum = 0; for(int i = len - 1; i >= 0; i--) { String s = String.valueOf(S.charAt(i)); long digit = Integer.parseLong(s); for(int k = 0; k < len - i; k++) { sum += digit * (long)Math.pow(10, k) * (long)Math.pow(2, len - 2 - i - k); } } System.out.println(sum); } }
Main.java:11: error: cannot find symbol long digit = Integer.parseLong(s); ^ symbol: method parseLong(String) location: class Integer 1 error
s432712724
p03999
C++
#include <stdio.h> char s[11]; typedef long long ll; ll res = 0; int p[11], sz=0; void solve(int a, ll b, ll c) { if (!s[a]) { res += b+c; return; } solve(a+1, b+c, s[a]-'0'); solve(a+1, b, (s[a]-'0')+c*10); } int main(void) { scanf_s("%s", s); solve(0, 0, 0); printf("%lld\n", res/2); return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 19 | scanf_s("%s", s); | ^~~~~~~ | scanf
s070683167
p03999
C++
#include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <string> using namespace std; vector<string> hako; void saiki(string cs,int i){ if(i>=cs.length()) hako.push_back(cs); else { saiki(cs,i+1); saiki(cs.insert(i,"+"),i+2); } } int main(void){ int i,j,k; string s; int a,b,c; long long int res,tmp,t; cin>>s; tmp=0; k=s.length(); N=k+k-1; saiki(s,1); for(i=0;i<hako.size();i++){ tmp=t=0; for(j=0;j<hako[i].length();j++){ if(hako[i][j]=='+') {tmp+=t; t=0;} else t=t*10+(long long int)(hako[i][j]-'0'); } tmp+=t; res+=tmp; } cout<<res<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:3: error: 'N' was not declared in this scope 26 | N=k+k-1; | ^
s890775516
p03999
C++
#include <vector> #include <string> using namespace std; int N; vector<string> hako; void saiki(string cs,int i){ if(i>=cs.length()) hako.push_back(cs); else { saiki(cs,i+1); saiki(cs.insert(i,"+"),i+2); } } int main(void){ int i,j,k; string s; int a,b,c; long long int res,tmp,t; cin>>s; tmp=0; k=s.length(); N=k+k-1; saiki(s,1); for(i=0;i<hako.size();i++){ tmp=t=0; for(j=0;j<hako[i].length();j++){ if(hako[i][j]=='+') {tmp+=t; t=0;} else t=t*10+int(hako[i][j]-'0'); } tmp+=t; res+=tmp; } cout<<res<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:3: error: 'cin' was not declared in this scope 21 | cin>>s; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <string> +++ |+#include <iostream> 3 | using namespace std; a.cc:37:3: error: 'cout' was not declared in this scope 37 | cout<<res<<endl; | ^~~~ a.cc:37:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:37:14: error: 'endl' was not declared in this scope 37 | cout<<res<<endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <string> +++ |+#include <ostream> 3 | using namespace std;
s494066398
p03999
C++
#include<iostream> #include<string> #include <math.h> using namespace std; int main() { string s; __int64 ans =0; __int64 a[10]; cin >> s; int array_length = s.length(); for(int i=0;i<array_length;i++){ a[i] = s[i]-'0'; } int n=1; int nn=1; int nnn=1; int temp; int b = array_length; for(int i=0;i<array_length;i++){ temp = array_length-nnn; for(int k=0;k<b;k++){ ans += a[i] * n * pow(10,temp); if(k !=0){ n=n+n; } temp=temp-1; cout << ans <<endl; } nn=nn*2; n=nn; nnn++; b--; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 8 | __int64 ans =0; | ^~~~~~~ | __ynf64 a.cc:9:16: error: expected ';' before 'a' 9 | __int64 a[10]; | ^~ | ; a.cc:13:17: error: 'a' was not declared in this scope 13 | a[i] = s[i]-'0'; | ^ a.cc:23:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 23 | ans += a[i] * n * pow(10,temp); | ^~~ | abs a.cc:23:32: error: 'a' was not declared in this scope 23 | ans += a[i] * n * pow(10,temp); | ^
s636610164
p03999
C++
#include<iostream> #include<string> using namespace std; int main() { string s; long long int ans =0; long long int a[10]; cin >> s; int array_length = s.length(); for(int i=0;i<array_length;i++){ a[i] = s[i]-'0'; } int n=1; int nn=1; int nnn=1; int temp; int b = array_length; for(int i=0;i<array_length;i++){ temp = array_length-nnn; for(int k=0;k<b;k++){ ans += a[i] * n * pow(10,temp); if(k !=0){ n=n+n; } temp=temp-1; cout << ans <<endl; } nn=nn*2; n=nn; nnn++; b--; } return 0; }
a.cc: In function 'int main()': a.cc:22:43: error: 'pow' was not declared in this scope 22 | ans += a[i] * n * pow(10,temp); | ^~~
s225939692
p03999
C++
#include<iostream> #include<string> using namespace std; int main() { string s; __int64 ans =0; __int64 a[10]; cin >> s; int array_length = s.length(); for(int i=0;i<array_length;i++){ a[i] = s[i]-'0'; } int n=1; int nn=1; int nnn=1; int temp; int b = array_length; for(int i=0;i<array_length;i++){ temp = array_length-nnn; for(int k=0;k<b;k++){ ans += a[i] * n * pow(10,temp); if(k !=0){ n=n+n; } temp=temp-1; cout << ans <<endl; } nn=nn*2; n=nn; nnn++; b--; } return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | __int64 ans =0; | ^~~~~~~ | __int64_t a.cc:8:16: error: expected ';' before 'a' 8 | __int64 a[10]; | ^~ | ; a.cc:12:17: error: 'a' was not declared in this scope 12 | a[i] = s[i]-'0'; | ^ a.cc:22:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | ans += a[i] * n * pow(10,temp); | ^~~ | abs a.cc:22:32: error: 'a' was not declared in this scope 22 | ans += a[i] * n * pow(10,temp); | ^ a.cc:22:43: error: 'pow' was not declared in this scope 22 | ans += a[i] * n * pow(10,temp); | ^~~
s792193574
p03999
C++
# coding: utf-8 answer = 0 def calc(leftnum, sum, tempsum , is_insert): hitoketa = leftnum % 10 leftnum = int(leftnum / 10) if tempsum == 0: tempsum = hitoketa else: tempsum = int(str(hitoketa) + str(tempsum)) if is_insert: sum += tempsum tempsum = 0 if leftnum == 0: if is_insert: global answer answer += sum return calc(leftnum, sum, tempsum, True) calc(leftnum, sum, tempsum, False) if __name__ == '__main__': inp = int(input()) calc(inp, 0, 0, True) calc(inp, 0, 0, False) print(answer)
a.cc:1:3: error: invalid preprocessing directive #coding 1 | # coding: utf-8 | ^~~~~~ a.cc:29:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 29 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:3:1: error: 'answer' does not name a type 3 | answer = 0 | ^~~~~~
s501677772
p03999
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; //double pi=3.1415926535898; //double pi=acos(-1.0); #define scarr(a,s,e) for(int i=s;i<=int(e);i++) scanf("%d ",&a[i]); #define prarr(a,s,e) for(int i=s;i<=int(e);i++) printf("%d ",a[i]); #define speed ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL); #define rng(i,a,b) for(int i=a;i>=int(b);i--) #define rep(i,a,b) for(int i=a;i<=int(b);++i) #define lop(i,n) for(int i=0;i<int(n);i++) #define ms(x,a) memset(x,a,sizeof(x)) #define all(x) (x).begin(),(x).end() #define sz(x) int(x.size()) #define pb push_back #define mkp make_pair #define fr first #define se second #define sc(x) scanf("%d",&x) #define scl(x) scanf("%lld",&x) #define pr(x) printf("%d ",x) #define prl(x) printf("%lld ",x) #define prln(x) printf("%d\n",x) #define prlln(x) printf("%lld\n",x) #define r0 return 0; #define CC continue; #define scd(x) scanf("%lf",&x) #define prd(x) printf("%.10f\n",x); #define bb(x) cerr<< x <<endl; #define ii pair<int,int> #define vi vector<int> //#define max(a,b) a<b?b:a //#define min(a,b) a<b?a:b const ll M = 1e7+9 ; const ll inf = 1e19 ; const int si = 1e5+9 ; ////////////////////// Hi ^_^ hack me if you can :P string s; ll ans; void solve(ll i,ll a,ll b) { if(i==n) { ans+=a+b; return; } solve(i+1,a+b,s[i]-'0'); solve(i+1,a,(s[i]-'0')+10*c); } int main() { cin >> s; n =sz(s); solve(0,0,0); cout<< ans/2 ; r0; }
a.cc:35:16: warning: overflow in conversion from 'double' to 'll' {aka 'long long int'} changes value from '1.0e+19' to '9223372036854775807' [-Woverflow] 35 | const ll inf = 1e19 ; | ^~~~ a.cc: In function 'void solve(ll, ll, ll)': a.cc:42:11: error: 'n' was not declared in this scope 42 | if(i==n) | ^ a.cc:48:31: error: 'c' was not declared in this scope 48 | solve(i+1,a,(s[i]-'0')+10*c); | ^ a.cc: In function 'int main()': a.cc:53:5: error: 'n' was not declared in this scope; did you mean 'yn'? 53 | n =sz(s); | ^ | yn
s555131583
p03999
C++
#include <iostream> #include <string> #include <cmath> #include <vector> #include <algorithm> #include <stdlib.h> using namespace std; long long int calc(long long int pre, int offset, const char *str) { long long int res = 0; string tmp = ""; char* pEnd; if (strlen(str) == offset) { res = pre + strtoll(str, &pEnd, 10); } else { // + for (int i = 0; i < offset; i++) { tmp += str[i]; } res += calc(pre + atoi(tmp.c_str()), 1, &str[offset]); // no res += calc(pre, offset + 1, str); } return res; } int main() { string s; cin >> s; cout << calc(0, 1, s.c_str()); return 0; }
a.cc: In function 'long long int calc(long long int, int, const char*)': a.cc:16:13: error: 'strlen' was not declared in this scope 16 | if (strlen(str) == offset) { | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <stdlib.h> +++ |+#include <cstring> 7 |
s249547579
p03999
C++
#include<stdio.h> typedef long long int ll; char a[11]; ll as(int b, ll c. ll d){ if(a[b]=='\0') return c+d; else return as(b+1, c*10+a[n]-'0')+as(b+1,a[b]-'0',d+c); } int main(){ scanf("%s",a); printf("%lld\n",as(1,a[0]-'0',0)); return 0; }
a.cc:4:18: error: expected ',' or '...' before '.' token 4 | ll as(int b, ll c. ll d){ | ^ a.cc: In function 'll as(int, ll)': a.cc:5:33: error: 'd' was not declared in this scope 5 | if(a[b]=='\0') return c+d; | ^ a.cc:6:36: error: 'n' was not declared in this scope 6 | else return as(b+1, c*10+a[n]-'0')+as(b+1,a[b]-'0',d+c); | ^ a.cc:6:60: error: 'd' was not declared in this scope 6 | else return as(b+1, c*10+a[n]-'0')+as(b+1,a[b]-'0',d+c); | ^ a.cc: In function 'int main()': a.cc:10:27: error: too many arguments to function 'll as(int, ll)' 10 | printf("%lld\n",as(1,a[0]-'0',0)); | ~~^~~~~~~~~~~~~~ a.cc:4:4: note: declared here 4 | ll as(int b, ll c. ll d){ | ^~
s251761367
p03999
C++
#include<stdio.h> typedef long long int ll; char a[11]; ll as(int b, ll c, ll d){ if(a[b]=='\0') return c+d else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); } int main(){ scanf("%s",a); printf("%11d\n",as(1,a[0]-'0',0)); }
a.cc: In function 'll as(int, ll, ll)': a.cc:5:34: error: expected ';' before 'else' 5 | if(a[b]=='\0') return c+d | ^ | ; 6 | else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); | ~~~~
s344250433
p03999
C++
#include<stdio.h> typedef long long int ll; char a[11]; ll as(int b, ll c, ll d){ if(a[b]=='\0') return c+d; else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); } int mian(){ scanf("%s",a); printf("%11d\n",as(1,a[0]-'0',0)); return 0; }
/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
s326516412
p03999
C++
#include<stdio.h> typedef long long int ll char a[11]; ll as(int b, ll c, ll d){ if(a[b]=='\0') return c+d else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); } int main(){ scanf("%s",a); printf("%11d\n",as(1,a[0]-'0',0)); }
a.cc:3:1: error: expected initializer before 'char' 3 | char a[11]; | ^~~~ a.cc:4:1: error: 'll' does not name a type 4 | ll as(int b, ll c, ll d){ | ^~ a.cc: In function 'int main()': a.cc:10:20: error: 'a' was not declared in this scope 10 | scanf("%s",a); | ^ a.cc:11:25: error: 'as' was not declared in this scope 11 | printf("%11d\n",as(1,a[0]-'0',0)); | ^~
s725497740
p03999
C++
#include <stdio.h> typedef long long int ll; char a[11]; ll as(int b, llc, lld){ if(a[b]=='\0') return c+d; else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); } int main(){ scanf("%s",a); printf("%lld",as(1,a[0]-'0',0)); return 0; }
a.cc:4:14: error: 'llc' has not been declared 4 | ll as(int b, llc, lld){ | ^~~ a.cc:4:19: error: 'lld' has not been declared 4 | ll as(int b, llc, lld){ | ^~~ a.cc: In function 'll as(int, int, int)': a.cc:5:31: error: 'c' was not declared in this scope 5 | if(a[b]=='\0') return c+d; | ^ a.cc:5:33: error: 'd' was not declared in this scope 5 | if(a[b]=='\0') return c+d; | ^ a.cc:6:29: error: 'c' was not declared in this scope 6 | else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); | ^ a.cc:6:43: error: 'd' was not declared in this scope 6 | else return as(b+1, c*10+a[b]-'0',d)+as(b+1,a[b]-'0',d+c); | ^
s211640838
p03999
C++
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <fstream> using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } template<class T> inline T sqr(T x) { return x*x; } typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<long long int> vll; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define P(p) cout<<(p)<<endl; #define VEC_2D(a,b) vector<vector<int> >(a, vector<int>(b, 0)) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define INF (1100000000) #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define MOD 1000000007LL #define FSP(a) cout << fixed << setprecision(a) int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x%y); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } bool is_prime(int n) { for (int i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return n != 1; } map<int, int> prime_factor(int n) { map<int, int> res; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { ++res[i]; n /= i; } } if (n != 1) res[n] = 1; return res; } int extgcd(int a, int b, int& x, int& y) {// int d = a; if (b != 0) { d = extgcd(b, a%b, y, x); y -= (a / b)*x; } else { x = 1; y = 0; } return d; } ll mod_pow(ll x, ll n, ll mod) { if (n == 0) return 1; ll res = mod_pow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } vector<string> split(const string &str, char delim) { vector<string> res; size_t current = 0, found; while ((found = str.find_first_of(delim, current)) != string::npos) { res.push_back(string(str, current, found - current)); current = found + 1; } res.push_back(string(str, current, str.size() - current)); return res; } bool is_kadomatsu(int a, int b, int c) { if (a == b || a == c || b == c)return false; if (a > b && c > b) return true; if (a < b && c < b)return true; return false; } struct UF { int n; vi d; UF(){} UF(int n):n(n),d(n,-1){} int root(int v) { if (d[v] < 0) return v; return d[v] = root(d[v]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (size(x) < size(y)) swap(x, y); d[x] += d[y]; d[y] = x; return true; } int size(int v) { return -d[root(v)]; } }; vector<int> divisor(int n) { if (n == 1) return{}; vi res; for (int i = 1; i*i <= n; i++) { if (n%i == 0) { res.emplace_back(i); if (i != 1 && i != n / i)res.emplace_back(n / i); } } return res; } //------------------------------------------------------------- int main() { cin.tie(0); ios::sync_with_stdio(false); string S; int N; cin >> S; N = S.length(); ll ans = 0; rep(i, 0, 1 << (N - 1)) { ll sm = 0; ll a = S[0] - '0'; rep(j, 0, N - 1) { if (i & (1 << j)) { sm += a; a = 0; } a = a * 10 + S[j + 1] - '0'; } sm += a; ans += sm; } P(ans); return 0; //ifstream ifs("soc-LiveJournal1.txt"); //グラフの読み込み //ofstream output("soc-LiveJournal2.txt"); //int u, v; //string s; //bool is_0_start = false; //int count = 0; //rep(i, 4) getline(ifs, s); //for (; ifs >> u >> v;) { // if (u == 0) is_0_start = true; // if (!is_0_start) { // u--; // v--; // } // count++; // if(count%10000==0)cout << count << endl; // output << u << " " << v << endl; //} }
a.cc:162:31: error: macro "rep" passed 3 arguments, but takes just 2 162 | rep(i, 0, 1 << (N - 1)) { | ^ a.cc:43:9: note: macro "rep" defined here 43 | #define rep(i,n) FOR(i,0,n) | ^~~ a.cc:165:32: error: macro "rep" passed 3 arguments, but takes just 2 165 | rep(j, 0, N - 1) { | ^ a.cc:43:9: note: macro "rep" defined here 43 | #define rep(i,n) FOR(i,0,n) | ^~~ a.cc: In function 'int main()': a.cc:162:9: error: 'rep' was not declared in this scope 162 | rep(i, 0, 1 << (N - 1)) { | ^~~
s894120324
p03999
C++
#include <iostream> #include <vector> //#include <cstdio> //#include <cstdlib> #include <sstream> using namespace std; int stoi(string s) { int x; istringstream stream(s); stream >> x; return x; } vector<int> split(const string &input, char delimiter) { istringstream stream(input); string field; vector<int> result; while(getline(stream, field, delimiter)) result.push_back(stoi(field)); return result; } int main() { string S; cin >> S; const int N = S.size()-1; int ans = 0; for(int i = 0; i < 1<<N; i++){ string Sp = S; int n = 0; for(int j = 0; j < N; j++) if((i & (1<<j)) != 0){ Sp.insert(j+n+1,"+"); n++; } vector<int> v = split(Sp, '+'); for(vector<int>::iterator ite = v.begin(); ite != v.end(); ite++){ //cout << *ite << endl; ans += *ite; } } cout << ans << endl; }
a.cc: In function 'std::vector<int> split(const std::string&, char)': a.cc:23:26: error: call of overloaded 'stoi(std::string&)' is ambiguous 23 | result.push_back(stoi(field)); | ~~~~^~~~~~~ a.cc:9:5: note: candidate: 'int stoi(std::string)' 9 | int stoi(string s) | ^~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, 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) | ^~~~
s184090095
p03999
C++
int power10_memo[11]; int fact_memo[11]; int nchoosek(int n, int k){ return fact_memo[n]/(fact_memo[n-k]*fact_memo[k]); } long long formulas(string in){ vector<int> digit_nums; fact_memo[0] = 1; power10_memo[0] = 1; for(int i = 1; i < 11; i++){ fact_memo[i] = fact_memo[i-1]*i; power10_memo[i] = power10_memo[i-1]*10; } int combs = 0; int n = in.length()-1; for(int k = 0; k <= in.length()-1; k++) combs += nchoosek(n, k); digit_nums.insert(digit_nums.begin(), combs); long long sum = 0; for(int i = in.length()-1; i >= 0; i--){ for(int j = digit_nums.size()-1; j >= 0; j--){ int num_times = digit_nums[j]; sum += num_times*(long long)power10_memo[digit_nums.size()-1-j]*(in[i]-48); } digit_nums[0] /= 2; digit_nums.insert(digit_nums.begin(), digit_nums[0]); } return sum; } int main() { string input; cin >> input; cout << formulas(input) << endl; return 0; }
a.cc:7:20: error: 'string' was not declared in this scope 7 | long long formulas(string in){ | ^~~~~~ a.cc: In function 'int main()': a.cc:37:5: error: 'string' was not declared in this scope 37 | string input; | ^~~~~~ a.cc:38:5: error: 'cin' was not declared in this scope 38 | cin >> input; | ^~~ a.cc:38:12: error: 'input' was not declared in this scope; did you mean 'int'? 38 | cin >> input; | ^~~~~ | int a.cc:40:5: error: 'cout' was not declared in this scope 40 | cout << formulas(input) << endl; | ^~~~ a.cc:40:21: error: 'formulas' cannot be used as a function 40 | cout << formulas(input) << endl; | ~~~~~~~~^~~~~~~ a.cc:40:32: error: 'endl' was not declared in this scope 40 | cout << formulas(input) << endl; | ^~~~
s606634587
p03999
C++
long a,b;main(i,c){for(;c=getchar()-48,c>0;b=b*10+i*c,i*=2)a+=a+b;printf("%ld\n",a+b);}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
a.cc:1:14: error: expected constructor, destructor, or type conversion before '(' token 1 | long a,b;main(i,c){for(;c=getchar()-48,c>0;b=b*10+i*c,i*=2)a+=a+b;printf("%ld\n",a+b);}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ^
s028007884
p03999
C++
long a,b;main(i,c){for(;c=getchar()-48,c>0;b=b*10+i*c,i*=2)a+=a+b;printf("%ld\n",a+b);}//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
a.cc:1:14: error: expected constructor, destructor, or type conversion before '(' token 1 | long a,b;main(i,c){for(;c=getchar()-48,c>0;b=b*10+i*c,i*=2)a+=a+b;printf("%ld\n",a+b);}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ^
s161986954
p03999
C++
long a,b,i;main(c){for(;c=getchar()-48,c;b=b*10+(1l<<i++)*c)a+=a+b;printf("%ld\n",a+b);}
a.cc:1:16: error: expected constructor, destructor, or type conversion before '(' token 1 | long a,b,i;main(c){for(;c=getchar()-48,c;b=b*10+(1l<<i++)*c)a+=a+b;printf("%ld\n",a+b);} | ^
s785180310
p03999
C++
#include<iostream> #include<string> using namespace std; int main() { char str[11]; int s = 0, ss = 0, l, m[11], a, b, c; cin >> str; l = strlen(str); for (a = 0; a < l; a++) { for (b = 0; b < l - a; b++) { for (c = 0; c < a; c++) { m[c] = str[c]; s = s * 10 + m[c]; } cout << s << endl; ss += s; s = 0; } } cout << ss << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'strlen' was not declared in this scope 13 | l = strlen(str); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>
s709786722
p03999
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> #include <utility> using namespace std; int main(){ _int64 s, m[10],sum; cin >> s; int j = 0; while (1){ m[j] = s % 10; s = s / 10; j++; if (s == 0)break; } //sはj桁の数、m[0]は一の位 sum = 0; for (int i = 0; i < pow(2, j - 1); i++){ _int64 tmp = m[0]; if (j > 1){ _int64 jj = i; int mul = 1; for (int k = 1; k < j; k++){ if (jj % 2 == 0)mul = mul * 10; else mul = 1; tmp += m[k] * mul; jj = jj / 2; } } sum += tmp; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: '_int64' was not declared in this scope; did you mean 'sinf64'? 9 | _int64 s, m[10],sum; | ^~~~~~ | sinf64 a.cc:10:16: error: 's' was not declared in this scope 10 | cin >> s; | ^ a.cc:13:17: error: 'm' was not declared in this scope 13 | m[j] = s % 10; | ^ a.cc:19:9: error: 'sum' was not declared in this scope 19 | sum = 0; | ^~~ a.cc:21:23: error: expected ';' before 'tmp' 21 | _int64 tmp = m[0]; | ^~~~ | ; a.cc:23:31: error: expected ';' before 'jj' 23 | _int64 jj = i; | ^~~ | ; a.cc:26:37: error: 'jj' was not declared in this scope; did you mean 'j'? 26 | if (jj % 2 == 0)mul = mul * 10; | ^~ | j a.cc:28:33: error: 'tmp' was not declared in this scope; did you mean 'tm'? 28 | tmp += m[k] * mul; | ^~~ | tm a.cc:28:40: error: 'm' was not declared in this scope 28 | tmp += m[k] * mul; | ^ a.cc:29:33: error: 'jj' was not declared in this scope; did you mean 'j'? 29 | jj = jj / 2; | ^~ | j a.cc:32:24: error: 'tmp' was not declared in this scope; did you mean 'tm'? 32 | sum += tmp; | ^~~ | tm
s091684976
p03999
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) #define int long long typedef long long ll; using namespace std; string S; ll ans = 0; int keta(ll num) { int ret = 0; while (num > 0) { ret++; num /= 10; } return ret; } ll stoi(string s) { ll ten = 1; ll ans = 0; for (int i=s.length()-1; i>=0; i--) { ans += ten * (s[i] - '0'); ten *= 10; } return ans; } signed main() { cin >> S; //int k = keta(S); int k = S.length(); k--; for (int i=0; i<1<<k; i++) { string pre_num = ""; int wa = 0; for (int j=0; j<k; j++) { pre_num += S[j]; if (i >> j & 1) { wa += stoi(pre_num); pre_num = ""; } } pre_num += S[k]; wa += stoi(pre_num); ans += wa; } //ans += atoi(S.c_str()); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:44:43: error: call of overloaded 'stoi(std::string&)' is ambiguous 44 | wa += stoi(pre_num); | ~~~~^~~~~~~~~ a.cc:20:4: note: candidate: 'll stoi(std::string)' 20 | ll stoi(string s) { | ^~~~ 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) | ^~~~ a.cc:49:27: error: call of overloaded 'stoi(std::string&)' is ambiguous 49 | wa += stoi(pre_num); | ~~~~^~~~~~~~~ a.cc:20:4: note: candidate: 'll stoi(std::string)' 20 | ll stoi(string s) { | ^~~~ /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) | ^~~~
s382949048
p04000
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_back #define pop() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> &a,int b){ auto c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> &a,int b){ auto c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;i+=2){ if (a%i==0) return false; } return true; } struct Union{ vector<int> par; Union(int a){ par=vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // a^{-1} mod を計算する long long modinv(long long a, long long mod) { return modpow(a, mod - 2, mod); } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(200005); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } struct segmin{ vector<int> seg; int b; segmin(V<int> a){ b=1; while(b<a.sz) b*=2; seg=vector<int>(2*b-1,inf); fo(i,a.sz){ seg[i+b-1]=a[i]; } for(int i=b-2;i>=0;i--){ seg[i]=min(seg[2*i+1],seg[2*i+2]); } } void update(int i,int a){ i+=b-1; seg[i]=a; while(i){ i=(i-1)/2; seg[i]=min(seg[2*i+1],seg[2*i+2]); } } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ int getmin(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return INF; if(x<=l&&r<=y) return seg[a]; int a1=getmin(x,y,2*a+1,l,(l+r)/2); int a2=getmin(x,y,2*a+2,(l+r)/2,r); return min(a1,a2); } }; struct segadd{ vector<int> seg; int b; segadd(V<int> a){ b=1; while(b<a.sz) b*=2; seg=vector<int>(2*b-1,0); fo(i,a.sz){ seg[i+b-1]=a[i]; } for(int i=b-2;i>=0;i--){ seg[i]=seg[2*i+1]+seg[2*i+2]; } } void update(int i,int a){ i+=b-1; seg[i]=a; while(i){ i=(i-1)/2; seg[i]=seg[2*i+1]+seg[2*i+2]; } } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ int getadd(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return 0; if(x<=l&&r<=y) return seg[a]; int a1=getadd(x,y,2*a+1,l,(l+r)/2); int a2=getadd(x,y,2*a+2,(l+r)/2,r); return a1+a2; } }; struct sege{ vector<P<int,V<int>>> seg; int b; sege(string a){ b=1; while(b<a.sz) b*=2; seg=vector<P<int,V<int>>>(2*b-1); fo(i,a.sz){ seg[i+b-1].fi=1; seg[i+b-1].se.pb(a[i]-'a'); } for(int i=b-2;i>=0;i--){ V<int> d=seg[2*i+1].se; fo(j,seg[2*i+2].se.sz){ d.pb(seg[2*i+2].se[j]); } Sort(d); uni(d); seg[i].se=d; seg[i].fi=d.sz; } } V<int> mu; void update(int i,char a){ i+=b-1; seg[i].se=mu; seg[i].se.pb(a-'a'); seg[i].fi=1; while(i){ i=(i-1)/2; V<int> d=seg[2*i+1].se; fo(j,seg[2*i+2].se.sz){ d.pb(seg[2*i+2].se[j]); } Sort(d); uni(d); seg[i].se=d; seg[i].fi=d.sz; } } void unko(){ fo(i,2*b-1) cout<<seg[i].fi<<' '; } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ P<int,V<int>> gete(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return {0,mu}; if(x<=l&&r<=y) return seg[a]; P<int,V<int>> a1=gete(x,y,2*a+1,l,(l+r)/2); P<int,V<int>> a2=gete(x,y,2*a+2,(l+r)/2,r); fo(i,a2.se.sz) a1.se.pb(a2.se[i]); Sort(a1.se); uni(a1.se); return {a1.se.sz,a1.se}; } };/* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ //aのb乗mod c int kurikaesijijou(int a,int b,int c){ a%=c; b%=c; if(b==0) return 1; if(b%2==0){ int d=kurikaesijijou(a,b/2,c); d%=c; return d*d%c; } return a*kurikaesijijou(a,b-1,c)%c; } int waINF(int a){ if(a>=0) return a%INF; return (a+INF*INF)%INF; } /*void soinsuu_init(int a){ }*/ //aは辺のvector,bは最短距離の表 bool find_negative_roop(V<P<P<int,int>,int>> a,V<int> b){ V<int> d(b.sz,1),e; fo(i,3*b.sz){ fo(j,a.sz){ P<P<int,int>,int> c=a[j]; if(b[c.ff]!=inf&&b[c.fs]>b[c.ff]+c.se){ b[c.fs]=b[c.ff]+c.se; if(i>=b.sz-1&&d[c.ff]){ d[c.ff]=0; e.pb(c.ff); } if(i>=b.sz-1&&d[c.fs]){ d[c.fs]=0; e.pb(c.fs); } } } } if(e.sz==0) return 0; Union f(b.sz); fo(i,e.sz-1){ f.unite(e[i],e[i+1]); } fo(j,b.sz){ fo(i,a.sz){ if(f.same(a[i].ff,e[0])){ f.unite(e[0],a[i].fs); } } } if(f.same(e[0],b.sz-1)) return 1; return 0; } signed main(){ int a,b,c; cin>>a>>b>>c; V<P<int,int>> d(c); fo(i,c) cin>>d[i].fi>>d[i].se; map<P<int,int>,int> e; fo(i,c){ for(int j=max(1,d[i].fi-2);j<=min(a,d[i].fi+2);j++){ for(int k=max(1,d[i].se-2);k<=min(b,d[i].se+2);k++){ e[{j,k}]++; } } } V<int> f(10); for(auto it:e){ f[e[it.se]]++; } cout<<e.sz<<endl; fo(i,9) cout<<f[i+1]<<endl; }
a.cc: In function 'int main()': a.cc:573:18: error: no matching function for call to 'max(int, long long int)' 573 | for(int j=max(1,d[i].fi-2);j<=min(a,d[i].fi+2);j++){ | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:573:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 573 | for(int j=max(1,d[i].fi-2);j<=min(a,d[i].fi+2);j++){ | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:573:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 573 | for(int j=max(1,d[i].fi-2);j<=min(a,d[i].fi+2);j++){ | ~~~^~~~~~~~~~~~~ a.cc:574:20: error: no matching function for call to 'max(int, long long int)' 574 | for(int k=max(1,d[i].se-2);k<=min(b,d[i].se+2);k++){ | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:574:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 574 | for(int k=max(1,d[i].se-2);k<=min(b,d[i].se+2);k++){ | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:574:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 574 | for(int k=max(1,d[i].se-2);k<=min(b,d[i].se+2);k++){ | ~~~^~~~~~~~~~~~~ a.cc:581:8: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, long long int>' and 'long long int') 581 | f[e[it.se]]++; | ^ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152: /usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; mapped_type = long long int; key_type = std::pair<long long int, long long int>]' 504 | operator[](const key_type& __k) | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:504:34: note: no known conversion for argument 1 from 'long long int' to 'const std::map<std::pair<long long int, long long int>, long long int>::key_type&' {aka 'const std::pair<long long int, long long int>&'} 504 | operator[](const key_type& __k) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; mapped_type = long long int; key_type = std::pair<long long int, long long int>]' 524 | operator[](key_type&& __k) | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:524:29: note: no known conversion for argument 1 from 'long long int' to 'std::map<std::pair<long long int, long long int>, long long int>::key_type&&' {aka 'std::pair<long long int, long long int>&&'} 524 | operator[](key_type&& __k) | ~~~~~~~~~~~^~~
s345109922
p04000
C++
#ifndef _TEMPLATE_ROOT #define _TEMPLATE_ROOT #include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define repl(i, a, b) for(ll i = a; i < (b); ++i) #define repd(i, a, b) for(int i = b; i >= (a); --i) #define repdl(i, a, b) for(ll i = b; i >= (a); --i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; } template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; } #endif #ifndef _TEMPLATE_IO #define _TEMPLATE_IO template<typename H> void read(H& head) { cin >> head; } template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); } template<typename H> void write(H head) { cout << head << '\n'; } template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); } template<typename ...T> void die(T ...tok) { write(tok...); exit(0); } #endif #ifndef _TEMPLATE_OPT #define _TEMPLATE_OPT #pragma GCC optimize("O3") #pragma GCC target("avx2") #endif using namespace std; namespace std { template<typename T, typename K> struct hash<pair<T, K>> { size_t operator()(pair<T, K> const& p) const noexcept { size_t h1 = std::hash<T>{}(p.first); size_t h2 = std::hash<K>{}(p.second); return h1 ^ (h2 << 1); } }; } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int h, w, n; read(h, w, n); map<pair<int, int>, int> mp; map<pair<int, int>> cons; rep(i, 0, n) { int x, y; read(x, y); mp[{x, y}] = 1; rep(a, -2, 1) rep(b, -2, 1) if (1 <= x + a && x + a <= h - 2 && 1 <= y + b && y + b <= w - 2) cons.insert({x + a, y + b}); } vector<ll> ans(10); for (auto p : cons) { int x, y; tie(x, y) = p; int cnt = 0; rep(i, 0, 3) rep(j, 0, 3) cnt += mp[{x + i, y + j}]; ans[cnt]++; } ans[0] = 1ll * (h - 2) * (w - 2); rep(i, 1, 10) ans[0] -= ans[i]; rep(i, 0, 10) write(ans[i]); }
a.cc: In function 'int main()': a.cc:49:20: error: wrong number of template arguments (1, should be at least 2) 49 | map<pair<int, int>> cons; | ^~ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152, from a.cc:3: /usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:56:14: error: request for member 'insert' in 'cons', which is of non-class type 'int' 56 | cons.insert({x + a, y + b}); | ^~~~~~ a.cc:60:17: error: 'begin' was not declared in this scope 60 | for (auto p : cons) { | ^~~~ a.cc:60:17: note: suggested alternatives: In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1238:5: note: 'std::begin' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ In file included from /usr/include/c++/14/filesystem:53, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200: /usr/include/c++/14/bits/fs_dir.h:608:3: note: 'std::filesystem::__cxx11::begin' 608 | begin(recursive_directory_iterator __iter) noexcept | ^~~~~ a.cc:60:17: error: 'end' was not declared in this scope 60 | for (auto p : cons) { | ^~~~ a.cc:60:17: note: suggested alternatives: /usr/include/c++/14/valarray:1265:5: note: 'std::end' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/fs_dir.h:613:3: note: 'std::filesystem::__cxx11::end' 613 | end(recursive_directory_iterator) noexcept | ^~~
s671759194
p04000
C
#include<stdio.h> #include<math.h> int main(){ int a[10000][2]; int f[10000]; int list[5][5]; int k[10]; int h,w,n,i,j,k,x,y,z,x2,y2; for(i=0;i<10;i++)k[i]=0; scanf("%d%d%d",&h,&w,&n); for(i=0;i<n;i++){ scanf("%d%d",&a[i][0],&a[i][1]); f[i]=0; if(a[i][0]-2<1||a[i][0]+2>w)f[i]|=(1<<1)+(1<<4)+(1<<7); if(a[i][0]-1<1)f[i]|=(1<<0)+(1<<3)+(1<<6); if(a[i][0]+1>w)f[i]|=(1<<2)+(1<<5)+(1<<8); if(a[i][1]-2<1||a[i][1]+2>h)f[i]|=(1<<3)+(1<<4)+(1<<5); if(a[i][1]-1<1)f[i]|=(1<<0)+(1<<1)+(1<<2); if(a[i][1]+1>h)f[i]|=(1<<6)+(1<<7)+(1<<8); } for(i=0;i<n;i++){ for(j=0;j<5;j++)for(k=0;k<5;k++)list[j][k]=0; list[2][2]=i; for(j=i+1;j<n;j++){ x=a[j][0]-a[i][0];y=a[j][1]-a[i][1]; if(abs(x)<3&&abs(y)<3){list[2+x][2+y]=j;} } for(y=0;y<3;y++){ for(x=0;x<3;x++){ z=0; if(!(f[i]&(1<<(y*3+x)))){ for(y2=0;y2<3;y2++){ for(x2=0;x2<3;x2++){ if(list[x+x2][y+y2]){ z++; f[list[x+x2][y+y2]]|=1<<(2-x2)+(2-y2)*3; } } } } k[z]++; } } } k[0]=(h-2)*(w-2); for(i=1;i<10;i++)k[0]-=k[i]; for(i=0;i<10;i++)printf("%d\n",k[i]); }
main.c: In function 'main': main.c:8:17: error: conflicting types for 'k'; have 'int' 8 | int h,w,n,i,j,k,x,y,z,x2,y2; | ^ main.c:7:7: note: previous declaration of 'k' with type 'int[10]' 7 | int k[10]; | ^ main.c:26:10: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration] 26 | if(abs(x)<3&&abs(y)<3){list[2+x][2+y]=j;} | ^~~ main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs' 2 | #include<math.h> +++ |+#include <stdlib.h> 3 | int main(){
s164704787
p04000
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))) #define tii tuple<int,int,int> #define Priq priority_queue<int,vi,greater<int>> #define pb push_back #define mp make_pair #define INF (1ll<<60) signed main(){ int H,W,N; cin>>H>>W>>N; vi ans(10); ans[0]=(H-2)*(W-2); set<pii> S; rep(_,0,N){ int A,B; cin>>A>>B; S.insert(mp(A,B)); } vi R={0,0,1,1,1,-1,-1,-1,0},S={1,-1,0,-1,1,-1,0,1,0}; for(auto p:S){ int X=p.first,Y=p.second; rep(i,0,9){ int A=X+R[i],B=Y+S[i]; if(1<A&&A<H&&1<B&&B<W){ int count=0; rep(j,0,9){ int C=A+R[j],D=B+S[j]; if((C<=A||D<=B)&&(A!=C||B!=D)){ count=-1; break; } if(S.count(mp(C,D))) count++; } if(count!=-1){ ans[0]--; ans[count]++; } } } } rep(i,0,10) cout<<ans[i]<<endl; }
a.cc: In function 'int main()': a.cc:28:31: error: conflicting declaration 'std::vector<long long int> S' 28 | vi R={0,0,1,1,1,-1,-1,-1,0},S={1,-1,0,-1,1,-1,0,1,0}; | ^ a.cc:23:12: note: previous declaration as 'std::set<std::pair<long long int, long long int> > S' 23 | set<pii> S; | ^ a.cc:32:25: error: no match for 'operator[]' (operand types are 'std::set<std::pair<long long int, long long int> >' and 'long long int') 32 | int A=X+R[i],B=Y+S[i]; | ^ a.cc:36:29: error: no match for 'operator[]' (operand types are 'std::set<std::pair<long long int, long long int> >' and 'long long int') 36 | int C=A+R[j],D=B+S[j]; | ^
s584777962
p04000
C++
#include<bits/stdc++.h> #define rep(i, s, n) for (int i=(s); i<(n); i++) #define ll long long using namespace std; int main() { set<pair<int, int>> S; set<pair<int, int>> S2; ll H,W,N; ll res[10]; cin>>H>>W>>N; rep(i, 0, N) { int x,y; cin>>x>>y; S.insert({x, y}); rep(j, -1, 2) { rep(k, -1, 2) { S2.insert({x+j, y+k}); } } } res[0]=(H-2)*(W-2); for (auto r : S2) { int x=r.first; int y=r.second; if (x<=1||x>H-1) continue; if (y<=1||y>W-1) continue; int tmp=0; rep(j, -1, 2) rep(k, -1, 2) tmp+=S.count({x+j, y+k}); res[tmp]++; res[0]--; } rep(i, 0, 10) cout<<res[i]<<endl; } F
a.cc:34:1: error: 'F' does not name a type 34 | F | ^
s722703813
p04000
C++
import sys input = sys.stdin.readline from collections import Counter h,w,n=map(int,input().split()) c=Counter() for _ in range(n): a,b=map(int,input().split()) for i in [-1,0,1]: for j in [-1,0,1]: if 2<=a+i<w and 2<=b+j<h: c[a+i,b+j]+=1 #print(c.items()) c2=Counter(c.values()) print((h-2)*(w-2)-sum(c2.values())) for i in range(1,10): print(c2[i])
a.cc:12:2: error: invalid preprocessing directive #print 12 | #print(c.items()) | ^~~~~ a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s609730551
p04000
Java
import java.util.*; import javafx.util.Pair; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = Integer.parseInt(sc.next()); int W = Integer.parseInt(sc.next()); int N = Integer.parseInt(sc.next()); // HashMap<ArrayList<Integer>, Integer> map = new HashMap<ArrayList<Integer>, Integer>(); HashMap<Pair<Integer, Integer>, Integer> map = new HashMap<Pair<Integer, Integer>, Integer>(); for (int i=0;i<N;i++) { int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); for (int j=-1;j<=1;j++) { for (int k=-1;k<=1;k++) { if (a+j<2 || a+j>H-1) continue; if (b+k<2 || b+k>W-1) continue; // ArrayList<Integer> add = new ArrayList<Integer>(); // add.add(a+j); // add.add(b+k); Pair<Integer, Integer> add = new Pair<Integer, Integer>(a+j, b+k); if (map.containsKey(add)) { map.put(add, map.get(add)+1); } else { map.put(add, 1); } } } } ArrayList<Integer> val = new ArrayList<Integer>(map.values()); long[] ans = new long[10]; long sum = 0L; for (int i=0;i<val.size();i++) { sum++; ans[val.get(i)]++; } ans[0]=(long)(H-2)*(W-2)-sum; for (int i=0;i<10;i++) { System.out.println(ans[i]); } // System.out.println(map); } }
Main.java:2: error: package javafx.util does not exist import javafx.util.Pair; ^ Main.java:11: error: cannot find symbol HashMap<Pair<Integer, Integer>, Integer> map = new HashMap<Pair<Integer, Integer>, Integer>(); ^ symbol: class Pair location: class Main Main.java:11: error: cannot find symbol HashMap<Pair<Integer, Integer>, Integer> map = new HashMap<Pair<Integer, Integer>, Integer>(); ^ symbol: class Pair location: class Main Main.java:22: error: cannot find symbol Pair<Integer, Integer> add = new Pair<Integer, Integer>(a+j, b+k); ^ symbol: class Pair location: class Main Main.java:22: error: cannot find symbol Pair<Integer, Integer> add = new Pair<Integer, Integer>(a+j, b+k); ^ symbol: class Pair location: class Main 5 errors
s348316186
p04000
Java
import java.util.*; import javafx.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = Integer.parseInt(sc.next()); int W = Integer.parseInt(sc.next()); int N = Integer.parseInt(sc.next()); // HashMap<ArrayList<Integer>, Integer> map = new HashMap<ArrayList<Integer>, Integer>(); HashMap<Pair<Integer, Integer>, Integer> map = new HashMap<Pair<Integer, Integer>, Integer>(); for (int i=0;i<N;i++) { int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); for (int j=-1;j<=1;j++) { for (int k=-1;k<=1;k++) { if (a+j<2 || a+j>H-1) continue; if (b+k<2 || b+k>W-1) continue; // ArrayList<Integer> add = new ArrayList<Integer>(); // add.add(a+j); // add.add(b+k); Pair<Integer, Integer> add = new Pair<Integer, Integer>(a+j, b+k); if (map.containsKey(add)) { map.put(add, map.get(add)+1); } else { map.put(add, 1); } } } } ArrayList<Integer> val = new ArrayList<Integer>(map.values()); long[] ans = new long[10]; long sum = 0L; for (int i=0;i<val.size();i++) { sum++; ans[val.get(i)]++; } ans[0]=(long)(H-2)*(W-2)-sum; for (int i=0;i<10;i++) { System.out.println(ans[i]); } // System.out.println(map); } }
Main.java:2: error: package javafx.util does not exist import javafx.util.*; ^ Main.java:11: error: cannot find symbol HashMap<Pair<Integer, Integer>, Integer> map = new HashMap<Pair<Integer, Integer>, Integer>(); ^ symbol: class Pair location: class Main Main.java:11: error: cannot find symbol HashMap<Pair<Integer, Integer>, Integer> map = new HashMap<Pair<Integer, Integer>, Integer>(); ^ symbol: class Pair location: class Main Main.java:22: error: cannot find symbol Pair<Integer, Integer> add = new Pair<Integer, Integer>(a+j, b+k); ^ symbol: class Pair location: class Main Main.java:22: error: cannot find symbol Pair<Integer, Integer> add = new Pair<Integer, Integer>(a+j, b+k); ^ symbol: class Pair location: class Main 5 errors
s034132557
p04000
C++
#include<bits/stdc++.h> using namespace std; #define pb push_back #define f first #define s second #define all(container) container.begin(),container.end() #define fast ios::sync_with_stdio(0); cin.tie(0) #ifndef ONLINE_JUDGE #include "debug.cpp" #endif #define int long long const int mod = 1e9+7; int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; } int h,w,n; set<pair<int,int>> se; int check(int x,int y){ int cnt = 0; for(int i=0;i<=2;i++){ for(int j=0;j<=2;j++){ if(x+i>=1&&x+i<=h&&y+j>=1&&y+j<=w) cnt+=se.count({x+i,y+j}); else return 0; } } return cnt; } int32_t main(){ fast; cin >> h >> w >> n; for(int i=1;i<=n;i++){ int x,y; cin >> x >> y; se.insert({x,y}); } vector<pair<int,int>> vp(all(se)); int ans[10]={0}; set<pair<int,int>> used; for(int idx=0;idx<vp.size();idx++){ int x = vp[idx].f , y = vp[idx].s; for(int i=-2;i<1;i++){ for(int j=-2;j<1;j++){ if(!used.count({x+i,y+j})){ ans[check(x+i,y+j)]++; used.insert({x+i,y+j}); } } } } int sum = 0; for(int k=1;k<10;k++) sum+=ans[k]; ans[0] = (h-2)*(w-2) - sum; for(int k : ans) cout << k << '\n'; return 0; }
a.cc:9:10: fatal error: debug.cpp: No such file or directory 9 | #include "debug.cpp" | ^~~~~~~~~~~ compilation terminated.
s193867962
p04000
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<deque> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> using namespace std; typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; typedef long double ld; const int inf=1e9+7; const ll INF=1LL<<60 ; const ll mod=1e9+7 ; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<int, int> P; typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; #define fr first #define sc second #define all(c) c.begin(),c.end() #define pb push_back #define debug(x) cout << #x << " = " << (x) << endl; using Graph = vector<vector<int> >; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } //#define int long long void solve() { int h, w, n; cin >> h >> w >> n; vector<P> x; map<P, int> mp; rep(i, n) { cin >> x[i].fr >> x[i].sc; rep(a, 3) { rep(b, 3) { if(x[i].fr - a >= - && x[i].sc - b >= 0) mp[P(x[i].fr - a, x[i].sc - b)] ++; } } } vector<int> cnt(10); for(auto p: mp) { int co = p.sc; if(p.sc >= 10) continue; cnt[p.sc] ++; } rep(j, 10) { cout << cnt[j] << endl; } } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(10); //init(); solve(); //cout << "finish" << endl; return 0; }
a.cc: In function 'void solve()': a.cc:61:37: error: wrong type argument to unary minus 61 | if(x[i].fr - a >= - && x[i].sc - b >= 0) mp[P(x[i].fr - a, x[i].sc - b)] ++; | ^~~~ a.cc:61:41: error: expected ')' before '[' token 61 | if(x[i].fr - a >= - && x[i].sc - b >= 0) mp[P(x[i].fr - a, x[i].sc - b)] ++; | ~ ^ | ) a.cc:61:40: error: label 'x' used but not defined 61 | if(x[i].fr - a >= - && x[i].sc - b >= 0) mp[P(x[i].fr - a, x[i].sc - b)] ++; | ^
s494637208
p04000
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<deque> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> using namespace std; typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; typedef long double ld; const int inf=1e9+7; const ll INF=1LL<<60 ; const ll mod=1e9+7 ; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<int, int> P; typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; #define fr first #define sc second #define all(c) c.begin(),c.end() #define pb push_back #define debug(x) cout << #x << " = " << (x) << endl; using Graph = vector<vector<int> >; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } //#define int long long void solve() { int h, w, n; cin >> h >> w >> n; vector<P> x; map<P, int> mp; rep(i, n) { cin >> x.fr >> x.sc; rep(a, 3) { rep(b, 3) { if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; } } } vector<int> cnt(10); for(auto p: mp) { int co = p.sc; if(p.sc >= 10) continue; cnt[p.sc] ++; } rep(j, 10) { cout << cnt[j] << endl; } } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(10); //init(); solve(); //cout << "finish" << endl; return 0; }
a.cc: In function 'void solve()': a.cc:43:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' 43 | #define fr first | ^~~~~ a.cc:58:18: note: in expansion of macro 'fr' 58 | cin >> x.fr >> x.sc; | ^~ a.cc:44:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 44 | #define sc second | ^~~~~~ a.cc:58:26: note: in expansion of macro 'sc' 58 | cin >> x.fr >> x.sc; | ^~ a.cc:43:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' 43 | #define fr first | ^~~~~ a.cc:61:22: note: in expansion of macro 'fr' 61 | if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; | ^~ a.cc:61:34: error: wrong type argument to unary minus 61 | if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; | ^~~~ a.cc:61:38: error: expected ')' before '.' token 61 | if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; | ~ ^ | ) a.cc:43:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' 43 | #define fr first | ^~~~~ a.cc:61:59: note: in expansion of macro 'fr' 61 | if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; | ^~ a.cc:44:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 44 | #define sc second | ^~~~~~ a.cc:61:69: note: in expansion of macro 'sc' 61 | if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; | ^~ a.cc:61:37: error: label 'x' used but not defined 61 | if(x.fr - a >= - && x.sc - b >= 0) mp[P(x.fr - a, x.sc - b)] ++; | ^