submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s240857904
p00174
C++
//3ゲーム目の最後の得点をどちらがとったのかが分からないので、このときは2点連続同じ人がとったと仮定する。 #include<iostream> #include<string.h> using namespace std; char s[3][102]; int main(){ int i,j; while( cin >> s[0] ){ if( s[0][0] == '0' ) break; cin >> s[1] >> s[2]; for( i = 0;i < 3;i++ ){ int cnt[2] = {0}; for( j = 1;j < strlen( s[i] );j++ ){ cnt[ s[i][j]-'A' ]++; } /*if( i == 2 ){ cnt[ s[i][j-1]-'A' ]++; }*/ else{ cnt[ s[i+1][0]-'A' ]++; } cout << cnt[0] << " " << cnt[1] << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:23:25: error: 'else' without a previous 'if' 23 | else{ | ^~~~
s004076386
p00174
C++
#include<iostream> #include<string> using namespace std; int main(){ strng s; while(cin>>s,s!="0"){ int a,b; a=b=0; for(int i=1;i<s.size();i++){ if(s[i]=='A') a++; else b++; } if(a>b) a++; else b++; cout<<a<<" "<<b<<endl; } }
a.cc: In function 'int main()': a.cc:6:9: error: 'strng' was not declared in this scope 6 | strng s; | ^~~~~ a.cc:7:20: error: 's' was not declared in this scope 7 | while(cin>>s,s!="0"){ | ^
s684552675
p00174
C++
#include<iostream> #include<cmath> #include<cstring> using namespace std; int main(){ char ta[1000]="",tmp[1000]; int a,b; while(true){ for(int i=0;i<3;i++){ cin>>ta; if(strcmp(ta,"0"==0)break; a=b=0; for(int j=(i>=1);ta[j]!='\0';j++){ (ta[j]=='A')?a++:b++; } (a>b)?a++:b++; cout<<" "<<a<<" "<<b<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:13:25: error: cannot convert 'bool' to 'const char*' 13 | if(strcmp(ta,"0"==0)break; | ~~~^~~ | | | bool In file included from /usr/include/c++/14/cstring:43, from a.cc:3: /usr/include/string.h:156:50: note: initializing argument 2 of 'int strcmp(const char*, const char*)' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ a.cc:14:14: error: expected ')' before ';' token 14 | a=b=0; | ^ | ) a.cc:13:11: note: to match this '(' 13 | if(strcmp(ta,"0"==0)break; | ^
s149392571
p00174
C++
#include <iostream> using namespace std; int main(){string a[3];while(cin>>a[0]){if(a=="0")break;int p[2]={};cin>>a[1]>>a[2];for(int i=0;i<a[0].size();i++)p[a[0][i]=='B']++;for(int i=1;i<a[1].size();i++)p[a[1][i]=='B']++;for(int i=1;i<a[2].size();i++)p[a[2][i]]++;cout<<p[0]<<" "<<p[1]<<endl;}}
a.cc: In function 'int main()': a.cc:3:45: error: comparison between distinct pointer types 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} and 'const char*' lacks a cast 3 | int main(){string a[3];while(cin>>a[0]){if(a=="0")break;int p[2]={};cin>>a[1]>>a[2];for(int i=0;i<a[0].size();i++)p[a[0][i]=='B']++;for(int i=1;i<a[1].size();i++)p[a[1][i]=='B']++;for(int i=1;i<a[2].size();i++)p[a[2][i]]++;cout<<p[0]<<" "<<p[1]<<endl;}} | ~^~~~~
s299956813
p00174
C++
#include <iostream> #include <cstring> using namespace std; int main(){ char serve[3][101]; char latestServe; int APoint[3]; int BPoint[3]; bool isDeuce = false; while(true){ cin >> serve[0]; if(strlen(serve) == 1){ break; } cin >> serve[1] >> serve[2]; APoint = 0; BPoint = 0; for(int i=0;i<3;i++){ for(int j=1;j<101;j++){ if(serve[i]=='A'){ APoint[i]++; }else if(serve[i]=='B'){ BPoint[i]++; }else if(serve[i]=='\0'){ break; } latestServe = serve[i]; if(APoint == BPoint && APoint == 10){ isDuce = true; } } if(isDuce){ if(latestDuce == 'A'){ APoint[i]++; }else{ BPoint[i]++; } }else{ if(APoint[i] > BPoint[i]){ APoint[i]++; }else{ BPoint[i]++; } } isDuce = false; cout << APoint[i] << ' ' << BPoint[i] << '\n'; } } return 0; }
a.cc: In function 'int main()': a.cc:13:27: error: cannot convert 'char (*)[101]' to 'const char*' 13 | if(strlen(serve) == 1){ | ^~~~~ | | | char (*)[101] In file included from /usr/include/c++/14/cstring:43, from a.cc:2: /usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)' 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~ a.cc:17:24: error: incompatible types in assignment of 'int' to 'int [3]' 17 | APoint = 0; | ~~~~~~~^~~ a.cc:18:24: error: incompatible types in assignment of 'int' to 'int [3]' 18 | BPoint = 0; | ~~~~~~~^~~ a.cc:22:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 22 | if(serve[i]=='A'){ | ~~~~~~~~^~~~~ a.cc:24:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 24 | }else if(serve[i]=='B'){ | ~~~~~~~~^~~~~ a.cc:26:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 26 | }else if(serve[i]=='\0'){ | ~~~~~~~~^~~~~~ a.cc:29:48: error: invalid conversion from 'char*' to 'char' [-fpermissive] 29 | latestServe = serve[i]; | ~~~~~~~^ | | | char* a.cc:30:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 30 | if(APoint == BPoint && APoint == 10){ | ~~~~~~~^~~~~ a.cc:31:41: error: 'isDuce' was not declared in this scope; did you mean 'isDeuce'? 31 | isDuce = true; | ^~~~~~ | isDeuce a.cc:34:28: error: 'isDuce' was not declared in this scope; did you mean 'isDeuce'? 34 | if(isDuce){ | ^~~~~~ | isDeuce a.cc:35:36: error: 'latestDuce' was not declared in this scope 35 | if(latestDuce == 'A'){ | ^~~~~~~~~~ a.cc:47:25: error: 'isDuce' was not declared in this scope; did you mean 'isDeuce'? 47 | isDuce = false; | ^~~~~~ | isDeuce
s584064201
p00174
C++
#include <iostream> #include <cstring> using namespace std; int main(){ char serve[3][101]; char latestServe; int APoint[3]; int BPoint[3]; bool isDeuce = false; while(true){ cin >> serve[0]; if(strlen(serve) == 1){ break; } cin >> serve[1] >> serve[2]; APoint = 0; BPoint = 0; for(int i=0;i<3;i++){ for(int j=1;j<101;j++){ if(serve[i]=='A'){ APoint[i]++; }else if(serve[i]=='B'){ BPoint[i]++; }else if(serve[i]=='\0'){ break; } latestServe = serve[i]; if(APoint == BPoint && APoint == 10){ isDeuce = true; } } if(isDeuce){ if(latestDuce == 'A'){ APoint[i]++; }else{ BPoint[i]++; } }else{ if(APoint[i] > BPoint[i]){ APoint[i]++; }else{ BPoint[i]++; } } isDeuce = false; cout << APoint[i] << ' ' << BPoint[i] << '\n'; } } return 0; }
a.cc: In function 'int main()': a.cc:13:27: error: cannot convert 'char (*)[101]' to 'const char*' 13 | if(strlen(serve) == 1){ | ^~~~~ | | | char (*)[101] In file included from /usr/include/c++/14/cstring:43, from a.cc:2: /usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)' 407 | extern size_t strlen (const char *__s) | ~~~~~~~~~~~~^~~ a.cc:17:24: error: incompatible types in assignment of 'int' to 'int [3]' 17 | APoint = 0; | ~~~~~~~^~~ a.cc:18:24: error: incompatible types in assignment of 'int' to 'int [3]' 18 | BPoint = 0; | ~~~~~~~^~~ a.cc:22:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 22 | if(serve[i]=='A'){ | ~~~~~~~~^~~~~ a.cc:24:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 24 | }else if(serve[i]=='B'){ | ~~~~~~~~^~~~~ a.cc:26:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 26 | }else if(serve[i]=='\0'){ | ~~~~~~~~^~~~~~ a.cc:29:48: error: invalid conversion from 'char*' to 'char' [-fpermissive] 29 | latestServe = serve[i]; | ~~~~~~~^ | | | char* a.cc:30:63: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 30 | if(APoint == BPoint && APoint == 10){ | ~~~~~~~^~~~~ a.cc:35:36: error: 'latestDuce' was not declared in this scope 35 | if(latestDuce == 'A'){ | ^~~~~~~~~~
s440732487
p00174
C++
#include <bits/stdc++.h> #define r(i,a,n) for(int i=a;i<n;i++) using namespace std; int main(){ while(cin>>s){ if(s[0]=='0')break; int a=0,b=0; r(i,0,s.size()){ if(s[i]=='A')a++; else b++; } cout<<a<<' '<<b<<endl; } }
a.cc: In function 'int main()': a.cc:5:20: error: 's' was not declared in this scope 5 | while(cin>>s){ | ^
s231250588
p00174
C++
#include<bits\stdc++.h> using namespace std; int main(void) { int i,j,k,a,b,f=0,cnt=0; char sabu[101]; while(1) { f=cnt=0; for(i=0;i<3;i++) { cin>>sabu; a=b=0; if(sabu[0]=='0') { cnt=1; break; } for(j=1;j<strlen(sabu);j++) { if(sabu[j]=='A') a++; else b++; if(a==b&&a>10) a=b=10; } if(a>b)cout<<a+1<<" "<<b<<endl; else cout<<a<<" "<<b+1<<endl; } if(cnt==1) break; } }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s370536466
p00174
C++
#include<bits\stdc++.h> using namespace std; int main(void) { int i,j,k,a,b,f=0,cnt=0; char sabu[102]; while(1) { f=cnt=0; for(i=0;i<3;i++) { cin>>sabu; a=b=0; if(sabu[0]=='0') { cnt=1; break; } for(j=1;j<strlen(sabu);j++) { if(sabu[j]=='A') a++; else b++; if(a==b&&a>10) a=b=10; } if(a>b)cout<<a+1<<" "<<b<<endl; else cout<<a<<" "<<b+1<<endl; } if(cnt==1) break; } }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s155358414
p00174
C++
#include<bits\stdc++.h> using namespace std; int main(void) { int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3]; char sabu[102]; while(1) { f=cnt=0; for(i=0;i<3;i++) { cin>>sabu; a=b=0; if(sabu[0]=='0') { cnt=1; break; } for(j=1;j<strlen(sabu);j++) { if(sabu[j]=='A') a++; else b++; if(a==b&&a>10) a=b=10; } if(a>b)s1[i]=a+1,s2[i]=b; else s1[i]=a,s2[i]=b+1; } if(cnt==1) break; for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl; } return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s545094890
p00174
C++
#include<bits\stdc++.h> using namespace std; int main(void) { int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3]; char sabu[102]; while(1) { f=cnt=0; for(i=0;i<3;i++) { cin>>sabu; a=b=0; if(sabu[0]=='0') { cnt=1; break; } for(j=1;j<strlen(sabu);j++) { if(sabu[j]=='A') a++; else b++; if(a==b&&a>10) a=b=10; } if(a>b)s1[i]=a+1,s2[i]=b; else s1[i]=a,s2[i]=b+1; } if(cnt==1) break; for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl; } return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s255806738
p00174
C++
#include<bits\stdc++.h> using namespace std; int main(void) { int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3]; char sabu[102]; while(1) { f=cnt=0; for(i=0;i<3;i++) { cin>>sabu; a=b=0; if(sabu[0]=='0') { cnt=1; break; } for(j=1;j<strlen(sabu);j++) { if(sabu[j]=='A') a++; else b++; if(a==b&&a>10) a=b=10; } if(a>b)s1[i]=a+1,s2[i]=b; else s1[i]=a,s2[i]=b+1; } if(cnt==1) break; for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl; } return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s228929163
p00174
C++
#include<bits\stdc++.h> using namespace std; int main(void) { int i,j,k,a,b,f=0,cnt=0,s1[3],s2[3]; char sabu[102]; while(1) { cnt=0; for(i=0;i<3;i++) { cin>>sabu; a=b=0; if(sabu[0]=='0') { cnt=1; break; } for(j=1;j<strlen(sabu);j++) { if(sabu[j]=='A') a++; else b++; if(a==b&&a>10) a=b=10; } if(a>b)s1[i]=a+1,s2[i]=b; else s1[i]=a,s2[i]=b+1; } if(cnt==1) break; for(i=0;i<3;i++) cout<<s1[i]<<" "<<s2[i]<<endl; } return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s596987369
p00174
C++
#include <iostream> #include <string> using namespace std; int main(){ string str; for(;;){ int cntA = 0,cntB = 0; cin >> str; if(str == '0') break; for(int i = 1 ; i < str.size() ; i++){ if(str[i] == 'A') cntA++; else cntB++; } if(cntA > cntB) cntA++; else cntB++; cout << cntA << ' ' << cntB << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:12: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 12 | if(str == '0') break; | ~~~ ^~ ~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/c++/14/string:43, 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: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const _CharT*' and 'char' 12 | if(str == '0') break; | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:12:15: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 12 | if(str == '0') break; | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46: /usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<char>
s329676021
p00174
C++
#include <string> using namespace std; int main() { int a,b; string s; while(cin>>s,s!="0"){ a=b=0; for(int i=0;i<s.size();i++){ if(s[i]=='A')a++; if(s[i]=='B')b++; } if(a!=11||b!=11){ if(a==10){a++;b--;} if(b==10){a--;b++;} } if(a==11&&b==11){ if(s[s.size()]=='A'){a++;b--;} else{a--;b++;} } cout<<a<<" "<<b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: 'cin' was not declared in this scope 7 | while(cin>>s,s!="0"){ | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <string> +++ |+#include <iostream> 2 | using namespace std; a.cc:21:17: error: 'cout' was not declared in this scope 21 | cout<<a<<" "<<b<<endl; | ^~~~ a.cc:21:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:21:34: error: 'endl' was not declared in this scope 21 | cout<<a<<" "<<b<<endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <string> +++ |+#include <ostream> 2 | using namespace std;
s977737497
p00175
Java
import java.math.BigInteger; import java.util.Scanner; public class Mani { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ BigInteger b = sc.nextBigInteger(); System.out.println(b.toString(4)); } } }
Main.java:4: error: class Mani is public, should be declared in a file named Mani.java public class Mani { ^ 1 error
s834866587
p00175
C
z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);}
main.c:1:1: warning: data definition has no type or storage class 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int] main.c:1:5: error: return type defaults to 'int' [-Wimplicit-int] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c: In function 'main': main.c:1:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} main.c:1:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~~ main.c:1:17: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:35: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:1:40: error: passing argument 1 of 'puts' from incompatible pointer type [-Wincompatible-pointer-types] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^ | | | int * main.c:1:40: note: expected 'const char *' but argument is of type 'int *' main.c:1:43: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c: At top level: main.c:1:1: warning: array 'z' assumed to have one element 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^
s336295334
p00175
C
z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);}
main.c:1:1: warning: data definition has no type or storage class 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int] main.c:1:5: error: return type defaults to 'int' [-Wimplicit-int] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c: In function 'main': main.c:1:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} main.c:1:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~~ main.c:1:17: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:35: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:1:40: error: passing argument 1 of 'puts' from incompatible pointer type [-Wincompatible-pointer-types] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^ | | | int * main.c:1:40: note: expected 'const char *' but argument is of type 'int *' main.c:1:43: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration] 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c: At top level: main.c:1:1: warning: array 'z' assumed to have one element 1 | z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^
s189691518
p00175
C
itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);}
main.c:1:1: warning: data definition has no type or storage class 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c:1:1: error: type defaults to 'int' in declaration of 'itoa' [-Wimplicit-int] main.c:1:8: warning: data definition has no type or storage class 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^ main.c:1:8: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int] main.c:1:12: error: return type defaults to 'int' [-Wimplicit-int] 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c: In function 'main': main.c:1:24: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} main.c:1:24: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~~ main.c:1:24: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:42: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^~~~ main.c:1:42: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:1:47: error: passing argument 1 of 'puts' from incompatible pointer type [-Wincompatible-pointer-types] 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^ | | | int * main.c:1:47: note: expected 'const char *' but argument is of type 'int *' main.c: At top level: main.c:1:8: warning: array 'z' assumed to have one element 1 | itoa();z[];main(){for(;scanf("%d",z),~*z;puts(z))itoa(*z,z,4);} | ^
s717632056
p00175
C
#include <stdio.h> int main(void) { int n; int keta; __int64 ans; while (1){ scanf("%d", &n); if (n == -1){ break; } keta = 1; ans = 0; while (n != 0){ ans += keta * (n % 4); n /= 4; keta *= 10; } printf("%I64d\n", ans); } return (0); }
main.c: In function 'main': main.c:7:9: error: unknown type name '__int64'; did you mean '__int64_t'? 7 | __int64 ans; | ^~~~~~~ | __int64_t
s128199768
p00175
C
#include <stdio.h> int main(void) { int n; int keta; __int64 ans; while (1){ scanf("%d", &n); if (n == -1){ break; } keta = 1; ans = 0; while (n != 0){ ans += keta * (n % 4); n /= 4; keta *= 10; } printf("%I64u\n", ans); } return (0); }
main.c: In function 'main': main.c:7:9: error: unknown type name '__int64'; did you mean '__int64_t'? 7 | __int64 ans; | ^~~~~~~ | __int64_t
s674326225
p00175
C
#include <stdio.h> int main(void) { int n; int keta; longlong ans; while (1){ scanf("%d", &n); if (n == -1){ break; } keta = 1; ans = 0; while (n != 0){ ans += keta * (n % 4); n /= 4; keta *= 10; } printf("%I64u\n", ans); } return (0); }
main.c: In function 'main': main.c:7:9: error: unknown type name 'longlong' 7 | longlong ans; | ^~~~~~~~
s336134409
p00175
C
#include <stdio.h> int main(void) { int n; int keta; LONGLONG ans; while (1){ scanf("%d", &n); if (n == -1){ break; } keta = 1; ans = 0; while (n != 0){ ans += keta * (n % 4); n /= 4; keta *= 10; } printf("%lld\n", ans); } return (0); }
main.c: In function 'main': main.c:7:9: error: unknown type name 'LONGLONG' 7 | LONGLONG ans; | ^~~~~~~~
s060004074
p00175
C++
#include<iostream>
/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
s234617596
p00175
C++
#include <cstdio> #include <cmath> #include <iostream> #include <string> using namespace std; int main(){ int n,t; while(1){ string a; cin >> n; if(n==-1){ return 0; } if(n==0){ a += '0'; } for(t=0;n!=0;t++){ a += '0' + n%4; n=n/4; } reverse(a.begin(), a.end()); cout << a << endl; } }
a.cc: In function 'int main()': a.cc:22:17: error: 'reverse' was not declared in this scope 22 | reverse(a.begin(), a.end()); | ^~~~~~~
s983210107
p00175
C++
#include <cstdio> #include <cmath> #include <iostream> #include <string> using namespace std; int main(){ int n,t; while(1){ string a; cin >> n; if(n==-1){ return 0; } if(n==0){ a += '0'; } for(t=0;n!=0;t++){ a += '0' + n%4; n=n/4; } reverse(a.begin(), a.end()); cout << a << endl; } }
a.cc: In function 'int main()': a.cc:22:17: error: 'reverse' was not declared in this scope 22 | reverse(a.begin(), a.end()); | ^~~~~~~
s907966841
p00175
C++
#include<stdio.h> int main(void) { int i,c,w[10000]; int n,x; while(1){ c=0; scanf("%d",&n); if(n==-1) break; while(1){ x=n/4; if(x<0) break; w[c]=n%4; n=x; c++; } printf("%d",n); for(i=c-1;i>=0;i--){ printf("%d\n",w[i]); } print("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'print' was not declared in this scope; did you mean 'printf'? 21 | print("\n"); | ^~~~~ | printf
s610455613
p00175
C++
#include<math.h> #include<vector> #include<cmath> #include<stack> #include<queue> #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,x,n) for(int i=x;i<n;i++) using namespace std; const int INF=100000000; int main(){ int n; while(cin>>n,n!=-1){ vector<int> a; if(n<4)cout<<n<<endl; else{ for(int i=0; ;i++){ int amari=n%4; a.push_back(amari); int b=n; n=n/4; if(n<4&&n!=0){ a.push_back(n); break; } } } for(int i=a.size()-1;i>=0;i--){ cout<<a[i]; } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'cin' was not declared in this scope 12 | while(cin>>n,n!=-1){ | ^~~ a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 5 | #include<queue> +++ |+#include <iostream> 6 | #define rep(i,n) for(int i=0;i<n;i++) a.cc:14:12: error: 'cout' was not declared in this scope 14 | if(n<4)cout<<n<<endl; | ^~~~ a.cc:14:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:21: error: 'endl' was not declared in this scope 14 | if(n<4)cout<<n<<endl; | ^~~~ a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 5 | #include<queue> +++ |+#include <ostream> 6 | #define rep(i,n) for(int i=0;i<n;i++) a.cc:28:7: error: 'cout' was not declared in this scope 28 | cout<<a[i]; | ^~~~ a.cc:28:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:30:5: error: 'cout' was not declared in this scope 30 | cout<<endl; | ^~~~ a.cc:30:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:30:11: error: 'endl' was not declared in this scope 30 | cout<<endl; | ^~~~ a.cc:30:11: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s744659268
p00175
C++
#include<iostream> #include<iomanip> #include<string> #include<algorithm> #include<cmath> #include<vector> using namespace std; int main(){ int n; while(cin>>n&&n!=-1){ int ans=0; for(int i=0;;i++){ ans+=(n%4*pow(10,i)); if(n/4==0) break; n=n/4; } cout<<ans<<endl; } return 0; } AOJ 0175 why wrong answer?
a.cc:24:1: error: 'AOJ' does not name a type 24 | AOJ 0175 why wrong answer? | ^~~
s167536574
p00175
C++
#include<iostream> #include<iomanip> #include<string> #include<algorithm> #include<cmath> #include<vector> using namespace std; int main(){ int n; while(cin>>n){ if(n=-1)break; int ans=0; for(int i=0;;i++){ ans+=(n%4*pow(10,i)); if(n/4==0) break; n=n/4; } cout<<ans<<endl; } return 0; } AOJ 0175 why wrong answer?
a.cc:25:1: error: 'AOJ' does not name a type 25 | AOJ 0175 why wrong answer? | ^~~
s731759622
p00175
C++
#include <iostream> using namespace std; string four(int n){ string ret; while(n){ ret += (char)(n%4+'0'); n/=4; } reverse(ret.begin(),ret.end()); return ret; } int main(){ int n; while(cin >> n && n != -1){ cout << four(n) << endl; } }
a.cc: In function 'std::string four(int)': a.cc:10:9: error: 'reverse' was not declared in this scope 10 | reverse(ret.begin(),ret.end()); | ^~~~~~~
s000667598
p00175
C++
res += j * v[i]; j *= 10; } return res; } int main(){ int i; while(std::cin >> i, i >= 0){ std::cout << Decimal4(i) << '\n'; } }
a.cc:1:17: error: 'res' does not name a type 1 | res += j * v[i]; | ^~~ a.cc:2:17: error: 'j' does not name a type 2 | j *= 10; | ^ a.cc:3:9: error: expected declaration before '}' token 3 | } | ^ a.cc:5:9: error: expected unqualified-id before 'return' 5 | return res; | ^~~~~~ a.cc:6:1: error: expected declaration before '}' token 6 | } | ^ a.cc: In function 'int main()': a.cc:10:20: error: 'cin' is not a member of 'std' 10 | while(std::cin >> i, i >= 0){ | ^~~ a.cc:1:8: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | res += j * v[i]; a.cc:11:22: error: 'cout' is not a member of 'std' 11 | std::cout << Decimal4(i) << '\n'; | ^~~~ a.cc:11:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:11:30: error: 'Decimal4' was not declared in this scope 11 | std::cout << Decimal4(i) << '\n'; | ^~~~~~~~
s589069774
p00175
C++
#include <iostream> #include <cstdlib> using namespace std; int main(){ int n; while(cin >> n){ if(n==-1)break; char s[20]; itoa(n,s,4); cout << s << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:9:17: error: 'itoa' was not declared in this scope 9 | itoa(n,s,4); | ^~~~
s605531514
p00175
C++
#include <iostream> #include <stdlib.h> using namespace std; int main(){ int n; while(cin >> n){ if(n==-1)break; char s[20]; itoa(n,s,4); cout << s << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:9:17: error: 'itoa' was not declared in this scope 9 | itoa(n,s,4); | ^~~~
s796982754
p00175
C++
#include<iostream> #include<cstdio> #include<string> using namespace std; int main(void){ while(1){ int n; string str; scanf("%d",&n); if(n==-1)break; if(n==0)cout << "0" << endl; else{ while(n>0){ str+=n%4+'0'; n=n/4; } reverse(str.begin(),str.end()); cout << str << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:19:25: error: 'reverse' was not declared in this scope 19 | reverse(str.begin(),str.end()); | ^~~~~~~
s297787800
p00175
C++
#include <stdio.h> int main(void) { int a[100]; int n; int index; while (1){ scanf("%d", &n); if (n == -1) break; index = 0; do { a[index++] = (n & 0x3); n =>> 2; } while (n != 0); index--; while (index >= 0){ printf("%d", a[index--]); } puts(""); } }
a.cc: In function 'int main()': a.cc:15:4: error: expected primary-expression before '>>' token 15 | n =>> 2; | ^~
s879202407
p00175
C++
#include <iostream> using namespace std; int main(){ int n; string str; while(cin >> n , n != -1){ str = ""; if(!n) cout << '0' << endl; else{ while(n){ str += n % 4 + '0'; n /= 4; } reverse(str.begin(),str.end()); cout << str << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:16:7: error: 'reverse' was not declared in this scope 16 | reverse(str.begin(),str.end()); | ^~~~~~~
s239754299
p00175
C++
#include <iostream> #include <string> using namespace std; int main(){ int n; string str; while(cin >> n , n != -1){ str = ""; if(!n) cout << '0' << endl; else{ while(n){ str += n % 4 + '0'; n /= 4; } reverse(str.begin(),str.end()); cout << str << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:17:7: error: 'reverse' was not declared in this scope 17 | reverse(str.begin(),str.end()); | ^~~~~~~
s608035953
p00176
Java
static double dis(double r, double g, double b) { return Math.sqrt( r*r+ g*g+ b*b); } public static void main(String[] args) throws Exception { String [] names ={“000black”,“001blue”,“010lime”,“011aqua”,“100red”,“101fuchsia”,“110yellow”,“111white”}; Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String str = sc.nextLine(); if(str.equals(“0”)) break; int r0 = Integer.parseInt(str.substring(1,3), 16); int g0 = Integer.parseInt(str.substring(3,5), 16); int b0 = Integer.parseInt(str.substring(5,7), 16); String ans = “”; double min = 256.0; for(String name: names) { int r = (name.charAt(0)-‘0’) * 255; int g = (name.charAt(1)-‘0’) * 255; int b = (name.charAt(2)-‘0’) * 255; double d = dis(r-r0, g - g0, b - b0); if(d>min){ min=d; ans=name; } } System.out.println(ans.substring(3)); } }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. static double dis(double r, double g, double b) { ^ (use --enable-preview to enable unnamed classes) Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:5: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:7: error: class, interface, enum, or record expected while(sc.hasNext()){ ^ Main.java:9: error: class, interface, enum, or record expected if(str.equals(?0?)) break; ^ Main.java:9: error: illegal character: '\u201c' if(str.equals(?0?)) break; ^ Main.java:9: error: illegal character: '\u201d' if(str.equals(?0?)) break; ^ Main.java:13: error: illegal character: '\u201c' String ans = ??; ^ Main.java:13: error: illegal character: '\u201d' String ans = ??; ^ Main.java:15: error: class, interface, enum, or record expected for(String name: names) { ^ Main.java:16: error: illegal character: '\u2018' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:16: error: illegal character: '\u2019' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:17: error: illegal character: '\u2018' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:17: error: illegal character: '\u2019' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:18: error: illegal character: '\u2018' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:18: error: illegal character: '\u2019' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:20: error: class, interface, enum, or record expected if(d>min){ ^ Main.java:22: error: class, interface, enum, or record expected ans=name; ^ Main.java:23: error: class, interface, enum, or record expected } ^ Main.java:26: error: class, interface, enum, or record expected } ^ 42 errors
s064832494
p00176
Java
import java.util.*; static double dis(double r, double g, double b) { return Math.sqrt( r*r+ g*g+ b*b); } public class Main { public static void main(String[] args) throws Exception { String [] names ={“000black”,“001blue”,“010lime”,“011aqua”,“100red”,“101fuchsia”,“110yellow”,“111white”}; Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String str = sc.nextLine(); if(str.equals(“0”)) break; int r0 = Integer.parseInt(str.substring(1,3), 16); int g0 = Integer.parseInt(str.substring(3,5), 16); int b0 = Integer.parseInt(str.substring(5,7), 16); String ans = “”; double min = 256.0; for(String name: names) { int r = (name.charAt(0)-‘0’) * 255; int g = (name.charAt(1)-‘0’) * 255; int b = (name.charAt(2)-‘0’) * 255; double d = dis(r-r0, g - g0, b - b0); if(d>min){ min=d; ans=name; } } System.out.println(ans.substring(3)); } } }
Main.java:3: error: unnamed classes are a preview feature and are disabled by default. static double dis(double r, double g, double b) { ^ (use --enable-preview to enable unnamed classes) Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:11: error: illegal start of type while(sc.hasNext()){ ^ Main.java:11: error: <identifier> expected while(sc.hasNext()){ ^ Main.java:11: error: ';' expected while(sc.hasNext()){ ^ Main.java:13: error: illegal character: '\u201c' if(str.equals(?0?)) break; ^ Main.java:13: error: illegal character: '\u201d' if(str.equals(?0?)) break; ^ Main.java:17: error: illegal character: '\u201c' String ans = ??; ^ Main.java:17: error: illegal character: '\u201d' String ans = ??; ^ Main.java:20: error: illegal character: '\u2018' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:20: error: illegal character: '\u2019' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:21: error: illegal character: '\u2018' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:21: error: illegal character: '\u2019' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:22: error: illegal character: '\u2018' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:22: error: illegal character: '\u2019' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:32: error: class, interface, enum, or record expected } ^ 39 errors
s190867542
p00176
Java
import java.util.*; public class Main { static double dis(double r, double g, double b) { return Math.sqrt( r*r+ g*g+ b*b); } public static void main(String[] args) throws Exception { String [] names ={“000black”,“001blue”,“010lime”,“011aqua”,“100red”,“101fuchsia”,“110yellow”,“111white”}; Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String str = sc.nextLine(); if(str.equals(“0”)) break; int r0 = Integer.parseInt(str.substring(1,3), 16); int g0 = Integer.parseInt(str.substring(3,5), 16); int b0 = Integer.parseInt(str.substring(5,7), 16); String ans = “”; double min = 256.0; for(String name: names) { int r = (name.charAt(0)-‘0’) * 255; int g = (name.charAt(1)-‘0’) * 255; int b = (name.charAt(2)-‘0’) * 255; double d = dis(r-r0, g - g0, b - b0); if(d>min){ min=d; ans=name; } } System.out.println(ans.substring(3)); } } }
Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:8: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:10: error: illegal start of type while(sc.hasNext()){ ^ Main.java:10: error: <identifier> expected while(sc.hasNext()){ ^ Main.java:10: error: ';' expected while(sc.hasNext()){ ^ Main.java:12: error: illegal character: '\u201c' if(str.equals(?0?)) break; ^ Main.java:12: error: illegal character: '\u201d' if(str.equals(?0?)) break; ^ Main.java:16: error: illegal character: '\u201c' String ans = ??; ^ Main.java:16: error: illegal character: '\u201d' String ans = ??; ^ Main.java:19: error: illegal character: '\u2018' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:19: error: illegal character: '\u2019' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:20: error: illegal character: '\u2018' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:20: error: illegal character: '\u2019' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:21: error: illegal character: '\u2018' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:21: error: illegal character: '\u2019' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:31: error: class, interface, enum, or record expected } ^ 38 errors
s523504949
p00176
Java
import java.util.*; public class Main { static double dis(double r, double g, double b) { return Math.sqrt( r*r+ g*g+ b*b); } public static void main(String[] args) throws Exception { String [] names ={“000black”,“001blue”,“010lime”,“011aqua”,“100red”,“101fuchsia”,“110yellow”,“111white”}; Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String str = sc.nextLine(); if(str.equals(“0”)) break; int r0 = Integer.parseInt(str.substring(1,3), 16); int g0 = Integer.parseInt(str.substring(3,5), 16); int b0 = Integer.parseInt(str.substring(5,7), 16); String ans = “”; double min = 256.0; for(String name: names) { int r = (name.charAt(0)-‘0’) * 255; int g = (name.charAt(1)-‘0’) * 255; int b = (name.charAt(2)-‘0’) * 255; double d = dis(r-r0, g - g0, b - b0); if(d>min){ min=d; ans=name; } } System.out.println(ans.substring(3)); } } }
Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201c' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: illegal character: '\u201d' String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:9: error: not a statement String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?}; ^ Main.java:11: error: illegal start of type while(sc.hasNext()){ ^ Main.java:11: error: <identifier> expected while(sc.hasNext()){ ^ Main.java:11: error: ';' expected while(sc.hasNext()){ ^ Main.java:13: error: illegal character: '\u201c' if(str.equals(?0?)) break; ^ Main.java:13: error: illegal character: '\u201d' if(str.equals(?0?)) break; ^ Main.java:17: error: illegal character: '\u201c' String ans = ??; ^ Main.java:17: error: illegal character: '\u201d' String ans = ??; ^ Main.java:20: error: illegal character: '\u2018' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:20: error: illegal character: '\u2019' int r = (name.charAt(0)-?0?) * 255; ^ Main.java:21: error: illegal character: '\u2018' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:21: error: illegal character: '\u2019' int g = (name.charAt(1)-?0?) * 255; ^ Main.java:22: error: illegal character: '\u2018' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:22: error: illegal character: '\u2019' int b = (name.charAt(2)-?0?) * 255; ^ Main.java:32: error: class, interface, enum, or record expected } ^ 38 errors
s290644187
p00176
Java
import java.util.*; public class Main { static double distance(double r,double g,double b){ return Math.sqrt(r*r+g*g+b*b); } public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String [] colors = {"000black","001blue","010lime","011aqua","100red","101fuchsia","110yellow","111white"}; while(sc.hasNextLine()){ String str = sc.nextLine(); if(str.equals("0")) break; int r0 = Integer.parseInt(str.substring(1,3),16); int b0 = Integer.parseInt(str.substring(3,5),16); int g0 = Integer.parseInt(str.substring(5,7),16); String ans = ""; double min = 450.0; for(String c:color){ int r = (c.charAt(0)-'0')*255; int b = (c.charAt(1)-'0')*255; int g = (c.charAt(2)-'0')*255; double d = distance(r-r0,g-g0,b-b0); if(d<min){ min=d; ans=c.substring(3); } } System.out.println(ans); } } }
Main.java:21: error: cannot find symbol for(String c:color){ ^ symbol: variable color location: class Main 1 error
s981775001
p00176
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception { String [] unit = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"}; Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int m = sc.nextInt(); int n = sc.nextInt(); if(m==0 && n==0) break; BigInteger b = valueOf(Math.pow(m,n)); String ans = ""; for(int i=0;i<18;i++){ String digit = remainder(b,10000); ans = digit.concat(unit[i]+ans); b = divide(b,10000); } System.out.println(ans); } } }
Main.java:11: error: cannot find symbol BigInteger b = valueOf(Math.pow(m,n)); ^ symbol: class BigInteger location: class Main Main.java:11: error: cannot find symbol BigInteger b = valueOf(Math.pow(m,n)); ^ symbol: method valueOf(double) location: class Main 2 errors
s682543808
p00176
Java
import java.util.*; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { String [] unit = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"}; Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int m = sc.nextInt(); int n = sc.nextInt(); if(m==0 && n==0) break; BigInteger b = valueOf(Math.pow(m,n)); String ans = ""; for(int i=0;i<18;i++){ String digit = remainder(b,10000); ans = digit.concat(unit[i]+ans); b = divide(b,10000); } System.out.println(ans); } } }
Main.java:12: error: cannot find symbol BigInteger b = valueOf(Math.pow(m,n)); ^ symbol: method valueOf(double) location: class Main Main.java:16: error: cannot find symbol String digit = remainder(b,10000); ^ symbol: method remainder(BigInteger,int) location: class Main Main.java:18: error: cannot find symbol b = divide(b,10000); ^ symbol: method divide(BigInteger,int) location: class Main 3 errors
s639824150
p00176
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception { String [] unit = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"}; Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int m = sc.nextInt(); int n = sc.nextInt(); if(m==0 && n==0) break; BigInteger b = valueOf(Math.pow(m,n)); String ans = ""; for(int i=0;i<18;i++){ String digit = remainder(b,10000); ans = digit.concat(unit[i]+ans); b = divide(b,10000); } System.out.println(ans); } } }
Main.java:11: error: cannot find symbol BigInteger b = valueOf(Math.pow(m,n)); ^ symbol: class BigInteger location: class Main Main.java:11: error: cannot find symbol BigInteger b = valueOf(Math.pow(m,n)); ^ symbol: method valueOf(double) location: class Main 2 errors
s605680763
p00176
Java
import java.util.*; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { String [] unit = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"}; Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int m = sc.nextInt(); int n = sc.nextInt(); if(m==0 && n==0) break; BigInteger b = valueOf(Math.pow(m,n)); String ans = ""; for(int i=0;i<18;i++){ String digit = remainder(b,10000); ans = digit.concat(unit[i]+ans); b = divide(b,10000); } System.out.println(ans); } } }
Main.java:12: error: cannot find symbol BigInteger b = valueOf(Math.pow(m,n)); ^ symbol: method valueOf(double) location: class Main Main.java:16: error: cannot find symbol String digit = remainder(b,10000); ^ symbol: method remainder(BigInteger,int) location: class Main Main.java:18: error: cannot find symbol b = divide(b,10000); ^ symbol: method divide(BigInteger,int) location: class Main 3 errors
s927533790
p00176
C
#define _CRT_SECURE_NO_WARNINGS //#define _USE_MATH_DEFINES #include<stdio.h> //#include<stdlib.h> #include<math.h> //#include<string.h> //#include<time.h> #define P(type,x) fprintf(stdout,"%"#type"\n",x) struct color { int r, g, b; char c[8]; }; //int c16toi10(char*); int hex(char*); int main() { struct color a[8]{ {0x00,0x00,0x00,"black"}, {0x00,0x00,0xff,"blue" }, {0x00,0xff,0x00,"lime" }, {0x00,0xff,0xff,"aqua"}, {0xff,0x00,0x00,"red"}, {0xff,0x00,0xff,"fuchsia"}, {0xff,0xff,0x00,"yellow"}, {0xff,0xff,0xff,"white"} }; int i,r,g,b,d,t,n; char str[16]; while (~fscanf(stdin, "%s", str), str[0] != '0') { r = hex(str + 1) * 16 + hex(str + 2); g = hex(str + 3) * 16 + hex(str + 4); b = hex(str + 5) * 16 + hex(str + 6); n = 1e8; for (i = 0; i < 8; i++) { d = sqrt(pow(r - a[i].r, 2) + pow(g - a[i].g, 2) + pow(b - a[i].b, 2)); if (n > d) n = d, t = i; } P(s, a[t].c); } return 0; } //int c16toi10(char *n){ // int ans=0; // int i, base = 1; // for (i = strlen(n)-1; i >= 0; --i) { // if (hex(n + i) == -1) return -1; // ans += hex(n+i)*base; // base *= 16; // } // return ans; //} int hex(char *s){ if ('0' <= *s&&*s <= '9') return *s - '0'; else if ('A' <= *s&&*s <= 'Z') return *s - 'A' + 10; else if ('a' <= *s&&*s <= 'z') return *s - 'a' + 10; return -1; }
main.c: In function 'main': main.c:18:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 18 | struct color a[8]{ | ^ main.c:19:40: error: expected ';' before '}' token 19 | {0x00,0x00,0x00,"black"}, | ^ | ; main.c:19:41: error: expected expression before ',' token 19 | {0x00,0x00,0x00,"black"}, | ^ main.c:36:42: error: 'a' undeclared (first use in this function) 36 | d = sqrt(pow(r - a[i].r, 2) + pow(g - a[i].g, 2) + pow(b - a[i].b, 2)); | ^ main.c:36:42: note: each undeclared identifier is reported only once for each function it appears in
s970195078
p00176
C
import java.util.*; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { String [] unit = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"}; Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int m = sc.nextInt(); int n = sc.nextInt(); if(m==0 && n==0) break; BigInteger b = valueOf(Math.pow(m,n)); String ans = ""; for(int i=0;i<18;i++){ String digit = remainder(b,10000); ans = digit.concat(unit[i]+ans); b = divide(b,10000); } System.out.println(ans); } } }
main.c:1:1: error: unknown type name 'import' 1 | import java.util.*; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.util.*; | ^ main.c:2:1: error: unknown type name 'import' 2 | import java.math.BigInteger; | ^~~~~~ main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | import java.math.BigInteger; | ^ main.c:4:1: error: unknown type name 'public' 4 | public class Main { | ^~~~~~ main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main' 4 | public class Main { | ^~~~
s929062769
p00176
C
s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);}
main.c:1:1: warning: data definition has no type or storage class 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int] main.c:1:14: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~~ main.c:1:14: note: (near initialization for 's') main.c:1:21: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~~ main.c:1:21: note: (near initialization for 's') main.c:1:28: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~~ main.c:1:28: note: (near initialization for 's') main.c:1:35: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~ main.c:1:35: note: (near initialization for 's') main.c:1:41: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~~~~~ main.c:1:41: note: (near initialization for 's') main.c:1:51: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~~~~ main.c:1:51: note: (near initialization for 's') main.c:1:60: error: excess elements in 'int[]' initializer 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~~~ main.c:1:60: note: (near initialization for 's') main.c:1:5: error: cannot initialize array of 'int' from a string literal with type array of 'char' 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^ main.c:1:69: error: return type defaults to 'int' [-Wimplicit-int] 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~ main.c: In function 'main': main.c:1:69: error: type of 'c' defaults to 'int' [-Wimplicit-int] main.c:1:82: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} main.c:1:82: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~~ main.c:1:82: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:101: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ^~~~ main.c:1:101: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:1:107: error: passing argument 1 of 'puts' makes pointer from integer without a cast [-Wint-conversion] 1 | s[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};main(c){for(;scanf("#%x\n",&c);)puts(s[c>>7&1|c>>14&2|c>>21&4]);} | ~^~~~~~~~~~~~~~~~~~~~~~~~ | | | int main.c:1:107: note: expected 'const char *' but argument is of type 'int'
s206425007
p00176
C
#include <stdio.h> #include <math.h> #include <ctype.h> int ss(char input); int hen(int a,int b); int main(){ int i,henkan[7]; char n[7]; while(scanf("%s",n)){ if(n[0]=='0')break; for(i=1;i<7;i++){ if(isdigit(n[i])!=0){//数字ならば henkan[i]=n[i]-'0'; }else{ henkan[i]=ss(n[i]); } } int memo; double d,small=10000; int r=hen(henkan[1],henkan[2]),g=hen(henkan[3],henkan[4]),b=hen(henkan[5],henkan[6]); int kazu[8][3]={{0,0,0}, {0,0,255}, {0,255,0}, {0,255,255}, {255,0,0}, {255,0,255}, {255,255,0}, {255,255,255}}; for(i=0;i<8;i++){ d=sqrt((r-kazu[i][0])*(r-kazu[i][0])+(g-kazu[i][1])*(g-kazu[i][1])+(b-kazu[i][2])*(b-kazu[i][2])); if(small>d){ small=d; memo = i; } } switch (memo) { case 0: puts("black"); break; case 1: puts("blue"); break; case 2: puts("lime"); break; case 3: puts("aqua"); break; case 4: puts("red"); break; case 5: puts("fuchsia"); break; case 6: puts("yellow"); break; case 7: puts("white"); break; } } return 0; } int ss(char input){ int al[6]={10,11,12,13,14,15}; char seach[6]={'a','b','c','d','e','f'}; for(int i=0;i<6;i++){ if(input == seach[i]){ return al[i]; } } return 0; } int hen(int a,int b){ int goukei=0; goukei+=a*16; goukei+=b; return goukei; }
/usr/bin/ld: /tmp/ccZuzhNv.o: in function `main': main.c:(.text+0x2b7): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
s865529898
p00176
C
#include<stdio.h> char a[8][8]={"black","blue","lime","aqua","red","fuchsia","yellow","white"},c; int b[9][3]={{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}}; int d(int x) { int i,r=0; for(i=0;i<3;i++) r+=(b[8][i]-b[x][i])*(b[8][i]-b[x][i]); return r; } int main() { int i,r; for(;~scanf("%c%2x%2x%2x\n",&c,&b[8][0],&b[8][1],&b[8][2]),c!='0';puts(a[r])) { for(i=r=0;i<8;i++) if(d(r)>d(i)) r=i; }      return 0; }
main.c: In function 'main': main.c:22:1: error: stray '\343' in program 22 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:22:3: error: stray '\343' in program 22 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:22:5: error: stray '\343' in program 22 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:22:7: error: stray '\343' in program 22 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:22:9: error: stray '\343' in program 22 | <U+3000><U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~
s921340742
p00176
C++
#include<iostream> #include<cfloat> #include<cmath> using namespace std; int hexToDec(char x){ if('0' <= x && x <= '9'){ return x-'0'; }else{ return 10 + (x - 'a'); } } int data[8][3] = { {0, 0, 0} , {0, 0, 255} , {0, 255, 0} , {0, 255, 255} , {255, 0, 0} , {255, 0, 255} , {255, 255, 0} , {255, 255, 255}}; string color[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; int main(){ while(1){ string s; cin >> s; if(s == "0") break; int r, g, b; r = 16 * hexToDec(s[1]) + hexToDec(s[2]); g = 16 * hexToDec(s[3]) + hexToDec(s[4]); b = 16 * hexToDec(s[5]) + hexToDec(s[6]); double dist = DBL_MAX; int ans; for(int i = 0; i < 8; i++){ double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); if(tmp < dist){ dist = tmp; ans = i; } } cout << color[ans] << endl; } return 0; }#include<iostream> #include<cfloat> #include<cmath> using namespace std; int hexToDec(char x){ if('0' <= x && x <= '9'){ return x-'0'; }else{ return 10 + (x - 'a'); } } int data[8][3] = { {0, 0, 0} , {0, 0, 255} , {0, 255, 0} , {0, 255, 255} , {255, 0, 0} , {255, 0, 255} , {255, 255, 0} , {255, 255, 255}}; string color[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; int main(){ while(1){ string s; cin >> s; if(s == "0") break; int r, g, b; r = 16 * hexToDec(s[1]) + hexToDec(s[2]); g = 16 * hexToDec(s[3]) + hexToDec(s[4]); b = 16 * hexToDec(s[5]) + hexToDec(s[6]); double dist = DBL_MAX; int ans; for(int i = 0; i < 8; i++){ double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); if(tmp < dist){ dist = tmp; ans = i; } } cout << color[ans] << endl; } return 0; }
a.cc:52:2: error: stray '#' in program 52 | }#include<iostream> | ^ a.cc: In function 'int main()': a.cc:41:39: error: reference to 'data' is ambiguous 41 | double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); | ^~~~ In file included from /usr/include/c++/14/string:53, 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [8][3]' 14 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc:41:66: error: reference to 'data' is ambiguous 41 | double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [8][3]' 14 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc:41:93: error: reference to 'data' is ambiguous 41 | double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [8][3]' 14 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc: At global scope: a.cc:52:3: error: 'include' does not name a type 52 | }#include<iostream> | ^~~~~~~ a.cc:57:5: error: redefinition of 'int hexToDec(char)' 57 | int hexToDec(char x){ | ^~~~~~~~ a.cc:6:5: note: 'int hexToDec(char)' previously defined here 6 | int hexToDec(char x){ | ^~~~~~~~ a.cc:65:5: error: redefinition of 'int data [8][3]' 65 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc:14:5: note: 'int data [8][3]' previously defined here 14 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc:74:8: error: redefinition of 'std::string color [8]' 74 | string color[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; | ^~~~~ a.cc:23:8: note: 'std::string color [8]' previously declared here 23 | string color[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; | ^~~~~ a.cc:76:5: error: redefinition of 'int main()' 76 | int main(){ | ^~~~ a.cc:25:5: note: 'int main()' previously defined here 25 | int main(){ | ^~~~ a.cc: In function 'int main()': a.cc:92:39: error: reference to 'data' is ambiguous 92 | double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [8][3]' 14 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc:92:66: error: reference to 'data' is ambiguous 92 | double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [8][3]' 14 | int data[8][3] = { {0, 0, 0} , | ^~~~ a.cc:92:93: error: reference to 'data' is ambiguous 92 | double tmp = sqrt(pow(r - data[i][0], 2.0) + pow(g - data[i][1], 2.0) + pow(b - data[i][2], 2.0)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [8][3]' 14 | int data[8][3] = { {0, 0, 0} , | ^~~~
s782196181
p00176
C++
import java.awt.geom.Point2D; import java.io.*; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.NoSuchElementException; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Stack; import java.util.TreeMap; public class Main { static PrintWriter out = new PrintWriter(System.out); static FastScanner sc = new FastScanner(); static Scanner stdIn = new Scanner(System.in); static int INF = 2 << 26; static int[][] X = new int[][] {{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}}; static String[] K = new String[] {"black","blue","lime","aqua","red","fuchsia","yellow","white"}; public static void main(String[] args) { while(true) { String tmp = sc.next(); if(tmp.equals("0")) break; int a1 = Integer.parseInt(tmp.substring(1, 3),16); int a2 = Integer.parseInt(tmp.substring(3, 5),16); int a3 = Integer.parseInt(tmp.substring(5, 7),16); double dkMax = Double.MAX_VALUE; int id = 0; for(int i = 0; i < X.length; i++) { double x = Math.sqrt(Math.pow((a1 - X[i][0]),2) + Math.pow((a2 - X[i][1]),2) +Math.pow((a3 - X[i][2]),2)); if(dkMax > x) { dkMax = x; id = i; } } out.println(K[id]); } out.flush(); } } //------------------------------// //-----------// class FastScanner { 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 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(); } } public int nextInt() { if (!hasNext()) throw new NoSuchElementException(); int 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(); } } public double nextDouble() { return Double.parseDouble(next()); } }
a.cc:2:1: error: 'import' does not name a type 2 | import java.awt.geom.Point2D; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.math.BigInteger; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.ArrayDeque; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.util.ArrayList; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import java.util.Arrays; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: 'import' does not name a type 8 | import java.util.Collections; | ^~~~~~ a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: 'import' does not name a type 9 | import java.util.Comparator; | ^~~~~~ a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:10:1: error: 'import' does not name a type 10 | import java.util.Deque; | ^~~~~~ a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:11:1: error: 'import' does not name a type 11 | import java.util.HashMap; | ^~~~~~ a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:12:1: error: 'import' does not name a type 12 | import java.util.HashSet; | ^~~~~~ a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:13:1: error: 'import' does not name a type 13 | import java.util.List; | ^~~~~~ a.cc:13:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:14:1: error: 'import' does not name a type 14 | import java.util.NoSuchElementException; | ^~~~~~ a.cc:14:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:15:1: error: 'import' does not name a type 15 | import java.util.PriorityQueue; | ^~~~~~ a.cc:15:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:16:1: error: 'import' does not name a type 16 | import java.util.Scanner; | ^~~~~~ a.cc:16:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:17:1: error: 'import' does not name a type 17 | import java.util.Stack; | ^~~~~~ a.cc:17:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:18:1: error: 'import' does not name a type 18 | import java.util.TreeMap; | ^~~~~~ a.cc:18:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:22:1: error: expected unqualified-id before 'public' 22 | public class Main { | ^~~~~~ a.cc:57:12: error: expected ':' before 'final' 57 | private final InputStream in = System.in; | ^~~~~~ | : a.cc:57:13: error: 'final' does not name a type 57 | private final InputStream in = System.in; | ^~~~~ a.cc:58:12: error: expected ':' before 'final' 58 | private final byte[] buffer = new byte[1024]; | ^~~~~~ | : a.cc:58:13: error: 'final' does not name a type 58 | private final byte[] buffer = new byte[1024]; | ^~~~~ a.cc:59:12: error: expected ':' before 'int' 59 | private int ptr = 0; | ^~~~ | : a.cc:60:12: error: expected ':' before 'int' 60 | private int buflen = 0; | ^~~~ | : a.cc:61:12: error: expected ':' before 'boolean' 61 | private boolean hasNextByte() { | ^~~~~~~~ | : a.cc:61:13: error: 'boolean' does not name a type; did you mean 'bool'? 61 | private boolean hasNextByte() { | ^~~~~~~ | bool a.cc:77:12: error: expected ':' before 'int' 77 | private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} | ^~~~ | : a.cc:78:12: error: expected ':' before 'static' 78 | private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} | ^~~~~~~ | : a.cc:78:20: error: 'boolean' does not name a type; did you mean 'bool'? 78 | private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} | ^~~~~~~ | bool a.cc:79:12: error: expected ':' before 'void' 79 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} | ^~~~~ | : a.cc:80:11: error: expected ':' before 'boolean' 80 | public boolean hasNext() { skipUnprintable(); return hasNextByte();} | ^~~~~~~~ | : a.cc:80:12: error: 'boolean' does not name a type; did you mean 'bool'? 80 | public boolean hasNext() { skipUnprintable(); return hasNextByte();} | ^~~~~~~ | bool a.cc:81:11: error: expected ':' before 'String' 81 | public String next() { | ^~~~~~~ | : a.cc:81:12: error: 'String' does not name a type 81 | public String next() { | ^~~~~~ a.cc:91:11: error: expected ':' before 'long' 91 | public long nextLong() { | ^~~~~ | : a.cc:116:11: error: expected ':' before 'int' 116 | public int nextInt() { | ^~~~ | : a.cc:141:11: error: expected ':' before 'double' 141 | public double nextDouble() { | ^~~~~~~ | : a.cc:146:2: error: expected ';' after class definition 146 | } | ^ | ; a.cc: In member function 'int FastScanner::readByte()': a.cc:77:34: error: 'hasNextByte' was not declared in this scope 77 | private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} | ^~~~~~~~~~~ a.cc:77:56: error: 'buffer' was not declared in this scope; did you mean 'buflen'? 77 | private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} | ^~~~~~ | buflen a.cc: In member function 'void FastScanner::skipUnprintable()': a.cc:79:44: error: 'hasNextByte' was not declared in this scope 79 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} | ^~~~~~~~~~~ a.cc:79:78: error: 'buffer' was not declared in this scope; did you mean 'buflen'? 79 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} | ^~~~~~ | buflen a.cc:79:62: error: 'isPrintableChar' was not declared in this scope 79 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} | ^~~~~~~~~~~~~~~ a.cc: In member function 'long int FastScanner::nextLong()': a.cc:92:14: error: 'hasNext' was not declared in this scope 92 | if (!hasNext()) throw new NoSuchElementException(); | ^~~~~~~ a.cc:92:35: error: expected type-specifier before 'NoSuchElementException' 92 | if (!hasNext()) throw new NoSuchElementException(); | ^~~~~~~~~~~~~~~~~~~~~~ a.cc:94:9: error: 'boolean' was not declared in this scope; did you mean 'bool'? 94 | boolean minus = false; | ^~~~~~~ | bool a.cc:97:13: error: 'minus' was not declared in this scope 97 | minus = true; | ^~~~~ a.cc:101:23: error: expected type-specifier before 'NumberFormatException' 101 | throw new NumberFormatException(); | ^~~~~~~~~~~~~~~~~~~~~ a.cc:107:34: error: 'isPrintableChar' was not declared in this scope 107 | }else if(b == -1 || !isPrintableChar(b)){ | ^~~~~~~~~~~~~~~ a.cc:108:24: error: 'minus' was not declared in this scope 108 | return minus ? -n : n; | ^~~~~ a.cc:110:27: error: expected type-specifier before 'NumberFormatException' 110 | throw new NumberFormatException(); | ^~~~~~~~~~~~~~~~~~~~~ a.cc: In member function 'int FastScanner::nextInt()': a.cc:117:15: error: 'hasNext' was not declared in this scope 117 | if (!hasNext()) throw new NoSuchElementException(); | ^~~~~~~ a.cc:117:36: error: expected type-specifier before 'NoSuchElementException' 117 | if (!hasNext()) throw new NoSuchElementException(); | ^~~~~~~~~~~~~~~~~~~~~~ a.cc:119:10: error: 'boolean' was not declared in this scope; did you mean 'bool'? 119 | boolean minus = false; | ^~~~~~~ | bool a.cc:122:14: error: 'minus' was not declared in this scope 122 | minus = true; | ^~~~~ a.cc:126:24: error: expected type-specifier before 'NumberFormatException' 126 | throw new NumberFormatException(); | ^~~~~~~~~~~~~~~~~~~~~ a.cc:132:35: error: 'isPrintableChar' was not declared in this scope 132 | }else if(b == -1 || !isPrintableChar(b)){ | ^~~~~~~~~~~~~~~ a.cc:133:25: error: 'minus' was not declared in this scope 133 | return minus ? -n : n; | ^~~~~ a.cc:135:28: error: expected type-specifier before 'NumberFormatException' 135 | throw new NumberFormatException(); |
s173706772
p00176
C++
#include<iostream> #include<string> using namespace std; string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; char T[9] = "89abcdef"; int a, b, c; int main() { while (true) { a = 0; b = 0; c = 0; cin >> S; if (S == "0") { break; } for (int i = 0; i < 8; i++){ if (T[i] == S[1]) { a = 1; } } for (int i = 0; i < 8; i++) { if (T[i] == S[3]) { b = 1; } } for (int i = 0; i < 8; i++) { if (T[i] == S[5]) { c = 1; } } cout << x[a][b][c] << endl; } }
a.cc:4:83: error: expected '}' before '{' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ~ ^ a.cc:4:83: error: expected '}' before '{' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ~ ^ a.cc:4:83: error: expected ',' or ';' before '{' token a.cc:4:102: error: expected declaration before '}' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ^ a.cc:4:104: error: expected declaration before '}' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ^
s640785527
p00176
C++
#include<iostream> #include<string> using namespace std; string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; char T[9] = "89abcdef"; int a, b, c; int main() { while (true) { a = 0; b = 0; c = 0; cin >> S; if (S == "0") { break; } for (int i = 0; i < 8; i++){ if (T[i] == S[1]) { a = 1; } } for (int i = 0; i < 8; i++) { if (T[i] == S[3]) { b = 1; } } for (int i = 0; i < 8; i++) { if (T[i] == S[5]) { c = 1; } } cout << x[a][b][c] << endl; } }
a.cc:4:83: error: expected '}' before '{' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ~ ^ a.cc:4:83: error: expected '}' before '{' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ~ ^ a.cc:4:83: error: expected ',' or ';' before '{' token a.cc:4:102: error: expected declaration before '}' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ^ a.cc:4:104: error: expected declaration before '}' token 4 | string S, x[2][2][2] = { {{"black","blue"}, {"lime","aqua"}}, { {"red","fuchsia"} {"yellow","white"} } }; | ^
s274582893
p00176
C++
(function(input) { var lines = input.split("\n"); var colors = [ ['black', 0x00, 0x00, 0x00], ['blue', 0x00, 0x00, 0xff], ['lime', 0x00, 0xff, 0x00], ['aqua', 0x00, 0xff, 0xff], ['red', 0xff, 0x00, 0x00], ['fuchsia', 0xff, 0x00, 0xff], ['yellow', 0xff, 0xff, 0x00], ['white', 0xff, 0xff, 0xff], ]; for (var i = 0; i < lines.length; ++i) { if (lines[i][0] === '#') { var best_color; var min_d = 3 * 256 * 256 + 1; var r = parseInt(lines[i].substr(1, 2), 16); var g = parseInt(lines[i].substr(3, 2), 16); var b = parseInt(lines[i].substr(5, 2), 16); for (var j = 0; j < colors.length; ++j) { var d = Math.pow(r - colors[j][1], 2) + Math.pow(g - colors[j][2], 2) + Math.pow(b - colors[j][3], 2); if (d < min_d) { min_d = d; best_color = colors[j][0]; } } console.log(best_color); } } })(require('fs').readFileSync('/dev/stdin', 'utf8').trim());
a.cc:4:6: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 4 | ['black', 0x00, 0x00, 0x00], | ^~~~~~~ a.cc:5:6: warning: multi-character character constant [-Wmultichar] 5 | ['blue', 0x00, 0x00, 0xff], | ^~~~~~ a.cc:6:6: warning: multi-character character constant [-Wmultichar] 6 | ['lime', 0x00, 0xff, 0x00], | ^~~~~~ a.cc:7:6: warning: multi-character character constant [-Wmultichar] 7 | ['aqua', 0x00, 0xff, 0xff], | ^~~~~~ a.cc:8:6: warning: multi-character character constant [-Wmultichar] 8 | ['red', 0xff, 0x00, 0x00], | ^~~~~ a.cc:9:6: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes 9 | ['fuchsia', 0xff, 0x00, 0xff], | ^~~~~~~~~ a.cc:10:6: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes 10 | ['yellow', 0xff, 0xff, 0x00], | ^~~~~~~~ a.cc:11:6: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes 11 | ['white', 0xff, 0xff, 0xff], | ^~~~~~~ a.cc:30:12: warning: multi-character character constant [-Wmultichar] 30 | })(require('fs').readFileSync('/dev/stdin', 'utf8').trim()); | ^~~~ a.cc:30:31: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes 30 | })(require('fs').readFileSync('/dev/stdin', 'utf8').trim()); | ^~~~~~~~~~~~ a.cc:30:45: warning: multi-character character constant [-Wmultichar] 30 | })(require('fs').readFileSync('/dev/stdin', 'utf8').trim()); | ^~~~~~ a.cc:1:10: error: expected ')' before '(' token 1 | (function(input) { | ~ ^ | ) a.cc:30:2: error: expected unqualified-id before ')' token 30 | })(require('fs').readFileSync('/dev/stdin', 'utf8').trim()); | ^
s644997837
p00176
C++
#define _USE_MATH_DEFINES #define MAX_N 1000000 #include <iostream> #include <sstream> #include <cmath> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> using namespace std; typedef long long ll; typedef pair<int,int> P; static const double eps = 1e-8; struct COLOR{ string name; string R; string G; string B; }; int hex2dec(string str){ const char hex[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; return 16 * (int)lower_bound(hex,hex+16,str[0]) + (int)lower_bound(hex,hex+16,str[1]); } int main(){ struct COLOR color[] = { "black","00","00","00", "blue","00","00","ff", "lime","00","ff","00", "aqua","00","ff","ff", "red","ff","00","00", "fuchsia","ff","00","ff", "yellow","ff","ff","00", "white","ff","ff","ff", }; string str; while(cin >> str){ if(str.size() == 1 && str[0] == '0') break; int r = hex2dec(str.substr(1,2)); int g = hex2dec(str.substr(3,2)); int b = hex2dec(str.substr(5,2)); int dk = 10000000; int idx=0; for(int i=0;i<sizeof(color)/sizeof(struct COLOR); i++){ int tmp; if(dk > (tmp=((r - hex2dec(color[i].R)) * (r - hex2dec(color[i].R)) + (g - hex2dec(color[i].G)) * (g - hex2dec(color[i].G)) + (b - hex2dec(color[i].B)) * (b - hex2dec(color[i].B))))){ dk = tmp; idx=i; } } printf("%s\n",color[idx].name.c_str()); } }
a.cc: In function 'int hex2dec(std::string)': a.cc:33:21: error: cast from 'const char*' to 'int' loses precision [-fpermissive] 33 | return 16 * (int)lower_bound(hex,hex+16,str[0]) + (int)lower_bound(hex,hex+16,str[1]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:33:59: error: cast from 'const char*' to 'int' loses precision [-fpermissive] 33 | return 16 * (int)lower_bound(hex,hex+16,str[0]) + (int)lower_bound(hex,hex+16,str[1]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s039650724
p00176
C++
#include<iostream> #include<string> #include<map> using namespace std; int main() { map <char, int>b; b.insert(map<char, int>::value_type('0', 0)); b.insert(map<char, int>::value_type('1', 1)); b.insert(map<char, int>::value_type('2', 2)); b.insert(map<char, int>::value_type('3', 3)); b.insert(map<char, int>::value_type('4', 4)); b.insert(map<char, int>::value_type('5', 5)); b.insert(map<char, int>::value_type('6', 6)); b.insert(map<char, int>::value_type('7', 7)); b.insert(map<char, int>::value_type('8', 8)); b.insert(map<char, int>::value_type('9', 9)); b.insert(map<char, int>::value_type('a', 10)); b.insert(map<char, int>::value_type('b', 11)); b.insert(map<char, int>::value_type('c', 12)); b.insert(map<char, int>::value_type('d', 13)); b.insert(map<char, int>::value_type('e', 14)); b.insert(map<char, int>::value_type('f', 15)); string d[8] = { "black","blue","lime","aqua","red","fuchsia","yellow","white" }; int e[8][3] = { {0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255}, {255,255,0},{255,255,255} }; string a; while (cin >> a&&a != "0") { int sa = 10000, t[3]; string iro; for (int i = 1; i < 7; i += 2) { char f = a[i], g = a[i + 1]; t[(i - 1) / 2] = b[f]*16 + b[g]; } for (int i = 7; i >= 0; i--) { int h = sqrt(pow((e[i][0] - t[0]), 2) + pow((e[i][1] - t[1]), 2) + pow((e[i][2] - t[2]), 2)); if (h <= sa) { sa = h; iro = d[i]; } } cout << iro << endl; } }
a.cc: In function 'int main()': a.cc:34:38: error: 'pow' was not declared in this scope 34 | int h = sqrt(pow((e[i][0] - t[0]), 2) + pow((e[i][1] - t[1]), 2) + pow((e[i][2] - t[2]), 2)); | ^~~ a.cc:34:33: error: 'sqrt' was not declared in this scope 34 | int h = sqrt(pow((e[i][0] - t[0]), 2) + pow((e[i][1] - t[1]), 2) + pow((e[i][2] - t[2]), 2)); | ^~~~
s817765076
p00176
C++
#include<iostream> #include<string> #include<map> using namespace std; int main() { map <char, int>b; b.insert(map<char, int>::value_type('0', 0)); b.insert(map<char, int>::value_type('1', 1)); b.insert(map<char, int>::value_type('2', 2)); b.insert(map<char, int>::value_type('3', 3)); b.insert(map<char, int>::value_type('4', 4)); b.insert(map<char, int>::value_type('5', 5)); b.insert(map<char, int>::value_type('6', 6)); b.insert(map<char, int>::value_type('7', 7)); b.insert(map<char, int>::value_type('8', 8)); b.insert(map<char, int>::value_type('9', 9)); b.insert(map<char, int>::value_type('a', 10)); b.insert(map<char, int>::value_type('b', 11)); b.insert(map<char, int>::value_type('c', 12)); b.insert(map<char, int>::value_type('d', 13)); b.insert(map<char, int>::value_type('e', 14)); b.insert(map<char, int>::value_type('f', 15)); string d[8] = { "black","blue","lime","aqua","red","fuchsia","yellow","white" }; int e[8][3] = { {0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255}, {255,255,0},{255,255,255} }; string a; while (cin >> a&&a != "0") { int sa = 10000, t[3]; string iro; for (int i = 1; i < 7; i += 2) { char f = a[i], g = a[i + 1]; t[(i - 1) / 2] = b[f]*16 + b[g]; } for (int i = 7; i >= 0; i--) { int h = sqrt(pow((e[i][0] - t[0]), 2) + pow((e[i][1] - t[1]), 2) + pow((e[i][2] - t[2]), 2)); if (h <= sa) { sa = h; iro = d[i]; } } cout << iro << endl; } }
a.cc: In function 'int main()': a.cc:34:38: error: 'pow' was not declared in this scope 34 | int h = sqrt(pow((e[i][0] - t[0]), 2) + pow((e[i][1] - t[1]), 2) + pow((e[i][2] - t[2]), 2)); | ^~~ a.cc:34:33: error: 'sqrt' was not declared in this scope 34 | int h = sqrt(pow((e[i][0] - t[0]), 2) + pow((e[i][1] - t[1]), 2) + pow((e[i][2] - t[2]), 2)); | ^~~~
s385661769
p00176
C++
#include<iostream> #include<string> using namespace std; int main() { string a; string c[8] = { "black","blue","lime","aqua","red","fuchsia","yellow","white" }; int d[8][3] = { {0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0}, {255,0,255},{255,255,0},{255,255,255} }; while (cin>>a&&a!="0") { int t[3]; for (int i = 1; i < a.length(); i += 2) { int b = 0; for (int j = 0; j <= 1; j++) { if ((int)a[i + j] >= '0' && (int)a[i +j] <= '9') b += (pow(16, (j+1)%2)*(int)(a[i +j] - '0')); else b += (pow(16, (j+1)%2)*(10 + (int)a[i + j] - 'a')); } t[(i - 1) / 2] = b; } double e = 100000; string f = ""; for (int i = 7; i >= 0; i--) { double g = sqrt(pow((t[0] - d[i][0]), 2) + pow((t[1] - d[i][1]), 2) + pow((t[2] - d[i][2]), 2)); if (g <= e) { e = g; f = c[i]; } } cout << f << endl; } }
a.cc: In function 'int main()': a.cc:16:47: error: 'pow' was not declared in this scope 16 | b += (pow(16, (j+1)%2)*(int)(a[i +j] - '0')); | ^~~ a.cc:18:47: error: 'pow' was not declared in this scope 18 | b += (pow(16, (j+1)%2)*(10 + (int)a[i + j] - 'a')); | ^~~ a.cc:25:41: error: 'pow' was not declared in this scope 25 | double g = sqrt(pow((t[0] - d[i][0]), 2) + pow((t[1] - d[i][1]), 2) + pow((t[2] - d[i][2]), 2)); | ^~~ a.cc:25:36: error: 'sqrt' was not declared in this scope 25 | double g = sqrt(pow((t[0] - d[i][0]), 2) + pow((t[1] - d[i][1]), 2) + pow((t[2] - d[i][2]), 2)); | ^~~~
s242972142
p00176
C++
#include<iostream> #include<string> using namespace std; int main() { string a; string c[8] = { "black","blue","lime","aqua","red","fuchsia","yellow","white" }; int d[8][3] = { {0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0}, {255,0,255},{255,255,0},{255,255,255} }; while (cin>>a&&a!="0") { int t[3]; for (int i = 1; i < a.length(); i += 2) { int b = 0; for (int j = 0; j <= 1; j++) { if ((int)a[i + j] >= '0' && (int)a[i +j] <= '9') b += (pow(16, (j+1)%2)*(int)(a[i +j] - '0')); else b += (pow(16, (j+1)%2)*(10 + (int)a[i + j] - 'a')); } t[(i - 1) / 2] = b; } double e = 100000; string f = ""; for (int i = 7; i >= 0; i--) { double g = sqrt(pow((t[0] - d[i][0]), 2) + pow((t[1] - d[i][1]), 2) + pow((t[2] - d[i][2]), 2)); if (g <= e) { e = g; f = c[i]; } } cout << f << endl; } }
a.cc: In function 'int main()': a.cc:16:47: error: 'pow' was not declared in this scope 16 | b += (pow(16, (j+1)%2)*(int)(a[i +j] - '0')); | ^~~ a.cc:18:47: error: 'pow' was not declared in this scope 18 | b += (pow(16, (j+1)%2)*(10 + (int)a[i + j] - 'a')); | ^~~ a.cc:25:41: error: 'pow' was not declared in this scope 25 | double g = sqrt(pow((t[0] - d[i][0]), 2) + pow((t[1] - d[i][1]), 2) + pow((t[2] - d[i][2]), 2)); | ^~~ a.cc:25:36: error: 'sqrt' was not declared in this scope 25 | double g = sqrt(pow((t[0] - d[i][0]), 2) + pow((t[1] - d[i][1]), 2) + pow((t[2] - d[i][2]), 2)); | ^~~~
s308146225
p00176
C++
#include<iostream> #include<string> using namespace std; int main(){ string data; int f1,f2; while(1){ getline(cin,data); if(data[0] == '0') return 0; f1 = f2 = 0 for(int i = 0; i < 10; i++){ if(data[1] == i) f1 = 1; if(data[2] == i) f2 = 1; } if(fa == 1&&f2 == 1){ data[1] = 0; data[2] = 0; }else{ data[1] == f; data[2] == f; } for(int i = 0; i < 10; i++){ if(data[3] == i) f1 = 1; if(data[4] == i) f2 = 1; } if(fa == 1&&f2 == 1){ data[3] = 0; data[4] = 0; }else{ data[3] == f; data[4] == f; } for(int i = 0; i < 10; i++){ if(data[5] == i) f1 = 1; if(data[6] == i) f2 = 1; } if(fa == 1&&f2 == 1){ data[5] = 0; data[6] = 0; }else{ data[5] == f; data[6] == f; } if(data[1] == 0 && data[2] == 0){ if(data[3] == 0&& data[4] == 0){ if(data[5] == 0&& data[6] == 0){ cout << "black" <<endl; }else{ cout << "blue" << endl; } } else{ if(data[5] == 0&&data[6] == 0){ cout << "linme" << endl; }else{ cout << "aqua" << endl; } } } if(data[1] == f && data[2] == f){ if(data[3] == f&& data[4] == f){ if(data[5] == f&& data[6] == f){ cout << "white" <<endl; }else{ cout << "yellow"<< endl; } } else{ if(data[5] == 0&&data[6] == 0){ cout << "red" << endl; }else{ cout << "fuchsia" << endl; } } } } return 0; }
a.cc: In function 'int main()': a.cc:12:16: error: expected ';' before 'for' 12 | f1 = f2 = 0 | ^ | ; 13 | for(int i = 0; i < 10; i++){ | ~~~ a.cc:13:20: error: 'i' was not declared in this scope 13 | for(int i = 0; i < 10; i++){ | ^ a.cc:19:8: error: 'fa' was not declared in this scope; did you mean 'f2'? 19 | if(fa == 1&&f2 == 1){ | ^~ | f2 a.cc:23:18: error: 'f' was not declared in this scope; did you mean 'f2'? 23 | data[1] == f; | ^ | f2 a.cc:32:8: error: 'fa' was not declared in this scope; did you mean 'f2'? 32 | if(fa == 1&&f2 == 1){ | ^~ | f2 a.cc:36:18: error: 'f' was not declared in this scope; did you mean 'f2'? 36 | data[3] == f; | ^ | f2 a.cc:45:8: error: 'fa' was not declared in this scope; did you mean 'f2'? 45 | if(fa == 1&&f2 == 1){ | ^~ | f2 a.cc:49:18: error: 'f' was not declared in this scope; did you mean 'f2'? 49 | data[5] == f; | ^ | f2 a.cc:69:19: error: 'f' was not declared in this scope; did you mean 'f2'? 69 | if(data[1] == f && data[2] == f){ | ^ | f2
s158107823
p00176
C++
#include<iostream> #include<cstdlib> #include<cstdio> #define w 15*16+15 using namespace std; int fld[8][3]={0,0,0,0,0,w,0,w, 0,0,w,w,w,0,0 ,w,0,w,w,w,0,w,w,w}; char* col[]={"black", "blue","lime","aqua", "red","fuchsia", "yellow","white"}; int main(){ int temp,t,x,y,z,a[8],ren; char s[10]; while(cin>>s,s[0]!='0'){ temp=1000000; for(int i=1;i<8;i++){ if(s[i]>'9') a[i-1]=9+s[i]-'a'; else a[i-1]=s[i]-'0'; } for(int i=0;i<8;i++){ x=a[0]*16+a[1]-fld[i][0]; y=a[2]*16+a[3]-fld[i][1]; z=a[4]*16+a[5]-fld[i][2]; ren=sqrt(x*x+y*y+z*z); if(ren<temp){ t=i; temp=ren; } }cout<<col[t]<<endl; } return 0; }
a.cc:9:14: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 9 | char* col[]={"black", | ^~~~~~~ a.cc:10:9: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 10 | "blue","lime","aqua", | ^~~~~~ a.cc:10:16: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 10 | "blue","lime","aqua", | ^~~~~~ a.cc:10:23: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 10 | "blue","lime","aqua", | ^~~~~~ a.cc:11:9: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 11 | "red","fuchsia", | ^~~~~ a.cc:11:15: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 11 | "red","fuchsia", | ^~~~~~~~~ a.cc:12:9: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 12 | "yellow","white"}; | ^~~~~~~~ a.cc:12:18: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 12 | "yellow","white"}; | ^~~~~~~ a.cc: In function 'int main()': a.cc:27:29: error: 'sqrt' was not declared in this scope 27 | ren=sqrt(x*x+y*y+z*z); | ^~~~
s985374618
p00176
C++
#include <iostream> #include <iomanip> #include <algorithm> using namespace std; struct Color{ double r,g,b; }; double sq( double a ){ return a * a; } int main(int argc, char const* argv[]) { const char *color[] = {"black","blue","lime","aqua","red","fuchsia","yellow","white"}; Color colorStrong[] = {{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}}; Color inputColor; int rgb; double d[8]; char damy; while( cin >> damy && damy != '0' ){ cin >> hex >> rgb; inputColor.r = rgb >> 16; inputColor.g = ( rgb >> 8 ) & 0xff; inputColor.b = rgb & 0xff; for( int i = 0;i < 8;i++ ){ d[i] = sqrt( sq( inputColor.r - colorStrong[i].r ) + sq( inputColor.g - colorStrong[i].g ) + sq( inputColor.b - colorStrong[i].b ) ); } double* answer = min_element( d, d + 8 ); for( int i = 0;i < 8;i++ ){ if( answer == &d[i] ){ cout << color[i] << endl; break; } } } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:32:32: error: 'sqrt' was not declared in this scope; did you mean 'sq'? 32 | d[i] = sqrt( sq( inputColor.r - colorStrong[i].r ) + sq( inputColor.g - colorStrong[i].g ) + sq( inputColor.b - colorStrong[i].b ) ); | ^~~~ | sq
s122648685
p00176
C++
#include <cstdio> #include <iostream> #include <cmath> #include <cstdlib> using namespace std; string color[] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; int nums[][3] = {{0,0,0}, {0,0,255}, {0,255,0}, {0,255,255}, {255,0,0}, {255,0,255}, {255,255,0}, {255,255,255}}; int convert(string str) { int res = 0; if ('0'<=str[0]&&str[0]<='9') { res += (str[0]-'0') * 16; } else if ('a'<=str[0]&&str[0]<='f') { res += (str[0]-'a'+10) * 16; } if ('0'<=str[1]&&str[1]<='9') { res += (str[1]-'0'); } else if ('a'<=str[1]&&str[1]<='f') { res += (str[1]-'a'+10); } return res; } int main() { string str; while (cin >> str) { if (str == "0") break; double d = 10000000.0; string res; int r = convert(str.substr(1,2)), g = convert(str.substr(3,2)), b = convert(str.substr(5,2)); for (int i=0; i<8; i++) { double tmp = sqrt(pow(r-nums[i][0], 2)+pow(g-nums[i][1], 2)+pow(b-nums[i][2], 2)); if (tmp < d) { d = tmp; res = color[i]; } } cout << res << endl; } } #include <cstdio> #include <iostream> #include <cmath> #include <cstdlib> using namespace std; string color[] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; int nums[][3] = {{0,0,0}, {0,0,255}, {0,255,0}, {0,255,255}, {255,0,0}, {255,0,255}, {255,255,0}, {255,255,255}}; int convert(string str) { int res = 0; if ('0'<=str[0]&&str[0]<='9') { res += (str[0]-'0') * 16; } else if ('a'<=str[0]&&str[0]<='f') { res += (str[0]-'a'+10) * 16; } if ('0'<=str[1]&&str[1]<='9') { res += (str[1]-'0'); } else if ('a'<=str[1]&&str[1]<='f') { res += (str[1]-'a'+10); } return res; } int main() { string str; while (cin >> str) { if (str == "0") break; double d = 10000000.0; string res; int r = convert(str.substr(1,2)), g = convert(str.substr(3,2)), b = convert(str.substr(5,2)); for (int i=0; i<8; i++) { double tmp = sqrt(pow(r-nums[i][0], 2)+pow(g-nums[i][1], 2)+pow(b-nums[i][2], 2)); if (tmp < d) { d = tmp; res = color[i]; } } cout << res << endl; } }
a.cc:49:8: error: redefinition of 'std::string color []' 49 | string color[] = {"black", "blue", "lime", "aqua", | ^~~~~ a.cc:6:8: note: 'std::string color [8]' previously declared here 6 | string color[] = {"black", "blue", "lime", "aqua", | ^~~~~ a.cc:51:5: error: redefinition of 'int nums [][3]' 51 | int nums[][3] = {{0,0,0}, {0,0,255}, {0,255,0}, {0,255,255}, | ^~~~ a.cc:8:5: note: 'int nums [8][3]' previously defined here 8 | int nums[][3] = {{0,0,0}, {0,0,255}, {0,255,0}, {0,255,255}, | ^~~~ a.cc:54:5: error: redefinition of 'int convert(std::string)' 54 | int convert(string str) { | ^~~~~~~ a.cc:11:5: note: 'int convert(std::string)' previously defined here 11 | int convert(string str) { | ^~~~~~~ a.cc:69:5: error: redefinition of 'int main()' 69 | int main() { | ^~~~ a.cc:26:5: note: 'int main()' previously defined here 26 | int main() { | ^~~~
s535143950
p00176
C++
#include<string> #include<cmath> using namespace std; #define R 0 #define G 1 #define B 2 void print_col(int r, int g, int b) { string col[] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"}; int c[][3] = {{0, 0, 0}, {0, 0, 255}, {0, 255, 0}, {0, 255, 255}, {255, 0, 0}, {255, 0, 255}, {255, 255, 0}, {255, 255, 255}}; double d = 1000000; double dd; int a = -1; for(int i = 0; i < 8; i++) { dd = pow(r - c[i][R], 2) + pow(g - c[i][G], 2) + pow(b - c[i][B], 2); if(dd < d) { d = dd; a = i; } } cout << col[a] << endl; } int to_num(char n) { return n >= 'a' ? n - 'a' + 10 : n - '0'; } int main() { string s; int r, g, b; while(true) { cin >> s; if(s[0] == '0') break; r = to_num(s[1]) * 16 + to_num(s[2]); g = to_num(s[3]) * 16 + to_num(s[4]); b = to_num(s[5]) * 16 + to_num(s[6]); print_col(r, g, b); } }
a.cc: In function 'void print_col(int, int, int)': a.cc:27:3: error: 'cout' was not declared in this scope 27 | cout << col[a] << endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<cmath> +++ |+#include <iostream> 3 | using namespace std; a.cc:27:21: error: 'endl' was not declared in this scope 27 | cout << col[a] << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<cmath> +++ |+#include <ostream> 3 | using namespace std; a.cc: In function 'int main()': a.cc:41:5: error: 'cin' was not declared in this scope 41 | cin >> s; | ^~~ a.cc:41:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s147784200
p00176
C++
import java.util.Scanner; import static java.lang.System.out; class Main{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); String name[] = {"black","blue","lime","aqua","red","fuchsia","yellow","white"}; int color[][] = {{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}}; while(true){ String str = scan.next(); if(str.equals("0")) break; int R = Integer.parseInt(str.substring(1,3),16); int G = Integer.parseInt(str.substring(3,5),16); int B = Integer.parseInt(str.substring(5,7),16); double min = Double.MAX_VALUE; int Index = 0; for(int i = 0 ; i < 8 ; i++){ double near = Math.sqrt(Math.pow(R - color[i][0],2) + Math.pow(G - color[i][1],2) + Math.pow(B - color[i][2],2)); if( near < min ){ min = near; Index = i; } } out.println(name[Index]); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import static java.lang.System.out; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:9: error: expected ':' before 'static' 4 | public static void main(String args[]){ | ^~~~~~~ | : a.cc:4:27: error: 'String' has not been declared 4 | public static void main(String args[]){ | ^~~~~~ a.cc:27:2: error: expected ';' after class definition 27 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:5:5: error: 'Scanner' was not declared in this scope 5 | Scanner scan = new Scanner(System.in); | ^~~~~~~ a.cc:6:5: error: 'String' was not declared in this scope 6 | String name[] = {"black","blue","lime","aqua","red","fuchsia","yellow","white"}; | ^~~~~~ a.cc:7:9: error: declaration of 'color' as multidimensional array must have bounds for all dimensions except the first 7 | int color[][] = {{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}}; | ^~~~~ a.cc:9:14: error: expected ';' before 'str' 9 | String str = scan.next(); | ^~~ a.cc:10:10: error: 'str' was not declared in this scope; did you mean 'std'? 10 | if(str.equals("0")) break; | ^~~ | std a.cc:12:15: error: 'Integer' was not declared in this scope 12 | int R = Integer.parseInt(str.substring(1,3),16); | ^~~~~~~ a.cc:12:32: error: 'str' was not declared in this scope; did you mean 'std'? 12 | int R = Integer.parseInt(str.substring(1,3),16); | ^~~ | std a.cc:15:20: error: 'Double' was not declared in this scope; did you mean 'double'? 15 | double min = Double.MAX_VALUE; | ^~~~~~ | double a.cc:18:23: error: 'Math' was not declared in this scope 18 | double near = Math.sqrt(Math.pow(R - color[i][0],2) + Math.pow(G - color[i][1],2) + Math.pow(B - color[i][2],2)); | ^~~~ a.cc:18:46: error: 'color' was not declared in this scope 18 | double near = Math.sqrt(Math.pow(R - color[i][0],2) + Math.pow(G - color[i][1],2) + Math.pow(B - color[i][2],2)); | ^~~~~ a.cc:24:7: error: 'out' was not declared in this scope 24 | out.println(name[Index]); | ^~~ a.cc:24:19: error: 'name' was not declared in this scope 24 | out.println(name[Index]); | ^~~~
s736043202
p00177
C
float a,b,c,d; float A,B,C,D,E,F; main(){ for(;scanf("%f%f%f%f",&a,&b,&c,&d),a+1;){ a*=M_PI/180; b*=M_PI/180; c*=M_PI/180; d*=M_PI/180; A=cos(a)*cos(b); B=cos(a)*sin(b); C=sin(a); D=cos(c)*cos(d); E=cos(c)*sin(d); F=sin(c); printf("%.0f\n",6378.1*acos(A*D+B*E+C*F)); } exit(0); }
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(){ | ^~~~ main.c: In function 'main': main.c:4:14: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 4 | for(;scanf("%f%f%f%f",&a,&b,&c,&d),a+1;){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | float a,b,c,d; main.c:4:14: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 4 | for(;scanf("%f%f%f%f",&a,&b,&c,&d),a+1;){ | ^~~~~ main.c:4:14: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:5:20: error: 'M_PI' undeclared (first use in this function) 5 | a*=M_PI/180; | ^~~~ main.c:5:20: note: each undeclared identifier is reported only once for each function it appears in main.c:9:19: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration] 9 | A=cos(a)*cos(b); | ^~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'cos' +++ |+#include <math.h> 1 | float a,b,c,d; main.c:9:19: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch] 9 | A=cos(a)*cos(b); | ^~~ main.c:9:19: note: include '<math.h>' or provide a declaration of 'cos' main.c:10:26: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 10 | B=cos(a)*sin(b); | ^~~ main.c:10:26: note: include '<math.h>' or provide a declaration of 'sin' main.c:10:26: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] main.c:10:26: note: include '<math.h>' or provide a declaration of 'sin' main.c:15:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 15 | printf("%.0f\n",6378.1*acos(A*D+B*E+C*F)); | ^~~~~~ main.c:15:17: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:15:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:15:17: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:15:40: error: implicit declaration of function 'acos' [-Wimplicit-function-declaration] 15 | printf("%.0f\n",6378.1*acos(A*D+B*E+C*F)); | ^~~~ main.c:15:40: note: include '<math.h>' or provide a declaration of 'acos' main.c:15:40: warning: incompatible implicit declaration of built-in function 'acos' [-Wbuiltin-declaration-mismatch] main.c:15:40: note: include '<math.h>' or provide a declaration of 'acos' main.c:17:9: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 17 | exit(0); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | float a,b,c,d; main.c:17:9: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 17 | exit(0); | ^~~~ main.c:17:9: note: include '<stdlib.h>' or provide a declaration of 'exit'
s653441479
p00177
C++
#include <iostream> #include <vector> #include <string> #include <sstream> #include <algorithm> #include <map> #include <set> #include <cstdio> #include <cmath> #define rep(i,l,n) for(lint i=l;i<n;i++) #define rer(i,l,n) for(lint i=l;i<=n;i++) #define all(a) a.begin(),a.end() #define o(a) cout<<a<<endl #define pb(a) push_back(a) #define mk(a,b) make_pair(a,b) #define fi first #define se second using namespace std; typedef long long lint; typedef vector<int> vi; typedef vector<lint> vli; typedef vector<vi> vvi; typedef pair<int,int> pii; double M_PI=acos(-1); int main(){ double a[2],b[2],r=6378.1; while(1){ rep(i,0,2) cin>>a[i]>>b[i]; if(a[0]==-1 && b[0]==-1 && a[1]==-1 && b[1]==-1) break; double x[2],y[2],z[2],d2,l,c=M_PI/180.0; /*rep(i,0,2) x[i]=r*cos(a[i]*c)*cos(b[i]*c); rep(i,0,2) y[i]=r*sin(a[i]*c)*cos(b[i]*c); rep(i,0,2) z[i]=r*sin(b[i]*c); d2=(x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0])+(z[1]-z[0])*(z[1]-z[0]); o(" "<<d2); double t=acos(1-d2/(2.0*r*r)); o(t); l=r*t; l=int(l+0.5); o(l);*/ double t=acos(cos(a[0]*c)*cos(a[1]*c)*cos(b[0]*c-b[1]*c)+sin(a[0]*c)*sin(a[1]*c)); double ans=r*t; ans=(int)(ans+0.5); o(ans); } }
In file included from /usr/include/c++/14/cmath:47, from a.cc:9: a.cc:25:8: error: expected unqualified-id before numeric constant 25 | double M_PI=acos(-1); | ^~~~
s917076813
p00177
C++
#include <iostream> #include <vector> #include <string> #include <sstream> #include <algorithm> #include <map> #include <set> #include <cstdio> #include <cmath> #define rep(i,l,n) for(lint i=l;i<n;i++) #define rer(i,l,n) for(lint i=l;i<=n;i++) #define all(a) a.begin(),a.end() #define o(a) cout<<a<<endl #define pb(a) push_back(a) #define mk(a,b) make_pair(a,b) #define fi first #define se second using namespace std; typedef long long lint; typedef vector<int> vi; typedef vector<lint> vli; typedef vector<vi> vvi; typedef pair<int,int> pii; double M_PI=acos(-1); int main(){ double a[2],b[2],r=6378.1; while(1){ rep(i,0,2) cin>>a[i]>>b[i]; if(a[0]==-1 && b[0]==-1 && a[1]==-1 && b[1]==-1) break; double x[2],y[2],z[2],d2,l,c=M_PI/180.0; /*rep(i,0,2) x[i]=r*cos(a[i]*c)*cos(b[i]*c); rep(i,0,2) y[i]=r*sin(a[i]*c)*cos(b[i]*c); rep(i,0,2) z[i]=r*sin(b[i]*c); d2=(x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0])+(z[1]-z[0])*(z[1]-z[0]); o(" "<<d2); double t=acos(1-d2/(2.0*r*r)); o(t); l=r*t; l=int(l+0.5); o(l);*/ double t=acos(cos(a[0]*c)*cos(a[1]*c)*cos(b[0]*c-b[1]*c)+sin(a[0]*c)*sin(a[1]*c)); double ans=r*t; ans=(int)(ans+0.5); o(ans); } }
In file included from /usr/include/c++/14/cmath:47, from a.cc:9: a.cc:25:8: error: expected unqualified-id before numeric constant 25 | double M_PI=acos(-1); | ^~~~
s003110762
p00177
C++
#include <bits/stdc++.h> using namespace std ; #define rep(i,n) for(int i = 0; i < (int)(n);++i) #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); const double r = 6378.1; double x1,y1,x2,y2; double c = M_PI/180.0; while(cin >> y1 >> x1 >> y2 >> x2){ if(y1 == -1 && x1 == -1 && y2 == -1 && x2 == -1) break; y1 = y1 * c; y2 = y2 * c; double d = r * acos(sin(y1) * sin(y2) + cos(y1) * cos(y2) * cos(x1*c - x2*c); cout << (int)(d + 0.5) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:81: error: expected ')' before ';' token 17 | double d = r * acos(sin(y1) * sin(y2) + cos(y1) * cos(y2) * cos(x1*c - x2*c); | ~ ^ | )
s476547965
p00177
C++
#include<map> #include<set> #include<cmath> #include<cstdio> #include<cstdio> #define all(c) (c).begin(),(c).end() using namespace std; const double R=6378.10; const double PI=3.1415926535; const double EPS=1e-10; const double toRad=360.0/2.0/PI; int main(void){ double a,b,c,d; while(cin >> a >> b >> c >> d){ if(a<0 && b<0 && c<0 && d<0)break; a/=toRad,b/=toRad,c/=toRad,d/=toRad; double ax=cos(b)*cos(a),ay=sin(b)*cos(a),az=sin(a); double bx=cos(d)*cos(c),by=sin(d)*cos(c),bz=sin(c); double D=sqrt(pow(ax-bx,2)+pow(ay-by,2)+pow(az-bz,2)); double rad=acos(1-D*D/2); printf("%.0f",round(R*rad)); cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:9: error: 'cin' was not declared in this scope 18 | while(cin >> a >> b >> c >> d){ | ^~~ a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 5 | #include<cstdio> +++ |+#include <iostream> 6 | a.cc:26:5: error: 'cout' was not declared in this scope 26 | cout << endl; | ^~~~ a.cc:26:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:26:13: error: 'endl' was not declared in this scope 26 | cout << endl; | ^~~~ a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 5 | #include<cstdio> +++ |+#include <ostream> 6 |
s973639704
p00178
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int i,j,k,block[500000][5],hhh,max[5],left,from,time; int n,d,l,x; int main(){ while(scanf("%d",&n)*n){ hhh=0;left=0; for(i=0;i<5;i++)max[i]=0; for(;n>0;n--){ scanf("%d %d %d",&d,&l,&x); x--; left+=l; if(d==1){ k=0;j=0; for(i=0;i<l;i++){if(max[x+i]>k){k=max[x+i];j=x+i;}} for(i=0;i<l;i++){max[x+i]=k+1;block[k][x+i]=1;} from=k;time=1; } else{ for(i=0;i<l;i++)block[max[x]+i][x]=1; from=max[x]; max[x]+=l; time=l; j=x; } if(hhh<max[j])hhh=max[j]; for(i=0;i<time;i++){ if(block[from][0]==1 && block[from][1]==1 && block[from][2]==1 && block[from][3]==1 && block[from][4]==1){ for(j=0;j<5;j++){block[from][j]=0;} for(k=from+1;k<hhh+1;k++){ for(j=0;j<5;j++){ &block[k-1][j]=&block[k][j]; } } left-=5;hhh--; } else from++; } for(j=0;j<5;j++){ for(k=max[j];k>=0;k--){ if(block[k][j]==1)break; } max[j]=k+1; } } for(i=0;i<hhh;i++){ for(j=0;j<5;j++){ block[i][j]=0; } } printf("%d\n",left); } return 0; }
main.c: In function 'main': main.c:39:71: error: lvalue required as left operand of assignment 39 | &block[k-1][j]=&block[k][j]; | ^
s752214888
p00178
C++
#include <iostream> #include <algorithm> using namespace std; #define INF 1e9 int field[5000][5],tmp[5000][5]; void down(){ memset(tmp,0,sizeof(tmp)); for(int j = 0 ; j < 5 ; j++){ int p = 4999; for(int i = 4999 ; i >= 0 ; i--){ if(field[i][j] == -1) continue; tmp[p--][j] = field[i][j]; } } for(int i = 0 ; i < 5000 ; i++){ for(int j = 0 ; j < 5 ; j++){ field[i][j] = tmp[i][j]; } } } void remove(){ bool flg = false; for(int i = 0 ; i < 5000 ; i++){ int cnt = 0; for(int j = 0 ; j < 5 ; j++,cnt++){ if(!field[i][j]) break; } if(cnt == 5){ flg = true; for(int j = 0 ; j < 5 ; j++){ field[i][j] = -1; } } } if(flg){ down(); } } int main(){ int N,d,p,q; while(cin >> N,N){ memset(field,0,sizeof(field)); for(int i = 0 ; i < N ; i++){ cin >> d >> p >> q; q--; if(d == 1){ int min = INF; for(int j = q ; j < p+q ; j++){ for(int i = 0 ; i < 5000 ; i++){ if(i == 4999 || field[i+1][j] == 1){ min = std::min(min,i); break; } } } for(int j = q ; j < p+q ; j++){ field[min][j] = 1; } }else{ for(int i = 0 ; i < 5000 ; i++){ if(i == 4999 || field[i+1][q] == 1){ for(int j = 0 ; j < p ; j++){ field[i-j][q] = 1; } break; } } } remove(); } int ans = 0; for(int i = 0 ; i < 5000 ; i++){ for(int j = 0 ; j < 5 ; j++){ if(field[i][j] == 1) ans++; } } cout << ans << endl; } return 0; }
a.cc: In function 'void down()': a.cc:11:3: error: 'memset' was not declared in this scope 11 | memset(tmp,0,sizeof(tmp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | a.cc: In function 'int main()': a.cc:50:5: error: 'memset' was not declared in this scope 50 | memset(field,0,sizeof(field)); | ^~~~~~ a.cc:50:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s992768019
p00178
C++
#include <vector> #include <iostream> using namespace std; int n, d, p, q; int main() { cin >> n; vector<vetcor<bool> > c(5000, vector<int>(5, false)); for(int i = 0; i < n; i++) { cin >> d >> p >> q; if(d == 1) { int maxh = -1; for(int j = p - 1; j < p + q - 1; j++) { int r = 5000; while(r--) { if(c[r][j] == true) { break; } } maxh = max(maxh, r + 1); } for(int j = p - 1; j < p + q - 1; j++) { c[maxh][j] = true; } } else { int r = 5000; while(r--) { if(c[r][p] == true) { break; } } for(int j = r + 1; j < r + q + 1; j++) { c[j][p] = true; } } } int sum = 0; for(int i = 0; i < 5000; i++) { for(int j = 0; j < 5; j++) { sum += (c[j][p] ? 1 : 0); } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:12: error: 'vetcor' was not declared in this scope 12 | vector<vetcor<bool> > c(5000, vector<int>(5, false)); | ^~~~~~ a.cc:12:23: error: template argument 1 is invalid 12 | vector<vetcor<bool> > c(5000, vector<int>(5, false)); | ^ a.cc:12:23: error: template argument 2 is invalid a.cc:12:25: error: expected unqualified-id before '>' token 12 | vector<vetcor<bool> > c(5000, vector<int>(5, false)); | ^ a.cc:28:24: error: 'c' was not declared in this scope 28 | if(c[r][j] == true) | ^ a.cc:39:17: error: 'c' was not declared in this scope 39 | c[maxh][j] = true; | ^ a.cc:48:20: error: 'c' was not declared in this scope 48 | if(c[r][p] == true) | ^ a.cc:56:17: error: 'c' was not declared in this scope 56 | c[j][p] = true; | ^ a.cc:67:21: error: 'c' was not declared in this scope 67 | sum += (c[j][p] ? 1 : 0); | ^
s172380614
p00178
C++
#include <vector> #include <iostream> using namespace std; int n, d, p, q; int main() { cin >> n; vector<vector<bool> > c(5000, vector<int>(5, false)); for(int i = 0; i < n; i++) { cin >> d >> p >> q; if(d == 1) { int maxh = -1; for(int j = p - 1; j < p + q - 1; j++) { int r = 5000; while(r--) { if(c[r][j] == true) { break; } } maxh = max(maxh, r + 1); } for(int j = p - 1; j < p + q - 1; j++) { c[maxh][j] = true; } } else { int r = 5000; while(r--) { if(c[r][p] == true) { break; } } for(int j = r + 1; j < r + q + 1; j++) { c[j][p] = true; } } } int sum = 0; for(int i = 0; i < 5000; i++) { for(int j = 0; j < 5; j++) { sum += (c[j][p] ? 1 : 0); } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:56: error: no matching function for call to 'std::vector<std::vector<bool> >::vector(int, std::vector<int>)' 12 | vector<vector<bool> > c(5000, vector<int>(5, false)); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: a.cc:12:56: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 12 | vector<vector<bool> > c(5000, vector<int>(5, false)); | ^ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<bool> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<bool> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<bool> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<bool> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<bool> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; size_type = long unsigned int; value_type = std::vector<bool>; allocator_type = std::allocator<std::vector<bool> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<bool> >::value_type&' {aka 'const std::vector<bool>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<bool> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<bool> >::allocator_type&' {aka 'const std::allocator<std::vector<bool> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s428880667
p00178
C++
#include<iostream> #define N 10020 using namespace std; int main(){ while(true){ int n; int ans=0; scanf("%d",&n); if(n==0)break; int row[N]={0,}; int h[5]={0,}; for(int i = 0; i < n; ++i){ int mh = 0; int d,p,q; scanf("%d%d%d", &d, &p, &q); --q; if(d==1){ int maxh = 0; for(int j = q; j < q + p; ++j){ maxh = max( maxh, h[j] ); } for(int j = q; j < q + p; ++j){ h[j] = maxh + 1; } row[maxh]+=p; }else{ for(int j = h[q]; j < p + h[q]; ++j){ ++row[ j ]; } h[q]+=p; } // cout << " DROPPED : " << i << endl; for(int j = 0; j < 5; ++j){ mh = max( mh , h[j] ); } for(int j = 0; j < mh; ++j){ // cout << " row["<<j<<"] = " << row[j] << endl; if( row[j] == 5 ){ for(int k = 0; k < 5; ++k){ --h[k]; if(h[k]<0)=h[k]=0; } for(int k = j; k < mh+2; ++k){ row[k] = row[k + 1]; } j = -1; continue; } } } for(int i = 0; i < N; ++i){ ans += row[i]; } printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:45:23: error: expected primary-expression before '=' token 45 | if(h[k]<0)=h[k]=0; | ^
s213324014
p00178
C++
#include <iostream> #include <vector> using namespace std; int n; typedef struct Block { int d; int p; int q; } B; int F[5000][5]; int H[5]; B blocks[1000]; int highest(int r, int l) { int max = 0; for(int i=r; i<l; i++) { if(max < H[i]) { max =H[i]; } } return max; } void yoko_set(B b) { int hp = highest(b.q, b.p+b.q); for(int i=b.q; i<b.p+b.q; i++) { F[hp][i] =1; H[i] = hp+1; } } void tate_set(B b) { int hp = H[b.q]; for(int i=hp; i<hp+b.p; i++) { F[i][b.q] = 1; } H[b.q] = hp+b.p; } void col_clear() { int hp = highest(0, 5); bool is_ok = false; vector<int> cols; for(int i=0; i<=hp; i++) { is_ok =true; for(int j=0; j<5; j++) { if(F[i][j]==1) continue; is_ok = false; break; } if(is_ok) { cols.push_back(i); } } if(cols.empty()) return; int c = 0; for(int i=0; i<hp; i++) { if(cols[c]==i) { c++; continue; } for(int j=0; j<5; j++) { F[i-c][j] = F[i][j]; } } for(int i=hp-cols.size(); i<hp; i++) { for(int j=0; j<5; j++) { F[i][j] = 0; } } for(int i=0; i<5; i++) { H[i] -= cols.size(); } } int main() { while(cin >> n, n) { for(int i=0; i<n; i++) { cin >> blocks[i].d; cin >> blocks[i].p; cin >> blocks[i].q; blocks[i].q--; } memset(&F[0][0], 0, sizeof(int)*25000); memset(&H[0], 0, sizeof(int)*5); for(int i=0; i<n; i++) { if(blocks[i].d == 2) { tate_set(blocks[i]); } else { yoko_set(blocks[i]); } col_clear(); } int hp = highest(0, 5); int c = 0; for(int i=0; i<hp; i++) { for(int j=0; j<5; j++) { if(F[i][j]==1) c++; } } cout << c<< endl; } return 0; }
a.cc: In function 'int main()': a.cc:118:17: error: 'memset' was not declared in this scope 118 | memset(&F[0][0], 0, sizeof(int)*25000); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <vector> +++ |+#include <cstring> 3 |
s560976136
p00178
C++
?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> using namespace std; int dir[5010]; void remove(){ int cnt = 0; for(int i = 0 ; i < 5010 ; i++){ if( dir[i] == 31 ) dir[i] = 0,cnt++; } for(int k = 0 ; k <= cnt ; k++) for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !dir[i-1] ){ swap(dir[i],dir[i-1]); } } } void tate(int x,int l){ for(int i = 1 ; i <= l ; i++) dir[5010-i] |= (1<<x); for(int _ = 0 ; _ < 10 ; _++) for(int i = 5010-l+_ ; i > 0 ; i--){ if( (dir[i] >> x & 1) && (dir[i-1] >> x & 1) == 0 ){ dir[i] -= (1<<x); dir[i-1] += (1<<x); }else{ break; } } remove(); } void yoko(int x,int l){ int mask = ((1<<l)-1) << x; dir[5009] = mask; for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !(dir[i-1] & mask) ){ dir[i] -= mask; dir[i-1] += mask; }else{ break; } } remove(); } int main(){ int n; while(cin >> n && n){ for(int i = 0 ; i <= 5009 ; i++) dir[i] = 0; for(int i = 0 ; i < n ; i++){ int d,l,x; cin >> d >> l >> x; x--; if(d==1){ yoko(x,l); }else{ tate(x,l); } int f = 0; if( i == 10 ) continue; for( int j = 5009 ; j >= 0 ; j--){ if(f||dir[j]){ //cout << j << " " << (dir[j]&1) << (dir[j]&2) << (dir[j]&4) << (dir[j]&8) << (dir[j]&16) << endl; ; f=true; } } // cout << endl; } int ans = 0; for(int i = 0 ; i < 5010 ; i++) ans += __builtin_popcount(dir[i]); cout << ans << endl; } }
a.cc:1:2: warning: integer constant is too large for its type 1 | ?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> using namespace std; int dir[5010]; void remove(){ int cnt = 0; for(int i = 0 ; i < 5010 ; i++){ if( dir[i] == 31 ) dir[i] = 0,cnt++; } for(int k = 0 ; k <= cnt ; k++) for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !dir[i-1] ){ swap(dir[i],dir[i-1]); } } } void tate(int x,int l){ for(int i = 1 ; i <= l ; i++) dir[5010-i] |= (1<<x); for(int _ = 0 ; _ < 10 ; _++) for(int i = 5010-l+_ ; i > 0 ; i--){ if( (dir[i] >> x & 1) && (dir[i-1] >> x & 1) == 0 ){ dir[i] -= (1<<x); dir[i-1] += (1<<x); }else{ break; } } remove(); } void yoko(int x,int l){ int mask = ((1<<l)-1) << x; dir[5009] = mask; for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !(dir[i-1] & mask) ){ dir[i] -= mask; dir[i-1] += mask; }else{ break; } } remove(); } int main(){ int n; while(cin >> n && n){ for(int i = 0 ; i <= 5009 ; i++) dir[i] = 0; for(int i = 0 ; i < n ; i++){ int d,l,x; cin >> d >> l >> x; x--; if(d==1){ yoko(x,l); }else{ tate(x,l); } int f = 0; if( i == 10 ) continue; for( int j = 5009 ; j >= 0 ; j--){ if(f||dir[j]){ //cout << j << " " << (dir[j]&1) << (dir[j]&2) << (dir[j]&4) << (dir[j]&8) << (dir[j]&16) << endl; ; f=true; } } // cout << endl; } int ans = 0; for(int i = 0 ; i < 5010 ; i++) ans += __builtin_popcount(dir[i]); cout << ans << endl; } } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:1:148: error: stray '#' in program 1 | ?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> using namespace std; int dir[5010]; void remove(){ int cnt = 0; for(int i = 0 ; i < 5010 ; i++){ if( dir[i] == 31 ) dir[i] = 0,cnt++; } for(int k = 0 ; k <= cnt ; k++) for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !dir[i-1] ){ swap(dir[i],dir[i-1]); } } } void tate(int x,int l){ for(int i = 1 ; i <= l ; i++) dir[5010-i] |= (1<<x); for(int _ = 0 ; _ < 10 ; _++) for(int i = 5010-l+_ ; i > 0 ; i--){ if( (dir[i] >> x & 1) && (dir[i-1] >> x & 1) == 0 ){ dir[i] -= (1<<x); dir[i-1] += (1<<x); }else{ break; } } remove(); } void yoko(int x,int l){ int mask = ((1<<l)-1) << x; dir[5009] = mask; for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !(dir[i-1] & mask) ){ dir[i] -= mask; dir[i-1] += mask; }else{ break; } } remove(); } int main(){ int n; while(cin >> n && n){ for(int i = 0 ; i <= 5009 ; i++) dir[i] = 0; for(int i = 0 ; i < n ; i++){ int d,l,x; cin >> d >> l >> x; x--; if(d==1){ yoko(x,l); }else{ tate(x,l); } int f = 0; if( i == 10 ) continue; for( int j = 5009 ; j >= 0 ; j--){ if(f||dir[j]){ //cout << j << " " << (dir[j]&1) << (dir[j]&2) << (dir[j]&4) << (dir[j]&8) << (dir[j]&16) << endl; ; f=true; } } // cout << endl; } int ans = 0; for(int i = 0 ; i < 5010 ; i++) ans += __builtin_popcount(dir[i]); cout << ans << endl; } } | ^ a.cc:1:1: error: expected unqualified-id before '?' token 1 | ?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> using namespace std; int dir[5010]; void remove(){ int cnt = 0; for(int i = 0 ; i < 5010 ; i++){ if( dir[i] == 31 ) dir[i] = 0,cnt++; } for(int k = 0 ; k <= cnt ; k++) for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !dir[i-1] ){ swap(dir[i],dir[i-1]); } } } void tate(int x,int l){ for(int i = 1 ; i <= l ; i++) dir[5010-i] |= (1<<x); for(int _ = 0 ; _ < 10 ; _++) for(int i = 5010-l+_ ; i > 0 ; i--){ if( (dir[i] >> x & 1) && (dir[i-1] >> x & 1) == 0 ){ dir[i] -= (1<<x); dir[i-1] += (1<<x); }else{ break; } } remove(); } void yoko(int x,int l){ int mask = ((1<<l)-1) << x; dir[5009] = mask; for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !(dir[i-1] & mask) ){ dir[i] -= mask; dir[i-1] += mask; }else{ break; } } remove(); } int main(){ int n; while(cin >> n && n){ for(int i = 0 ; i <= 5009 ; i++) dir[i] = 0; for(int i = 0 ; i < n ; i++){ int d,l,x; cin >> d >> l >> x; x--; if(d==1){ yoko(x,l); }else{ tate(x,l); } int f = 0; if( i == 10 ) continue; for( int j = 5009 ; j >= 0 ; j--){ if(f||dir[j]){ //cout << j << " " << (dir[j]&1) << (dir[j]&2) << (dir[j]&4) << (dir[j]&8) << (dir[j]&16) << endl; ; f=true; } } // cout << endl; } int ans = 0; for(int i = 0 ; i < 5010 ; i++) ans += __builtin_popcount(dir[i]); cout << ans << endl; } } | ^ a.cc: In function 'void remove()': a.cc:1:448: error: 'swap' was not declared in this scope 1 | ?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> using namespace std; int dir[5010]; void remove(){ int cnt = 0; for(int i = 0 ; i < 5010 ; i++){ if( dir[i] == 31 ) dir[i] = 0,cnt++; } for(int k = 0 ; k <= cnt ; k++) for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !dir[i-1] ){ swap(dir[i],dir[i-1]); } } } void tate(int x,int l){ for(int i = 1 ; i <= l ; i++) dir[5010-i] |= (1<<x); for(int _ = 0 ; _ < 10 ; _++) for(int i = 5010-l+_ ; i > 0 ; i--){ if( (dir[i] >> x & 1) && (dir[i-1] >> x & 1) == 0 ){ dir[i] -= (1<<x); dir[i-1] += (1<<x); }else{ break; } } remove(); } void yoko(int x,int l){ int mask = ((1<<l)-1) << x; dir[5009] = mask; for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !(dir[i-1] & mask) ){ dir[i] -= mask; dir[i-1] += mask; }else{ break; } } remove(); } int main(){ int n; while(cin >> n && n){ for(int i = 0 ; i <= 5009 ; i++) dir[i] = 0; for(int i = 0 ; i < n ; i++){ int d,l,x; cin >> d >> l >> x; x--; if(d==1){ yoko(x,l); }else{ tate(x,l); } int f = 0; if( i == 10 ) continue; for( int j = 5009 ; j >= 0 ; j--){ if(f||dir[j]){ //cout << j << " " << (dir[j]&1) << (dir[j]&2) << (dir[j]&4) << (dir[j]&8) << (dir[j]&16) << endl; ; f=true; } } // cout << endl; } int ans = 0; for(int i = 0 ; i < 5010 ; i++) ans += __builtin_popcount(dir[i]); cout << ans << endl; } } | ^~~~ a.cc: In function 'int main()': a.cc:1:1160: error: 'cin' was not declared in this scope 1 | ?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include <iostream> using namespace std; int dir[5010]; void remove(){ int cnt = 0; for(int i = 0 ; i < 5010 ; i++){ if( dir[i] == 31 ) dir[i] = 0,cnt++; } for(int k = 0 ; k <= cnt ; k++) for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !dir[i-1] ){ swap(dir[i],dir[i-1]); } } } void tate(int x,int l){ for(int i = 1 ; i <= l ; i++) dir[5010-i] |= (1<<x); for(int _ = 0 ; _ < 10 ; _++) for(int i = 5010-l+_ ; i > 0 ; i--){ if( (dir[i] >> x & 1) && (dir[i-1] >> x & 1) == 0 ){ dir[i] -= (1<<x); dir[i-1] += (1<<x); }else{ break; } } remove(); } void yoko(int x,int l){ int mask = ((1<<l)-1) << x; dir[5009] = mask; for(int i = 5009 ; i > 0 ; i--){ if( dir[i] && !(dir[i-1] & mask) ){ dir[i] -= mask; dir[i-1] += mask; }else{ break; } } remove(); } int main(){ int n; while(cin >> n && n){ for(int i =
s145999833
p00178
C++
include <iostream> #include <math.h> using namespace std; int main() { int i,j,n,a,b,c,d,e,f,g,m[10000]; while(cin >> n) { if (n==0) break; for (j=0;j<10000;j++) m[j]=0; d=0; for (i=0;i<n;i++) { cin >> a >> b >> c; f=a >1 ? 1 << (c-1) : ((1 << b)-1) << (c-1); for (j=d;j>=0;j--) if ( m[j]+f != (m[j] | f)) break; e=g=j+1; if (a==1) { m[e]+=f; d++;} else for (j=0;j<b;j++) { m[e+j]+=f; d+=b;} for (j=g; j<g+d+1; j++) if (m[j]<31) m[e++]=m[j]; } f=0; for (i=0;i<5000;i++) for (j=0;j<5;j++) f+=(m[i] & ( 1 << j))>0; cout << f << endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/cmath:45, from /usr/include/c++/14/math.h:36, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906: /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/stdlib.h:32, from /usr/include/c++/14/bits/std_abs.h:38, from /usr/include/c++/14/cmath:49: /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; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, from /usr/include/c
s361161798
p00179
Java
import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; import java.util.Scanner; import java.util.Set; class History { private int wormHash; private History prev; public History(int wormHash, History prev) { this.wormHash = wormHash; this.prev = prev; } public int getStep() { int count = 0; History h = this; while (h != null) { count++; h = h.prev; } return count; } public List<Integer> getStepList() { List<Integer> stepList = new ArrayList<Integer>(); History h = this; while (h != null) { stepList.add(h.wormHash); h = h.prev; } Collections.reverse(stepList); return stepList; } public int getWormHash() { return wormHash; } } public class MysteriousWormSolver { private static final int R = 1; private static final int G = 2; private static final int B = 4; private static final int ALL_COLOR = R | G | B; private static Map<String, Integer> STR_TO_RGB = new HashMap<String, Integer>(); private static Map<Integer, String> RGB_TO_STR = new HashMap<Integer, String>(); static { STR_TO_RGB.put("r", R); STR_TO_RGB.put("g", G); STR_TO_RGB.put("b", B); for (Map.Entry<String, Integer> e: STR_TO_RGB.entrySet()) { RGB_TO_STR.put(e.getValue(), e.getKey()); } } private List<Integer> genWormFromString(String wormStr) { List<Integer> worm = new ArrayList<Integer>(); for (char c: wormStr.toCharArray()) { worm.add(STR_TO_RGB.get(c + "")); } return worm; } private int calcWormHash(List<Integer> worm) { int hash = 0; for (int w: worm) { hash = (hash << 3) | w; } return hash; } private List<Integer> wormHashToWorm(int wormHash) { List<Integer> worm = new ArrayList<Integer>(); while (wormHash > 0) { worm.add(wormHash & ALL_COLOR); wormHash = wormHash >> 3; } Collections.reverse(worm); return worm; } private String dumpWrom(List<Integer> worm) { StringBuilder sb = new StringBuilder(); for (int w: worm) { sb.append(RGB_TO_STR.get(w)); } return sb.toString(); } private boolean isGoal(List<Integer> worm) { int state = 0; for (int w: worm) { state |= w; } if (state == R || state == G || state == B) { return true; } return false; } private History solveHelper(String wormStr) { int initialWormHash = calcWormHash(genWormFromString(wormStr)); Set<Integer> visited = new HashSet<Integer>(); visited.add(initialWormHash); Queue<History> queue = new LinkedList<History>(); queue.add(new History(initialWormHash, null)); while (!queue.isEmpty()) { History h = queue.poll(); List<Integer> worm = wormHashToWorm(h.getWormHash()); if (isGoal(worm)) { return h; } else { for (int i = 0, j = 1; i < worm.size() - 1; i++, j++) { int iColor = worm.get(i); int jColor = worm.get(j); if (iColor != jColor) { int newColor = ALL_COLOR ^ (iColor | jColor); worm.set(i, newColor); worm.set(j, newColor); int wormHash = calcWormHash(worm); if (!visited.contains(wormHash)) { visited.add(wormHash); queue.add(new History(wormHash, h)); } worm.set(i, iColor); worm.set(j, jColor); } } } } return null; } private void printAnswer(List<Integer> stepList) { for (int wormHash: stepList) { List<Integer> worm = wormHashToWorm(wormHash); System.out.println(dumpWrom(worm)); } } public void solve(String wormStr) { History h = solveHelper(wormStr); if (h == null) { System.out.println("NA"); } else { int count = h.getStep() - 1; //printAnswer(h.getStepList()); System.out.println(count); } } public static void main(String[] args) { MysteriousWormSolver solver = new MysteriousWormSolver(); Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { String wormStr = scanner.nextLine(); if (!wormStr.equals("0")) { solver.solve(wormStr); } } } }
Main.java:52: error: class MysteriousWormSolver is public, should be declared in a file named MysteriousWormSolver.java public class MysteriousWormSolver { ^ 1 error
s116568829
p00179
C++
#include <cstdio> #include <string> #include <utility> #include <queue> using namespace std; typedef pair<int, string> P; int main() { char worm[32]; while (scanf("%s", worm), *worm != '0'){ queue<P> que; set<string> exist; for (que.push(P(0, string(worm))); que.size(); que.pop()){ P tmp = que.front(); string s = tmp.second; bool flag = true; for (int i = 0; i < s.length() - 1; i++){ string t = s; if (t[i] != t[i + 1]){ flag = false; if (t[i] != 'r' && t[i + 1] != 'r'){ t[i] = t[i + 1] = 'r'; } else if (t[i] != 'g' && t[i + 1] != 'g'){ t[i] = t[i + 1] = 'g'; } else { t[i] = t[i + 1] = 'b'; } que.push(P(tmp.first + 1, t)); } } if (flag){ printf("%d\n", tmp.first); break; } } if (que.empty()){ puts("NA"); } } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'set' was not declared in this scope 15 | set<string> exist; | ^~~ a.cc:5:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>' 4 | #include <queue> +++ |+#include <set> 5 | using namespace std; a.cc:15:19: error: expected primary-expression before '>' token 15 | set<string> exist; | ^ a.cc:15:21: error: 'exist' was not declared in this scope; did you mean 'exit'? 15 | set<string> exist; | ^~~~~ | exit
s069218829
p00179
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cassert> #include <vector> #include <string> #include <cmath> #include <map> #include <sstream> #include <cstdio> #include <complex> #include <cstring> #include <queue> using namespace std; const int MAX= 10000100; #define loop(i,a,b) for(int i = a ; i < b ; i ++) #define rep(i,a) loop(i,0,a) #define all(a) (a).begin(),(a).end() #define ll long long int #define gcd(a,b) __gcd(a,b) #define pb(a) push_back(a) int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);} int lcm(int a, int b) {return a*b / gcd(a, b);} typedef pair<string ,int> P; int bfs(string s){ queue<P> que; que.push(P(s,0)); map<string,int> d; while(!que.empty()){ P p=que.front(); que.pop(); if(d[p.first])continue; string st = p.first; bool f = false; rep(i,st.size()-1){ if(st[i]!=st[i+1]){ // find different words f = true; break; } } if(!f)return p.second; d[p.first] = second; rep(i,st.size()-1){ if(st[i] != st[i+1]){ char t; string nx; } } } } int main(void){ string s; while(cin>>s,s!="0"){ int ret = bfs(s); if(ret>=0)cout<<ret<<endl; else cout<<"NA"<<endl; } }
a.cc: In function 'int bfs(std::string)': a.cc:50:18: error: 'second' was not declared in this scope 50 | d[p.first] = second; | ^~~~~~ a.cc:60:1: warning: control reaches end of non-void function [-Wreturn-type] 60 | } | ^
s313798091
p00179
C++
#include <bits/stdc++.h> using namespace std; typedef pair<string, int> P; //???????????????????????????????????? bool judge(string str) { for (int i = 0; i < str.size(); ++i) { if (str[0] != str[i]) return false; } return true; } //??£?????????2?????????????????§????????????????????? char color(char a, char b){ if((a == 'g' && b == 'r') || (a == 'r' && b == 'g'))return 'b'; else if((a == 'b' && b == 'r') || (a == 'r' && b == 'b')) return 'g'; else if((a == 'g' && b == 'b') || (a == 'b' && b == 'g')) return 'r'; } int solve(string s ){ queue<P> q; map<string, int> m; q.push(P(s, 0)); //?????\??????????????¶????????\?????? if(m[p.first]) continue; //?????????????????? while (!q.empty()) { //?????\??????????????¶?????????????????§ P p = q.front(); q.pop(); string now = p.first; if (judge(now)) return p.second; for (int i = 0; i < now.size() - 1; ++i) { if (now[i] != now[i+1]){ //??£?????????2????????°????????¨??? char tmp = color(now[i], now[i + 1]); string D = now; D[i] = tmp; D[i + 1] = tmp; q.push(P(D, p.second + 1)); } } } return -1; } int main() { string worm; while (cin >> worm) { if (worm == "0") break; int count = solve(worm); if (count == -1) cout << "NA" << endl; else cout << count << endl; } return 0; }
a.cc: In function 'int solve(std::string)': a.cc:27:14: error: 'p' was not declared in this scope 27 | if(m[p.first]) continue; //?????????????????? | ^ a.cc:27:24: error: continue statement not within a loop 27 | if(m[p.first]) continue; //?????????????????? | ^~~~~~~~ a.cc: In function 'char color(char, char)': a.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type] 20 | } | ^
s804947900
p00179
C++
#include <bits/stdc++.h> using namespace std; typedef pair<string, int> P; //???????????????????????????????????? bool judge(string str) { for (int i = 0; i < str.size(); ++i) { if (str[0] != str[i]) return false; } return true; } //??£?????????2?????????????????§????????????????????? char color(char a, char b){ if((a == 'g' && b == 'r') || (a == 'r' && b == 'g'))return 'b'; else if((a == 'b' && b == 'r') || (a == 'r' && b == 'b')) return 'g'; else if((a == 'g' && b == 'b') || (a == 'b' && b == 'g')) return 'r'; } int solve(string s ){ queue<P> q; map<string, int> m; q.push(P(s, 0)); //?????\??????????????¶????????\?????? if(m[p.first]) continue; while (!q.empty()) { //?????\??????????????¶?????????????????§ P p = q.front(); q.pop(); string now = p.first; if (judge(now)) return p.second; for (int i = 0; i < now.size() - 1; ++i) { if (now[i] != now[i+1]){ //??£?????????2????????°????????¨??? char tmp = color(now[i], now[i + 1]); string D = now; D[i] = tmp; D[i + 1] = tmp; q.push(P(D, p.second + 1)); } } } return -1; } int main() { string worm; while (cin >> worm) { if (worm == "0") break; int count = solve(worm); if (count == -1) cout << "NA" << endl; else cout << count << endl; } return 0; }
a.cc: In function 'int solve(std::string)': a.cc:27:14: error: 'p' was not declared in this scope 27 | if(m[p.first]) continue; | ^ a.cc:27:24: error: continue statement not within a loop 27 | if(m[p.first]) continue; | ^~~~~~~~ a.cc: In function 'char color(char, char)': a.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type] 20 | } | ^
s020433006
p00179
C++
#include <list> #include <stdio.h> #include <algorithm> using namespace std; typedef struct { char nood[11]; int time; } WORM; unsigned int makeHash(char nood[]) { int i = 0; unsigned int ret = 0; while (nood[i] != -1){ ret += nood[i]; ret *= 3; i++; } return (ret); } int add_worm(list<WORM>* lstWorm, list<unsigned>& lstHash) { WORM add; add.time = lstWorm->front().time + 1; int i = 0; while (lstWorm->front().nood[i + 1] != -1){ if (lstWorm->front().nood[i] != lstWorm->front().nood[i + 1]){ memcpy(add.nood, lstWorm->front().nood, 11); add.nood[i] = add.nood[i + 1] = 3 - (lstWorm->front().nood[i] + lstWorm->front().nood[i + 1]); if (find(lstHash.begin(), lstHash.end(), makeHash(add.nood)) == lstHash.end()){ lstWorm->push_back(add); lstHash.push_back(makeHash(add.nood)); } } i++; } return (0); } bool checkNood(char nood[]) { int i = 1; int d = nood[0]; bool ret = true; while (nood[i] != -1){ if (d != nood[i]){ ret = false; break; } i++; } return (ret); } int main(void) { list<unsigned int> lstHash; list<WORM> lstWorm; WORM add; while (1){ lstHash.clear(); lstWorm.clear(); scanf("%s", add.nood); if (add.nood[0] == '0'){ break; } int i = 0; while (add.nood[i] != '\0'){ switch(add.nood[i]){ case 'r': add.nood[i] = 0; break; case 'g': add.nood[i] = 1; break; case 'b': add.nood[i] = 2; break; } i++; } add.nood[i] = -1; add.time = 0; lstWorm.push_back(add); lstHash.push_back(makeHash(add.nood)); while (lstWorm.empty() == false && checkNood(lstWorm.front().nood) == false){ add_worm(&lstWorm, lstHash); lstWorm.pop_front(); } if (lstWorm.empty() == true){ puts("NA"); } else { printf("%d\n", lstWorm.front().time); } } return (0); }
a.cc: In function 'int add_worm(std::__cxx11::list<WORM>*, std::__cxx11::list<unsigned int>&)': a.cc:35:25: error: 'memcpy' was not declared in this scope 35 | memcpy(add.nood, lstWorm->front().nood, 11); | ^~~~~~ a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 |
s790612708
p00179
C++
#include <iostream> #include <queue> #include <map> using namespace std; int f(char a,char b){ if( a == 'r' && b == 'g' ) return 'b'; if( a == 'b' && b == 'r' ) return 'g'; if( a == 'b' && b == 'g' ) return 'r'; swap(a,b); if( a == 'r' && b == 'g' ) return 'b'; if( a == 'b' && b == 'r' ) return 'g'; if( a == 'b' && b == 'g' ) return 'r'; return 0; } int main(){ string s; while(cin >> s && s != "0" ){ map<string,int> done; queue< pair<string,int> > Q; Q.push(make_pair(s,0)); while(Q.size()){ pair<string,int> q = Q.front(); Q.pop(); if( done[q.first]++) continue; if( count(q.first.begin(),q.first.end(),q.first[0]) == q.first.size() ) { cout << q.second << endl; goto exit; } for(int i = 0 ; i < q.first.size() - 1 ; i++){ if( f(q.first[i],q.first[i+1]) ){ char c = f(q.first[i],q.first[i+1]); string next = q.first; next[i] = next[i+1] = c; Q.push(make_pair(next,q.second+1)); } } } cout << "NA" << endl; exit:; } }
a.cc: In function 'int main()': a.cc:26:29: error: 'count' was not declared in this scope 26 | if( count(q.first.begin(),q.first.end(),q.first[0]) == q.first.size() ) { | ^~~~~
s584238461
p00179
C++
#include <cstdio> #include <queue> #include <map> using namespace std; int main() { char str[256]; char col[3] = "rgb"; while (scanf("%s", str) && str[0] !='0'){ map<string, int> minTime; queue<string> q; string s = str; minTime[s] = 0; bool ng = true; for (q.push(s); !q.empty(); q.pop()){ string look = q.front(); bool flag = true; for (int i = 0; i < look.size() - 1; i++){ if (look[i + 1] != look[i]) flag = false; } if (flag){ printf("%d\n", minTime[look]); ng = false; break; } for (int c = 0; c < 3; c++){ for (int i = 0; i < look.size() - 1; i++){ if (look[i + 1] != col[c] && look[i] != col[c] && look[i + 1] != look[i]){ string next = look; next[i + 1] = next[i] = col[c]; if (minTime.count(next) > 0) continue; minTime[next] = minTime[look] + 1; q.push(next); } } } } if (ng) printf("NA\n"); } return (0); }
a.cc: In function 'int main()': a.cc:10:23: error: initializer-string for 'char [3]' is too long [-fpermissive] 10 | char col[3] = "rgb"; | ^~~~~ a.cc:13:21: error: 'string' was not declared in this scope 13 | map<string, int> minTime; | ^~~~~~ a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 3 | #include <map> +++ |+#include <string> 4 | a.cc:13:32: error: template argument 1 is invalid 13 | map<string, int> minTime; | ^ a.cc:13:32: error: template argument 3 is invalid a.cc:13:32: error: template argument 4 is invalid a.cc:14:29: error: template argument 2 is invalid 14 | queue<string> q; | ^ a.cc:15:23: error: expected ';' before 's' 15 | string s = str; | ^~ | ; a.cc:17:25: error: 's' was not declared in this scope 17 | minTime[s] = 0; | ^ a.cc:20:24: error: request for member 'push' in 'q', which is of non-class type 'int' 20 | for (q.push(s); !q.empty(); q.pop()){ | ^~~~ a.cc:20:36: error: request for member 'empty' in 'q', which is of non-class type 'int' 20 | for (q.push(s); !q.empty(); q.pop()){ | ^~~~~ a.cc:20:47: error: request for member 'pop' in 'q', which is of non-class type 'int' 20 | for (q.push(s); !q.empty(); q.pop()){ | ^~~ a.cc:21:31: error: expected ';' before 'look' 21 | string look = q.front(); | ^~~~~ | ; a.cc:24:45: error: 'look' was not declared in this scope 24 | for (int i = 0; i < look.size() - 1; i++){ | ^~~~ a.cc:29:56: error: 'look' was not declared in this scope 29 | printf("%d\n", minTime[look]); | ^~~~ a.cc:35:53: error: 'look' was not declared in this scope 35 | for (int i = 0; i < look.size() - 1; i++){ | ^~~~ a.cc:37:55: error: expected ';' before 'next' 37 | string next = look; | ^~~~~ | ; a.cc:38:53: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 38 | next[i + 1] = next[i] = col[c]; | ^ a.cc:38:67: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 38 | next[i + 1] = next[i] = col[c]; | ^ a.cc:39:61: error: request for member 'count' in 'minTime', which is of non-class type 'int' 39 | if (minTime.count(next) > 0) continue; | ^~~~~ a.cc:40:56: error: invalid types 'int[<unresolved overloaded function type>]' for array subscript 40 | minTime[next] = minTime[look] + 1; | ^ a.cc:41:51: error: request for member 'push' in 'q', which is of non-class type 'int' 41 | q.push(next); | ^~~~
s298957495
p00179
C++
import java.util.*; public class Main{ static Scanner kbd = new Scanner(System.in); public static void main(String[] args){ while(kbd.hasNext()){ String s = kbd.nextLine(); if(!s.equals("0")) solve(s); } } static void solve(String s){ //String[] pattern = new String[60000]; HashSet<String> set = new HashSet<String>(); int pcnt = 0; Stack stack = new Stack(s); String a = s; set.add(s); //pattern[pcnt++] = a; int t = 0; while(!stack.isEmpty() && !color(a)){ //System.out.println(a+" "+color(a)); Worm w = (Worm)stack.pop(); a = w.getbody(); t = w.getTime(); for(int i=0; i<a.length()-1; i++){ if(!a.substring(i, i+1).equals(a.substring(i+1, i+2))){ String b = change(a, i, i+1); /* int j=0; while(j<pcnt && !pattern[j].equals(b)) j++; if(pattern[j]==null){ //System.out.println(b); pattern[j] = b; stack.in(b, t+1); pcnt++; } */ if(set.contains(b)) continue; else{ stack.in(b, t+1); set.add(b); } } } } if(color(a)) System.out.println(t); else System.out.println("NA"); } static boolean color(String x){ String a = x.substring(0, 1); boolean ans = true; for(int i=0; i<x.length(); i++){ String y = x.substring(i, i+1); ans = ans && a.equals(y); } return ans; } static String change(String x, int s, int e){ String ans = ""; for(int i=0; i<x.length(); i++){ if(i==s){ String a = x.substring(i, i+1); i++; String b = x.substring(i, i+1); a = select(a, b); ans += a+a; } else{ ans += x.substring(i, i+1); } } return ans; } static String select(String x, String y){ if(x.equals("r") || y.equals("r")){ if(y.equals("b") || x.equals("b")){ return "g"; } else return "b"; } else return "r"; } } class Stack { Object[] stack = new Object[60000]; int sp; int out; public Stack(String s){ sp = 0; out = 0; this.in(s, 0); } public void in(String s, int t){ Worm w = new Worm(s, t); stack[sp++] = w; } public Object pop(){ return stack[out++]; } /* public String getb(){ Worm a = (Worm)stack[sp-1]; return a.getbody(); } public int gett(){ Worm a = (Worm)stack[sp-1]; sp--; return a.getTime(); } */ public boolean isEmpty(){ return sp==out; } } class Worm{ String body; int time; public Worm(String s, int t){ body = s; time = t; } public String getbody(){ return body; } public int getTime(){ return time; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: expected unqualified-id before 'public' 2 | public class Main{ | ^~~~~~ a.cc:91:5: error: 'Object' does not name a type 91 | Object[] stack = new Object[60000]; | ^~~~~~ a.cc:94:11: error: expected ':' before 'Stack' 94 | public Stack(String s){ | ^~~~~~ | : a.cc:94:24: error: expected ')' before 's' 94 | public Stack(String s){ | ~ ^~ | ) a.cc:100:11: error: expected ':' before 'void' 100 | public void in(String s, int t){ | ^ ~~~~ | : a.cc:100:21: error: 'String' has not been declared 100 | public void in(String s, int t){ | ^~~~~~ a.cc:104:11: error: expected ':' before 'Object' 104 | public Object pop(){ | ^~~~~~~ | : a.cc:104:12: error: 'Object' does not name a type 104 | public Object pop(){ | ^~~~~~ a.cc:118:11: error: expected ':' before 'boolean' 118 | public boolean isEmpty(){ | ^~~~~~~~ | : a.cc:118:12: error: 'boolean' does not name a type; did you mean 'bool'? 118 | public boolean isEmpty(){ | ^~~~~~~ | bool a.cc:121:2: error: expected ';' after class definition 121 | } | ^ | ; a.cc: In member function 'void Stack::in(int, int)': a.cc:101:9: error: 'Worm' was not declared in this scope 101 | Worm w = new Worm(s, t); | ^~~~ a.cc:102:9: error: 'stack' was not declared in this scope; did you mean 'Stack'? 102 | stack[sp++] = w; | ^~~~~ | Stack a.cc:102:23: error: 'w' was not declared in this scope 102 | stack[sp++] = w; | ^ a.cc: At global scope: a.cc:124:5: error: 'String' does not name a type 124 | String body; | ^~~~~~ a.cc:126:11: error: expected ':' before 'Worm' 126 | public Worm(String s, int t){ | ^ ~~~~ | : a.cc:126:24: error: expected ')' before 's' 126 | public Worm(String s, int t){ | ~ ^~ | ) a.cc:130:11: error: expected ':' before 'String' 130 | public String getbody(){ | ^ ~~~~~~ | : a.cc:130:13: error: 'String' does not name a type 130 | public String getbody(){ | ^~~~~~ a.cc:133:11: error: expected ':' before 'int' 133 | public int getTime(){ | ^~~~ | : a.cc:136:2: error: expected ';' after class definition 136 | } | ^ | ;
s229539645
p00179
C++
#include <iostream> #include <queue> #include <stack> #include <vector> #include <stdio.h> #include <algorithm> #include <string> #include <cstring> #include <cmath> #include <complex> #include <map> #include <set> #include <climits> using namespace std; #define rep(i,n) for(int i=0;i<int(n);++i) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define EPS 1e-8 #define F first #define S second static const double PI=6*asin(0.5); typedef long long ll; typedef complex<double> CP; typedef pair<int,int> P; static const int INF=1<<24; string s; int qf; int foo1(int D[]){ int res=0; for(int i=0;i<s.size();i++){ res*=10; res+=D[i]; } return res; } void foo2(int D[],int m){ rep(j,s.size()){ D[j]=0; } for(int i=s.size()-1;i>=0;--i){ D[i]=m%10; m/=10; rep(j,s.size()){ } } } int a[30]; int tmp[30]; set<string> vis; bool check(){ char t=a[0]; rep(i,s.size()){ if(t!=a[i]) return false; } return true; } int main(){ while(cin>>s,s[0]!='0'){ vis.clear(); int ans=0; queue<string> qu; if(check()){ cout<<"0"<<endl; continue; } vis.insert(s); bool f=false; bool f1=false; //int c=0; while(!qu.empty()&&!f1){ //c++; //if(c>50) break; f=false; ans++; int qs=qu.size(); rep(i,qs){ qf=qu.front(); qu.pop(); if(check()){ cout<<ans-1<<endl; f1=true; break; } rep(j,s.size()-1){ if(s[j]!=s[j+1]){ string tmp=s; tmp[j] = tmp[j+1] = 'r'+'g'+'b'-s[j]-s[j+1]; if(vis.find(tmp)==vis.end()){ qu.push(tmp); vis.insert(tmp); f=true; } } } if(!f) break; } if(f1) break; } if(f1) continue; if(!f&&!f1) cout<<"NA"<<endl; } return 0; } /* int main(){ while(cin>>s,s[0]!='0'){ vis.clear(); int ans=0; queue<int> qu; rep(i,s.size()){ if(s[i]=='r') a[i]=0; else if(s[i]=='g') a[i]=1; else if(s[i]=='b') a[i]=2; } if(check()){ cout<<"0"<<endl; continue; } qu.push(foo1(a)); vis.insert(foo1(a)); bool f=false; bool f1=false; //int c=0; while(!qu.empty()&&!f1){ //c++; //if(c>50) break; f=false; ans++; int qs=qu.size(); rep(i,qs){ qf=qu.front(); qu.pop(); foo2(a,qf); if(check()){ cout<<ans-1<<endl; f1=true; break; } rep(j,s.size()-1){ if(a[j]!=a[j+1]){ rep(k,s.size()){ tmp[k]=a[k]; } if(a[j]*a[j+1]==2){ tmp[j]=0; tmp[j+1]=0; } else if(a[j]==2||a[j+1]==2){ tmp[j]=1; tmp[j+1]=1; } else{ tmp[j]=2; tmp[j+1]=2; } if(vis.find(foo1(tmp))==vis.end()){ qu.push(foo1(tmp)); vis.insert(foo1(tmp)); f=true; } } } if(!f) break; } if(f1) break; } if(f1) continue; if(!f&&!f1) cout<<"NA"<<endl; } return 0; } */
a.cc: In function 'int main()': a.cc:86:44: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'int' in assignment 86 | qf=qu.front(); | ~~~~~~~~^~ | | | __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type {aka std::__cxx11::basic_string<char>}
s834821648
p00180
C
#include<stdio.h> #include<stdlib.h> #define INF 10000000 int cost[100][500]; int mincost[500]; int used[500]; int main(void) { int n, m,a,b,c; int i,j; while (1) { scanf("%d %d", &n, &m); if (n == 0 && m == 0)break; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (i == j)cost[i][j] = 0; else cost[i][j] = INF; } } for (i = 0; i < m; i++) { scanf("%d %d %d", &a, &b, &c); cost[a][b] = c; cost[b][a] = c; } for (int i = 0; i < n; i++) { mincost[i] = INF; used[i] = 0; } mincost[0] = 0; int res = 0; while (1) { int v = -1; int u; for (u = 0; u < n; u++) { if (!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u; } if (v == -1)break; used[v] = 1; res += mincost[v]; for (u = 0; u < n; u++) mincost[u] = min(mincost[u], cost[v][u]); } printf("%d\n",res); } return 0; }
main.c: In function 'main': main.c:47:46: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration] 47 | mincost[u] = min(mincost[u], cost[v][u]); | ^~~ | main
s365116730
p00180
C++
#include <iostream> #include <utility> using namespace std; int n,m,sum; int P[110],a[10010],b[10010],cost[10010]; pair<int,int> bridge[10010]; void init(int N) { for(int i=0; i<N; ++i) P[i] = i; } int root(int a) { if(P[a] == a) return a; return (P[a] = root(P[a])); } int main() { cin >> n >> m; while(n!=0 && m!=0) { for(int i=0; i<m; ++i) { cin >> a[i] >> b[i] >> cost[i]; bridge[i].first = cost[i]; bridge[i].second = i; } sort(bridge,bridge+m); init(n); for(int i=0; i<m; ++i) { if(P[b[bridge[i].second]] == b[bridge[i].second]) { if(P[a[bridge[i].second]] != b[bridge[i].second]) { P[b[bridge[i].second]] = a[bridge[i].second]; root(b[bridge[i].second]); sum += bridge[i].first; } } } cout << sum << endl; cin >> n >> m; sum =0; } }
a.cc: In function 'int main()': a.cc:24:17: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(bridge,bridge+m); | ^~~~ | short
s922033857
p00180
C++
# include <iostream> # include <algorithm> const int MAX_N = 100; const int INF = 100000; int n, m; int cost[MAX_N][MAX_N], mincost[MAX_N]; bool used[MAX_N]; int prim(){ for (int i = 0; i < n; ++i) mincost[i] = INF; mincost[0] = 0; int res = 0; while (1){ int v = -1; for (int i = 0; i < n; ++i){ if (!used[i] && (v == -1 || mincost[i] < mincost[v])) v = i; } if (v == -1) break; used[v] = true; res += mincost[v]; for (int i = 0; i < n; ++i) mincost[i] = std::min(mincost[i], cost[v][i]); } return res; } int main(){ while (1){ std::cin >> n >> m; if (n == 0 && m == 0) break; std::memset(used, 0, n); for (int i = 0; i < n; ++i){ for (int j = 0; j < n; ++j) cost[i][j] = INF; } int a, b, c; for (int i = 0; i < m; ++i){ std::cin >> a >> b >> c; cost[a][b] = c; cost[b][a] = c; } std::cout << prim() << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:39:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 39 | std::memset(used, 0, n); | ^~~~~~ | wmemset
s601492842
p00180
C++
# include <iostream> # include <algorithm> const int MAX_N = 100; const int INF = 100000; int n, m; int cost[MAX_N][MAX_N], mincost[MAX_N]; bool used[MAX_N]; int prim(){ for (int i = 0; i < n; ++i) mincost[i] = INF; mincost[0] = 0; int res = 0; while (1){ int v = -1; for (int i = 0; i < n; ++i){ if (!used[i] && (v == -1 || mincost[i] < mincost[v])) v = i; } if (v == -1) break; used[v] = true; res += mincost[v]; for (int i = 0; i < n; ++i) mincost[i] = std::min(mincost[i], cost[v][i]); } return res; } int main(){ while (1){ std::cin >> n >> m; if (n == 0 && m == 0) break; std::memset(used, 0, n); for (int i = 0; i < n; ++i){ for (int j = 0; j < n; ++j) cost[i][j] = INF; } int a, b, c; for (int i = 0; i < m; ++i){ std::cin >> a >> b >> c; cost[a][b] = c; cost[b][a] = c; } std::cout << prim() << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:39:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 39 | std::memset(used, 0, n); | ^~~~~~ | wmemset
s024287865
p00180
C++
# include <iostream> # include <algorithm> const int MAX_N = 100; const int INF = 100000; int n, m; int cost[MAX_N][MAX_N], mincost[MAX_N]; bool used[MAX_N]; int prim(){ for (int i = 0; i < n; ++i) mincost[i] = INF; mincost[0] = 0; int res = 0; while (1){ int v = -1; for (int i = 0; i < n; ++i){ if (!used[i] && (v == -1 || mincost[i] < mincost[v])) v = i; } if (v == -1) break; used[v] = true; res += mincost[v]; for (int i = 0; i < n; ++i) mincost[i] = std::min(mincost[i], cost[v][i]); } return res; } int main(){ while (1){ std::cin >> n >> m; if (n == 0 && m == 0) break; std::memset(used, 0, n); for (int i = 0; i < n; ++i){ for (int j = 0; j < n; ++j) cost[i][j] = INF; } int a, b, c; for (int i = 0; i < m; ++i){ std::cin >> a >> b >> c; cost[a][b] = c; cost[b][a] = c; } std::cout << prim() << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:39:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 39 | std::memset(used, 0, n); | ^~~~~~ | wmemset
s642244162
p00180
C++
#include <iostream> #include <set> #include <algorithm> using namespace std; int n, m; vector< set< pair<int, int> > > cost(100,set< pair<int,int> >()); int prim() { int res=0; set<int> v; v.insert(0); while(v.size()<n) { pair<int, int> mini(100000007, -1); for(set<int>::iterator it=v.begin();it!=v.end();it++) { for(set< pair<int, int> >::iterator it2=cost[*it].begin();it2!=cost[*it].end();it2++) if(v.find((*it2).second)==v.end()) { if(mini.first>(*it2).first) mini=(*it2); break; } } v.insert(mini.second); res+=mini.first; } return res; } int main() { while(1) { cin >> n >> m; if(n==0&&m==0) break; for(int i=0;i<m;i++) { int a, b, c; cin >> a >> b >> c; cost[a].insert(pair<int, int>(c, b)); cost[b].insert(pair<int, int>(c, a)); } cout << prim() << endl; for(int i=0;i<m;i++) cost[i].clear(); } return 0; }
a.cc:8:1: error: 'vector' does not name a type 8 | vector< set< pair<int, int> > > cost(100,set< pair<int,int> >()); | ^~~~~~ a.cc: In function 'int prim()': a.cc:20:66: error: 'cost' was not declared in this scope; did you mean 'const'? 20 | for(set< pair<int, int> >::iterator it2=cost[*it].begin();it2!=cost[*it].end();it2++) | ^~~~ | const a.cc: In function 'int main()': a.cc:44:25: error: 'cost' was not declared in this scope; did you mean 'const'? 44 | cost[a].insert(pair<int, int>(c, b)); | ^~~~ | const a.cc:49:25: error: 'cost' was not declared in this scope; did you mean 'const'? 49 | cost[i].clear(); | ^~~~ | const
s405066973
p00180
C++
#include <list> #include <queue> #include <vector> #include <iostream> #include <algorithm> #include <functional> using namespace std; long long prim(int V, vector<pair<int, long long> > X[]) { priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > Q; for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false; dist[0] = 0; Q.push(make_pair(0, 0)); while (!Q.empty()) { pair<int, long long> pa = Q.top(); Q.pop(); long long a1 = pa.first, a2 = pa.second; used[a2] = true; for (int i = 0; i < X[a2].size(); i++) { int to = X[a2][i].first; long long leng = X[a2][i].second; if (dist[to] > leng && !used[to]) { dist[to] = leng; Q.push(make_pair(dist[to], to)); } } } long long sum = 0; for (int i = 0; i < V; i++) sum += dist[i]; return sum; } int n, m, u, v, w; vector<pair<int, long long> > G[100]; int main() { while(cin >> n >> m, n) { for(int i = 0; i < n; i++) G[i].clear(); for(int i = 0; i < m; i++) { cin >> u >> v >> w; G[u].push_back(make_pair(v, w)); G[v].push_back(make_pair(u, w)); } cout << prim(n, G) << endl; } }
a.cc: In function 'long long int prim(int, std::vector<std::pair<int, long long int> >*)': a.cc:10:37: error: 'dist' was not declared in this scope 10 | for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false; | ^~~~ a.cc:10:47: error: 'INF' was not declared in this scope 10 | for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false; | ^~~ a.cc:10:52: error: 'used' was not declared in this scope 10 | for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false; | ^~~~ a.cc:11:9: error: 'dist' was not declared in this scope 11 | dist[0] = 0; Q.push(make_pair(0, 0)); | ^~~~ a.cc:14:58: error: 'used' was not declared in this scope 14 | long long a1 = pa.first, a2 = pa.second; used[a2] = true; | ^~~~
s093611573
p00180
C++
#include <list> #include <queue> #include <vector> #include <iostream> #include <algorithm> #include <functional> using namespace std; bool used[100]; long long dist[100]; long long prim(int V, vector<pair<int, long long> > X[]) { priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > Q; for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false; dist[0] = 0; Q.push(make_pair(0, 0)); while (!Q.empty()) { pair<int, long long> pa = Q.top(); Q.pop(); long long a1 = pa.first, a2 = pa.second; used[a2] = true; for (int i = 0; i < X[a2].size(); i++) { int to = X[a2][i].first; long long leng = X[a2][i].second; if (dist[to] > leng && !used[to]) { dist[to] = leng; Q.push(make_pair(dist[to], to)); } } } long long sum = 0; for (int i = 0; i < V; i++) sum += dist[i]; return sum; } int n, m, u, v, w; vector<pair<int, long long> > G[100]; int main() { while(cin >> n >> m, n) { for(int i = 0; i < n; i++) G[i].clear(); for(int i = 0; i < m; i++) { cin >> u >> v >> w; G[u].push_back(make_pair(v, w)); G[v].push_back(make_pair(u, w)); } cout << prim(n, G) << endl; } }
a.cc: In function 'long long int prim(int, std::vector<std::pair<int, long long int> >*)': a.cc:11:47: error: 'INF' was not declared in this scope 11 | for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false; | ^~~
s496734165
p00180
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<math.h> #include<algorithm> #include<vector> #include<queue> #include<map> #include<string> #include<cmath> #include<set> #include<stack> using namespace std; typedef unsigned long long ll; int main(){ int n,m; while(cin>>n>>m,n){ int city[102][102]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ city[i][j]=INT_MAX; } city[i][i]=0; } for(int i=0;i<m;i++){ int a,b,c; cin>>a>>b>>c; city[a][b]=c; city[b][a]=c; } vector<int>que; vector<int>vec; vec.push_back(0); for(int i=1;i<n;i++){ que.push_back(i); } int ret=0; while(!que.empty()){ int mi=INT_MAX; int cur=-1,in; for(int j=0;j<que.size();j++){ for(int i=0;i<vec.size();i++){ if(city[vec[i]][que[j]]<mi){ mi=city[vec[i]][que[j]]; cur=que[j]; in=j; } } } ret+=mi; que.erase(que.begin()+in); vec.push_back(cur); } cout<<ret<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:28: error: 'INT_MAX' was not declared in this scope 23 | city[i][j]=INT_MAX; | ^~~~~~~ a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 12 | #include<stack> +++ |+#include <climits> 13 | a.cc:41:20: error: 'INT_MAX' was not declared in this scope 41 | int mi=INT_MAX; | ^~~~~~~ a.cc:41:20: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'