submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s117019491 | p00110 | C++ | /*
AOJ_0110: Alphametic
*/
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
using namespace std;
int Alp_calc(string);
string convert_Xtoi(string, int);
string calc_AddofNumString(string, string);
int main(void) {
string str;
int result;
while (1) {
cin >> str;
if (cin.eof()) { break; }
result = Alp_calc(str);
if (result != -1) { cout << result << endl; }
else { cout << "NA" << endl; }
}
return 0;
}
int Alp_calc(string str) {
string sect_1, sect_2, solution;
string::iterator it = str.begin();
while (*it != '+') {
sect_1 += *it;
it++;
} it++;
while (*it != '=') {
sect_2 += *it;
it++;
} it++;
while (it != str.end()) {
solution += *it;
it++;
}
for (int i = 0; i < 10; i++) {
string _bf1, _bf2, _bfs, _buff;
_bf1 = convert_Xtoi(sect_1, i);
_bf2 = convert_Xtoi(sect_2, i);
_bfs = convert_Xtoi(solution, i);
_buff = calc_AddofNumString(_bf1, _bf2);
if (_buff == _bfs) { return i; }
}
return -1;
}
string convert_Xtoi(string str, int n) {
string::iterator it = str.begin();
while (it != str.end()) {
if (*it == 'X') { *it = n + '0'; }
it++;
}
return str;
}
string calc_AddofNumString(string str1, string str2) {
bool f1 = false, f2 = false, carry = false;
char bb;
int s1_i = 0, s2_i = 0;
const int s1_mx = str1.length(), s2_mx = str2.length();
string result;
reverse(str1.begin(), str1.end());
reverse(str2.begin(), str2.end());
while ((s1_i < s1_mx) || (s2_i < s2_mx) || carry == true) {
if (carry == true) { bb = '1'; carry = false; }
else { bb = '0'; }
if (s1_i < s1_mx) { bb += str1.at(s1_i) - '0'; }
if (s2_i < s2_mx) { bb += str2.at(s2_i) - '0'; }
if (bb > '9') { bb -= 10; carry = true; }
result += bb;
s1_i++; s2_i++;
}
reverse(result.begin(), result.end());
return result;
} | a.cc: In function 'std::string calc_AddofNumString(std::string, std::string)':
a.cc:76:9: error: 'reverse' was not declared in this scope
76 | reverse(str1.begin(), str1.end());
| ^~~~~~~
|
s878325299 | p00110 | C++ | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define INF 99999999
int c;
bool ng(string a[100]){
rep(i,c){
if(a[i]=='0'&&a[i].size()!=1)return true;
}
return false;
}
int main(){
string s;
while(cin>>s){
string a[100];
c=0;
rep(i,s.size()){
if(s[i]!='+' && s[i]!='='){
a[c]+=s[i];
}
else{
c++;
}
}
c++;
bool f=true;
rep(i,10){
rep(i,c){
rep(j,a[i].size())if(a[i][j]=='X')y[j]='0'+i;
}
if( ng(a) ){f=false;break;}
int sum=0;
rep(i,c-1){
sum+=stoi(a[i]);
}
if(sum==stoi(a[c-1])){
cout<<i<<endl;
f=false;
break;
}
}
if(f)cout<<"NA"<<endl;
}
} | a.cc: In function 'bool ng(std::string*)':
a.cc:11:16: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ~~~~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h: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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
/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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
In file included from /usr/include/c++/14/string:43:
/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:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
11 | if(a[i]=='0'&&a[i].size()!=1)return true;
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/s |
s694137841 | p00110 | C++ | #include <iostream>
#include <string>
using namespace std;
int check(int,int);
int main(){
string s;
string a,b,c;
int an,bn,cn;
int A,B,C;
int i,tmp;
int X;
while(1){
cin<<s;s+='e';
a=b=c="";an=bn=cn=0;
i=0;while(s[i]=='+'){
a+=s[i];an++;
i++;
}
i++;while(s[i]=='='){
b+=s[i];bn++;
i++;
}
i++;while(s[i]=='e'){
c+=s[i];cn++;
i++;
}
A=B=C=0;
for(X=0;X<10;x++;){
for(i=0;i<an;i++){
A*=10;
tmp=isNum(a[i]);
A+=(tmp==-1)?X:tmp;
}
for(i=0;i<bn;i++){
B*=10;
tmp=isNum(b[i]);
B+=(tmp==-1)?X:tmp;
}
for(i=0;i<cn;i++){
C*=10;
tmp=isNum(c[i]);
C+=(tmp==-1)?X:tmp;
}
if(A+B==C){break;}
}
if(X==10){cout<<"NA"<<endl;}else{cout<<X<<endl;}
}
return 0;
}
int isNum(int c){
if(48<=c && c<=57){
return c-48;
}
return -1;
} | a.cc: In function 'int main()':
a.cc:16:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
16 | cin<<s;s+='e';
| ~~~^~~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:16:10: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
16 | cin<<s;s+='e';
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:16:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = std::__cxx11::basic_string<char>]':
a.cc:16:8: required from here
16 | cin<<s;s+='e';
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
a.cc:32:23: error: 'x' was not declared in this scope
32 | for(X=0;X<10;x++;){
| ^
a.cc:32:26: error: expected ')' before ';' token
32 | for(X=0;X<10;x++;){
| ~ ^
| )
a.cc:32:27: error: expected primary-expression before ')' token
32 | for(X=0;X<10;x++;){
| ^
|
s471667718 | p00110 | C++ | #include <iostream>
#include <string>
using namespace std;
int check(int,int);
int main(){
string s;
string a,b,c;
int an,bn,cn;
int A,B,C;
int i,tmp;
int X;
while(1){
cin>>s;s+='e';
a=b=c="";an=bn=cn=0;
i=0;while(s[i]=='+'){
a+=s[i];an++;
i++;
}
i++;while(s[i]=='='){
b+=s[i];bn++;
i++;
}
i++;while(s[i]=='e'){
c+=s[i];cn++;
i++;
}
A=B=C=0;
for(X=0;X<10;x++;){
for(i=0;i<an;i++){
A*=10;
tmp=isNum(a[i]);
A+=(tmp==-1)?X:tmp;
}
for(i=0;i<bn;i++){
B*=10;
tmp=isNum(b[i]);
B+=(tmp==-1)?X:tmp;
}
for(i=0;i<cn;i++){
C*=10;
tmp=isNum(c[i]);
C+=(tmp==-1)?X:tmp;
}
if(A+B==C){break;}
}
if(X==10){cout<<"NA"<<endl;}else{cout<<X<<endl;}
}
return 0;
}
int isNum(int c){
if(48<=c && c<=57){
return c-48;
}
return -1;
} | a.cc: In function 'int main()':
a.cc:32:23: error: 'x' was not declared in this scope
32 | for(X=0;X<10;x++;){
| ^
a.cc:32:26: error: expected ')' before ';' token
32 | for(X=0;X<10;x++;){
| ~ ^
| )
a.cc:32:27: error: expected primary-expression before ')' token
32 | for(X=0;X<10;x++;){
| ^
|
s626161539 | p00110 | C++ | #include <iostream>
#include <string>
using namespace std;
int check(int,int);
int isNum(int c){
if(48<=c && c<=57){
return c-48;
}
return -1;
}
int main(){
string s;
string a,b,c;
int an,bn,cn;
int A,B,C;
int i,tmp;
int X;
while(1){
cin>>s;s+='e';
a=b=c="";an=bn=cn=0;
i=0;while(s[i]=='+'){
a+=s[i];an++;
i++;
}
i++;while(s[i]=='='){
b+=s[i];bn++;
i++;
}
i++;while(s[i]=='e'){
c+=s[i];cn++;
i++;
}
A=B=C=0;
for(X=0;X<10;X++;){
for(i=0;i<an;i++){
A*=10;
tmp=isNum(a[i]);
A+=(tmp==-1)?X:tmp;
}
for(i=0;i<bn;i++){
B*=10;
tmp=isNum(b[i]);
B+=(tmp==-1)?X:tmp;
}
for(i=0;i<cn;i++){
C*=10;
tmp=isNum(c[i]);
C+=(tmp==-1)?X:tmp;
}
if(A+B==C){break;}
}
if(X==10){cout<<"NA"<<endl;}else{cout<<X<<endl;}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:26: error: expected ')' before ';' token
39 | for(X=0;X<10;X++;){
| ~ ^
| )
a.cc:39:27: error: expected primary-expression before ')' token
39 | for(X=0;X<10;X++;){
| ^
|
s513359974 | p00110 | C++ | #include <iostream>
#include <string>
using namespace std;
int check(int,int);
int isNum(int c){
if(48<=c && c<=57){
return c-48;
}
return -1;
}
int main(){
string s;
string a,b,c;
int an,bn,cn;
int A,B,C;
int i,tmp;
int X;
while(1){
cin>>s;s+='e';
a="";b="";c="";an=0;bn=0;cn=0;
i=0;while(s[i]=='+'){
a+=s[i];an++;
i++;
}
i++;while(s[i]=='='){
b+=s[i];bn++;
i++;
}
i++;while(s[i]=='e'){
c+=s[i];cn++;
i++;
}
A=0;B=0;C=0;
for(X=0;X<10;X++;){
for(i=0;i<an;i++){
A*=10;
tmp=isNum(a[i]);
if(tmp==-1){A+=X;}else{A+=tmp;}
}
for(i=0;i<bn;i++){
B*=10;
tmp=isNum(b[i]);
if(tmp==-1){B+=X;}else{B+=tmp;}
}
for(i=0;i<cn;i++){
C*=10;
tmp=isNum(c[i]);
if(tmp==-1){C+=X;}else{C+=tmp;}
}
if(A+B==C){break;}
}
if(X==10){cout<<"NA"<<endl;}else{cout<<X<<endl;}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:26: error: expected ')' before ';' token
39 | for(X=0;X<10;X++;){
| ~ ^
| )
a.cc:39:27: error: expected primary-expression before ')' token
39 | for(X=0;X<10;X++;){
| ^
|
s198726945 | p00110 | C++ | import sys
for s in sys.stdin:
p=s.split("=")
ans="NA"
st=0
tmp=p[0].split("+")
if tmp[0][0]=="X" or tmp[1][0]=="X" or p[1][0]=="X":
st=1
for i in range(st,10):
a=eval(p[0].replace("X",str(i)))
b=eval(p[1].replace("X",str(i)))
if a==b:
ans=i
break
print(ans) | a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s362238388 | p00110 | C++ | # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main()
{
string formula;
while (cin >> formula)
{
string a[3];
int r = 0;
for (int i = 0; i < formula.size(); i++)
{
if (formula[i] == '='||formula[i] == '+') {
r++; continue;
}
a[r] += formula[i];
}
bool flag = true;
for (char x = '0'; x <= '9'; x++)
{
if (x == '0' && ((a[0][0] == 'X'&&a[0].size>=2) ||( a[1][0] == 'X'&&a[1].size()>=2) || (a[2][0] == 'X'&&a[2].size()>=2)))continue;
string b[3];
for (int i = 0; i < 3; i++)
{
for (int l = 0; l < a[i].size(); l++)
{
if (a[i][l] == 'X')
{
b[i] += x;
}
else
{
b[i] += a[i][l];
}
}
}
for (int i = 0; i < 3; i++)
{
reverse(all(b[i]));
int s = 100 - b[i].size();
for (int l = 0; l < s; l++)
{
b[i] += "0";
}
}
for (int i = 0; i < 100; i++)
{
b[0][i] += b[1][i] - '0';
if (b[0][i]>'9')
{
b[0][i] = '0' + b[0][i] - '9' - 1;
b[0][i + 1]++;
}
}
if (b[0] == b[2])
{
cout << x << endl;
flag = false;
}
}
if (flag)cout << "NA" << endl;
}
} | a.cc:22:10: warning: "M_PI" redefined
22 | # define M_PI 3.141592
| ^~~~
In file included from /usr/include/c++/14/cmath:47,
from a.cc:14:
/usr/include/math.h:1121:10: note: this is the location of the previous definition
1121 | # define M_PI 3.14159265358979323846 /* pi */
| ^~~~
a.cc: In function 'int main()':
a.cc:56:52: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
56 | if (x == '0' && ((a[0][0] == 'X'&&a[0].size>=2) ||( a[1][0] == 'X'&&a[1].size()>=2) || (a[2][0] == 'X'&&a[2].size()>=2)))continue;
| ~~~~~^~~~
| ()
|
s172576277 | p00110 | C++ | import sys
import re
for line in sys.stdin:
line=re.split('[+=]',line)
flag=True
for i in range(10):
if(line[0][0]=='X'or line[1][0]=='X'or line[2][0]=='X')and i==0:continue
cnt=0
for j in range(2):
s=line[j]
s=s.replace('X',str(i))
cnt+=int(s)
s=line[2]
s=s.replace('X',str(i))
if cnt==int(s):
flag=False
print(i)
break
if flag:print("NA") | a.cc:4:23: warning: multi-character character constant [-Wmultichar]
4 | line=re.split('[+=]',line)
| ^~~~~~
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s977207946 | p00110 | C++ | while expr = gets
if expr.chomp == ""
break
end
flag = false
a1, a2, ans = expr.chomp.split(/[\+|=]/)
(0..9).each do |i|
tmp_a1 = a1.gsub("X", i.to_s).to_i
tmp_a2 = a2.gsub("X", i.to_s).to_i
tmp_ans = ans.gsub("X", i.to_s).to_i
if (tmp_a1 + tmp_a2 == tmp_ans)
puts i
flag = true
break
end
end
if !flag
puts "NA"
end
end | a.cc:7:37: error: stray '\' in program
7 | a1, a2, ans = expr.chomp.split(/[\+|=]/)
| ^
a.cc:9:4: error: too many decimal points in number
9 | (0..9).each do |i|
| ^~~~
a.cc:1:1: error: expected unqualified-id before 'while'
1 | while expr = gets
| ^~~~~
|
s038014352 | p00110 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string a;
while (cin >> a) {
int d, e = 0;
a += "+";
string l="";
for (int i = 0; i < 10; i++) {
string h = "",b[3];
int c = 0;
string f = "", o = "";
for (int j = 0; j < a.length(); j++) {
if (a[j] == '+' || a[j] == '=') {
if (h[0] == '0'&&h.length()!=1) goto stop;
b[c]= h;
c++;
h = "";
}
else {
if (a[j] == 'X')
h += to_string(i);
else
h += a[j];
}
}
f=b[0];
for (int j = b[0].length()-1; j >=0; j--)
f[b[0].length() - 1-j] = b[0][j];
b[0] = f;
f = b[1];
for (int j = b[1].length() - 1; j >= 0; j--)
f[b[1].length() - 1 - j] = b[1][j];
b[1] = f;
f = "";
bool g= false;
for (int j = 0; j < max(b[0].length(), b[1].length()); j++) {
if (j < b[0].length() && j < b[1].length()) {
int k = (int)b[0][j] - '0' + b[1][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10; g = true;
}
f += to_string(k);
}
else if (j < b[0].length()) {
int k = (int)b[0][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10;
g = true;
}
f += to_string(k);
}
else {
int k = (int)b[1][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10;
g = true;
}
f += to_string(k);
}
}
if(g) f+="1";
o = "";
for (int i = f.length() - 1; i >= 0; i--)
h += f[i];
f = h;
if (f == b[2]) {
l = to_string(i);
e++;
}
stop:;
}
if (e==0)
cout << "NA" << endl;
else
cout << l << endl;
}
} | a.cc: In function 'int main()':
a.cc:85:17: error: jump to label 'stop'
85 | stop:;
| ^~~~
a.cc:17:78: note: from here
17 | if (h[0] == '0'&&h.length()!=1) goto stop;
| ^~~~
a.cc:38:30: note: crosses initialization of 'bool g'
38 | bool g= false;
| ^
|
s794245303 | p00110 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string a;
while (cin >> a) {
int d, e = 0;
a += "+";
string l="";
for (int i = 0; i < 10; i++) {
string h = "",b[3];
int c = 0;
string f = "", o = "";
for (int j = 0; j < a.length(); j++) {
if (a[j] == '+' || a[j] == '=') {
if (h[0] == '0'&&h.length()!=1) goto stop;
b[c]= h;
c++;
h = "";
}
else {
if (a[j] == 'X')
h += to_string(i);
else
h += a[j];
}
}
f=b[0];
for (int j = b[0].length()-1; j >=0; j--)
f[b[0].length() - 1-j] = b[0][j];
b[0] = f;
f = b[1];
for (int j = b[1].length() - 1; j >= 0; j--)
f[b[1].length() - 1 - j] = b[1][j];
b[1] = f;
f = "";
bool g= false;
for (int j = 0; j < max(b[0].length(), b[1].length()); j++) {
if (j < b[0].length() && j < b[1].length()) {
int k = (int)b[0][j] - '0' + b[1][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10; g = true;
}
f += to_string(k);
}
else if (j < b[0].length()) {
int k = (int)b[0][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10;
g = true;
}
f += to_string(k);
}
else {
int k = (int)b[1][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10;
g = true;
}
f += to_string(k);
}
}
if(g) f+="1";
o = "";
for (int i = f.length() - 1; i >= 0; i--)
h += f[i];
f = h;
if (f == b[2]) {
l = to_string(i);
e++;
}
stop:;
}
if (e==0)
cout << "NA" << endl;
else
cout << l << endl;
}
} | a.cc: In function 'int main()':
a.cc:85:17: error: jump to label 'stop'
85 | stop:;
| ^~~~
a.cc:17:78: note: from here
17 | if (h[0] == '0'&&h.length()!=1) goto stop;
| ^~~~
a.cc:38:30: note: crosses initialization of 'bool g'
38 | bool g= false;
| ^
|
s041555683 | p00110 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string a="sdghjkl";
while (cin >> a) {
int d, e = 0;
a += "+";
string l="";
for (int i = 0; i < 10; i++) {
string h = "",b[3];
int c = 0;
string f = "", o = "";
for (int j = 0; j < a.size(); j++) {
if (a[j] == '+' || a[j] == '=') {
if (h[0] == '0'&&h.length()!=1) goto stop;
b[c]= h;
c++;
h = "";
}
else {
if (a[j] == 'X')
h += to_string(i);
else
h += a[j];
}
}
f=b[0];
for (int j = b[0].size()-1; j >=0; j--)
f[b[0].length() - 1-j] = b[0][j];
b[0] = f;
f = b[1];
for (int j = b[1].size() - 1; j >= 0; j--)
f[b[1].length() - 1 - j] = b[1][j];
b[1] = f;
f = "";
bool g= false;
for (int j = 0; j < max(b[0].size(), b[1].size()); j++) {
if (j < b[0].size() && j < b[1].size()) {
int k = (int)b[0][j] - '0' + b[1][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10; g = true;
}
f += to_string(k);
}
else if (j < b[0].size()) {
int k = (int)b[0][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10;
g = true;
}
f += to_string(k);
}
else {
int k = (int)b[1][j] - '0';
if (g) {
k++;
g = false;
}
if (k >= 10) {
k -= 10;
g = true;
}
f += to_string(k);
}
}
if(g) f+="1";
o = "";
for (int i = f.length() - 1; i >= 0; i--)
h += f[i];
f = h;
if (f == b[2]) {
l = to_string(i);
e++;
break;
}
stop:;
}
if (e==0)
cout << "NA" << endl;
else
cout << l << endl;
}
} | a.cc: In function 'int main()':
a.cc:86:17: error: jump to label 'stop'
86 | stop:;
| ^~~~
a.cc:17:78: note: from here
17 | if (h[0] == '0'&&h.length()!=1) goto stop;
| ^~~~
a.cc:38:30: note: crosses initialization of 'bool g'
38 | bool g= false;
| ^
|
s710929706 | p00110 | C++ | while e = gets
equation = e.chomp.sub!(/=/, '+').split('+')
flag = false
for i in 0..9
sec1, sec2, sec3 = "", "", ""
sec1 = equation[0].gsub("X", i.to_s)
sec2 = equation[1].gsub("X", i.to_s)
sec3 = equation[2].gsub("X", i.to_s)
if sec1.to_i + sec2.to_i == sec3.to_i
puts i
flag = true
break
end
end
puts "NA" if flag == false
end
| a.cc:5:14: error: too many decimal points in number
5 | for i in 0..9
| ^~~~
a.cc:1:1: error: expected unqualified-id before 'while'
1 | while e = gets
| ^~~~~
|
s579952807 | p00110 | C++ | using System;
class A{
static void Main(){
while(true){
tring poikas=Console.ReadLine();
if(poikas==null){break;}
var shiki=poikas.Split('=');
var ko=shiki.Split('+');
var left=ko[0],right=ko[1],ans=ko[2];
for(int i=0;i<10;i++){
string Left="",Right="",Ans="";
string tasu=i.ToString();
for(int j=0;j<left.Length;j++){
if(left[j]=='X'){
Left+=tasu;
}
else{
Left+=left[j];
}
}
for(int j=0;j<right.Length;j++){
if(right[j]=='X'){
Right+=tasu;
}
else{
Right+=right[j];
}
}
for(int j=0;j<ans.Length;j++){
if(ans[j]=='X'){
Ans+=tasu;
}
else{
Ans+=ans[j];
}
}
if(int.Parse(Left)+int.Parse(Right)==int.Parse(Ans)){
Console.WriteLine(i);break;
}
if(i==9)
{Console.WriteLine("NA");}
}
}
}
}
| a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:45:2: error: expected ';' after class definition
45 | }
| ^
| ;
a.cc: In static member function 'static void A::Main()':
a.cc:5:13: error: 'tring' was not declared in this scope
5 | tring poikas=Console.ReadLine();
| ^~~~~
a.cc:6:16: error: 'poikas' was not declared in this scope
6 | if(poikas==null){break;}
| ^~~~~~
a.cc:6:24: error: 'null' was not declared in this scope
6 | if(poikas==null){break;}
| ^~~~
a.cc:7:13: error: 'var' was not declared in this scope
7 | var shiki=poikas.Split('=');
| ^~~
a.cc:8:17: error: expected ';' before 'ko'
8 | var ko=shiki.Split('+');
| ^~
a.cc:9:17: error: expected ';' before 'left'
9 | var left=ko[0],right=ko[1],ans=ko[2];
| ^~~~
a.cc:11:17: error: 'string' was not declared in this scope
11 | string Left="",Right="",Ans="";
| ^~~~~~
a.cc:12:24: error: expected ';' before 'tasu'
12 | string tasu=i.ToString();
| ^~~~
a.cc:13:31: error: 'left' was not declared in this scope
13 | for(int j=0;j<left.Length;j++){
| ^~~~
a.cc:15:25: error: 'Left' was not declared in this scope
15 | Left+=tasu;
| ^~~~
a.cc:15:31: error: 'tasu' was not declared in this scope
15 | Left+=tasu;
| ^~~~
a.cc:18:25: error: 'Left' was not declared in this scope
18 | Left+=left[j];
| ^~~~
a.cc:21:31: error: 'right' was not declared in this scope
21 | for(int j=0;j<right.Length;j++){
| ^~~~~
a.cc:23:25: error: 'Right' was not declared in this scope
23 | Right+=tasu;
| ^~~~~
a.cc:23:32: error: 'tasu' was not declared in this scope
23 | Right+=tasu;
| ^~~~
a.cc:26:25: error: 'Right' was not declared in this scope
26 | Right+=right[j];
| ^~~~~
a.cc:29:31: error: 'ans' was not declared in this scope
29 | for(int j=0;j<ans.Length;j++){
| ^~~
a.cc:31:25: error: 'Ans' was not declared in this scope
31 | Ans+=tasu;
| ^~~
a.cc:31:30: error: 'tasu' was not declared in this scope
31 | Ans+=tasu;
| ^~~~
a.cc:34:25: error: 'Ans' was not declared in this scope
34 | Ans+=ans[j];
| ^~~
a.cc:37:23: error: expected unqualified-id before '.' token
37 | if(int.Parse(Left)+int.Parse(Right)==int.Parse(Ans)){
| ^
a.cc:38:21: error: 'Console' was not declared in this scope
38 | Console.WriteLine(i);break;
| ^~~~~~~
a.cc:41:18: error: 'Console' was not declared in this scope
41 | {Console.WriteLine("NA");}
| ^~~~~~~
|
s017069438 | p00110 | C++ | using System;
class A{
static void Main(){
while(true){
string poikas=Console.ReadLine();
if(poikas==null){break;}
var shiki=poikas.Split('=');
var ko=shiki.Split('+');
var left=ko[0],right=ko[1],ans=ko[2];
for(int i=0;i<10;i++){
string Left="",Right="",Ans="";
string tasu=i.ToString();
for(int j=0;j<left.Length;j++){
if(left[j]=='X'){
Left+=tasu;
}
else{
Left+=left[j];
}
}
for(int j=0;j<right.Length;j++){
if(right[j]=='X'){
Right+=tasu;
}
else{
Right+=right[j];
}
}
for(int j=0;j<ans.Length;j++){
if(ans[j]=='X'){
Ans+=tasu;
}
else{
Ans+=ans[j];
}
}
if(int.Parse(Left)+int.Parse(Right)==int.Parse(Ans)){
Console.WriteLine(i);break;
}
if(i==9)
{Console.WriteLine("NA");}
}
}
}
}
| a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:45:2: error: expected ';' after class definition
45 | }
| ^
| ;
a.cc: In static member function 'static void A::Main()':
a.cc:5:13: error: 'string' was not declared in this scope
5 | string poikas=Console.ReadLine();
| ^~~~~~
a.cc:6:16: error: 'poikas' was not declared in this scope
6 | if(poikas==null){break;}
| ^~~~~~
a.cc:6:24: error: 'null' was not declared in this scope
6 | if(poikas==null){break;}
| ^~~~
a.cc:7:13: error: 'var' was not declared in this scope
7 | var shiki=poikas.Split('=');
| ^~~
a.cc:8:17: error: expected ';' before 'ko'
8 | var ko=shiki.Split('+');
| ^~
a.cc:9:17: error: expected ';' before 'left'
9 | var left=ko[0],right=ko[1],ans=ko[2];
| ^~~~
a.cc:11:24: error: expected ';' before 'Left'
11 | string Left="",Right="",Ans="";
| ^~~~
a.cc:12:24: error: expected ';' before 'tasu'
12 | string tasu=i.ToString();
| ^~~~
a.cc:13:31: error: 'left' was not declared in this scope
13 | for(int j=0;j<left.Length;j++){
| ^~~~
a.cc:15:25: error: 'Left' was not declared in this scope
15 | Left+=tasu;
| ^~~~
a.cc:15:31: error: 'tasu' was not declared in this scope
15 | Left+=tasu;
| ^~~~
a.cc:18:25: error: 'Left' was not declared in this scope
18 | Left+=left[j];
| ^~~~
a.cc:21:31: error: 'right' was not declared in this scope
21 | for(int j=0;j<right.Length;j++){
| ^~~~~
a.cc:23:25: error: 'Right' was not declared in this scope
23 | Right+=tasu;
| ^~~~~
a.cc:23:32: error: 'tasu' was not declared in this scope
23 | Right+=tasu;
| ^~~~
a.cc:26:25: error: 'Right' was not declared in this scope
26 | Right+=right[j];
| ^~~~~
a.cc:29:31: error: 'ans' was not declared in this scope
29 | for(int j=0;j<ans.Length;j++){
| ^~~
a.cc:31:25: error: 'Ans' was not declared in this scope
31 | Ans+=tasu;
| ^~~
a.cc:31:30: error: 'tasu' was not declared in this scope
31 | Ans+=tasu;
| ^~~~
a.cc:34:25: error: 'Ans' was not declared in this scope
34 | Ans+=ans[j];
| ^~~
a.cc:37:23: error: expected unqualified-id before '.' token
37 | if(int.Parse(Left)+int.Parse(Right)==int.Parse(Ans)){
| ^
a.cc:38:21: error: 'Console' was not declared in this scope
38 | Console.WriteLine(i);break;
| ^~~~~~~
a.cc:41:18: error: 'Console' was not declared in this scope
41 | {Console.WriteLine("NA");}
| ^~~~~~~
|
s611516653 | p00110 | C++ | #include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main( void )
{
string in;
while ( cin >> in )
{
bool found = false;
for ( int i = 0; i < 10; i++ )
{
string ex = in;
replace( ex.begin(), ex.end(), 'X', (char)('0'+i) );
replace( ex.begin(), ex.end(), '+', ' ' );
replace( ex.begin(), ex.end(), '=', ' ' );
istringstream is(ex);
string a, b, c;
is >> a >> b >> c;
if ( a[0] == '0' || b[0] == '0' || c[0] == '0' )
continue;
istringstream is2( ex );
int aa, bb, cc;
is2 >> aa >> bb >> cc;
if ( aa + bb == cc )
{
cout << i << endl;
found = true;
break;
}
}
if ( found == false )
cout << "NA" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:25: error: 'replace' was not declared in this scope
14 | replace( ex.begin(), ex.end(), 'X', (char)('0'+i) );
| ^~~~~~~
|
s835559246 | p00110 | C++ | #include<stdio.h>
#include<string.h>
char*p,E0[128],E1[128],da[128],db[128],dc[128],X;
C(){
int ia,ib,ic,v;
for(v=ia=ib=ic=0;dc[ic];){
if(da[ia])
v+=da[ia++]-'0';
if(db[ib])
v+=db[ib++]-'0';
if(v%10+'0'!=dc[ic++])
return 0;
v/=10;
}
if(v||da[ia]||db[ib])
return 0;
return 1;
}
main(){
for(;~scanf("%[^\n]\n",E0);){
for(X='0';X<='9';X++){
strcpy(E1,E0);
while(p=strchr(E1,'X'))
*p=X;
sscanf(E1,"%[^+]+%[^=]=%s",da,db,dc);
if(*da=='0'&&da[1]||*db=='0'&&db[1]||*dc=='0'&&dc[1])
continue;
strrev(da);
strrev(db);
strrev(dc);
if(C()){
printf("%c\n",X);
break;
}
}
if(X=='9'+1)
puts("NA");
}
} | a.cc:4:1: error: ISO C++ forbids declaration of 'C' with no type [-fpermissive]
4 | C(){
| ^
a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
19 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:28:25: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
28 | strrev(da);
| ^~~~~~
| strsep
|
s169837431 | p00110 | C++ | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>>
int main(void)
{
char str[256];
int xpos[256];
int xcnt;
int n;
while (fgets(str, 256, stdin) != NULL){
xcnt = 0;
for (int i = 0; str[i] != '\n'; i++){
if (str[i] == 'X'){
xpos[xcnt++] = i;
}
}
int i;
for (i = '0'; i <= '9'; i++){
for (int j = 0; j < xcnt; j++){
str[xpos[j]] = i;
}
int j = 0;
if (i == '0' && str[0] == '0' && str[1] != '+'){
continue;
}
n = atoi(str);
while (str[j] != '+')j++;
j++;
if (i == '0' && str[j + 1] != '=' && str[j] == '0'){
continue;a
}
n += atoi(&str[j]);
while (str[j] != '=')j++;
j++;
if (i == '0' && str[j + 1] != '\n' && str[j] == '0'){
continue;
}
if (n == atoi(&str[j])) {
printf("%c\n", i);
break;
}
}
if (i == '9' + 1){
puts("NA");
}
}
return (0);
} | a.cc:3:20: warning: extra tokens at end of #include directive
3 | #include <stdlib.h>>
| ^
a.cc: In function 'int main()':
a.cc:33:42: error: 'a' was not declared in this scope
33 | continue;a
| ^
|
s714844761 | p00110 | C++ | import java.util.Scanner;
//Alphametic
public class AOJ0110 {
static char[] s;
static int id;
static boolean exp(){
int a = fact();
if(a==-1)return false;
while(true){
char c = s[id++];
if(c=='=')break;
int x = fact();
if(x==-1)return false;
a+=x;
}
int b = fact();
if(b==-1)return false;
return a==b;
}
static int fact(){
int x = s[id++]-'0';
if(x==0&&Character.isDigit(s[id]))return -1;
while(Character.isDigit(s[id])){
x *= 10;
x += s[id++]-'0';
}
return x;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String r = sc.next();
String ans = "NA";
for(int i=0;i<10;i++){
s = (r.replace("X", (char)(i+'0')+"")+"$").toCharArray();
id = 0;
if(exp()){
ans = i+"";
break;
}
}
System.out.println(ans);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class AOJ0110 {
| ^~~~~~
|
s177252413 | p00110 | C++ | import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String line = sc.next();
boolean flag = false;
for (char c = '0'; c <= '9'; ++c) {
String temp = line;
temp = temp.replace('X', c);
String[] elem = temp.split("[^0-9]");
boolean ok = true;
for (int i = 0; i < 3; ++i) {
if (elem[i].length > 1 && elem[i].charAt(0) == '0') {
ok = false;
}
}
if (!ok) continue;
BigInteger l1 = new BigInteger(elem[0]);
BigInteger l2 = new BigInteger(elem[1]);
BigInteger r = new BigInteger(elem[2]);
l1 = l1.add(l2);
if (l1.equals(r)) {
System.out.println(c); flag = true; break;
}
}
if (!flag) {
System.out.println("NA");
}
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.math.*;
| ^~~~~~
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 java.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main {
| ^~~~~~
|
s235959883 | p00110 | C++ | #include <iostream>
#include <string>
#include <sstream>
void replace(std::string& text,std::string bef,std::string aft){
std::string::size_type pos = 0;
while(pos = text.find(pos,bef)){
if(pos!=std::string::npos)break;
text.replace(pos,bef.length(),aft);
pos += aft.length;
}
return ;
}
int main(){
std::string s;
while(std::cin>>s){
if(std::cin.eof())return 0;
int r = -1;
for(int i=0;i<10;i++){
std::string _s = s;
std::stringstream ss;
ss<<i;
replace(_s,"X",ss.str());
int a,b,c;
char p,e;
ss.str("");
ss<<_s;
ss>>a>>p>>b>>e>>c;
if(a+b==c){
r=i;break;
}
}
if(r>=0)std::cout<<r<<std::endl;
else{std::cout<<"NA"<<std::endl;}
}
return 0;
} | a.cc: In function 'void replace(std::string&, std::string, std::string)':
a.cc:6:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::find(std::__cxx11::basic_string<char>::size_type&, std::string&)'
6 | while(pos = text.find(pos,bef)){
| ~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2740:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2740 | find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2740:41: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
2740 | find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2720:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, typename __gnu_cxx::__alloc_traits<typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::size_type> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _Tp&, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2720 | find(const _Tp& __svt, size_type __pos = 0) const
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2720:9: note: template argument deduction/substitution failed:
a.cc:6:29: note: cannot convert 'bef' (type 'std::string' {aka 'std::__cxx11::basic_string<char>'}) to type 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
6 | while(pos = text.find(pos,bef)){
| ^~~
/usr/include/c++/14/bits/basic_string.h:2691:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2691 | find(const _CharT* __s, size_type __pos, size_type __n) const
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2691:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2706:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2706 | find(const basic_string& __str, size_type __pos = 0) const
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2706:32: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'const std::__cxx11::basic_string<char>&'
2706 | find(const basic_string& __str, size_type __pos = 0) const
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:2758:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(_CharT, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2758 | find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:2758:34: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
2758 | find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
| ~~~~~~~~~~^~~~~~~~~
a.cc:9:16: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
9 | pos += aft.length;
| ~~~~^~~~~~
| ()
|
s243613016 | p00110 | C++ | #include <iostream>
#include <string.h>
using namespace std;
#define X(a) (a=='X'?i:a-'0')
int resX(char *p[3]){
int c[10]={0},i,x[10]={0};
while(*p[2]){
for(i=0;i<10;i++)
if(X(*p[0]) + X(*p[1]) + c[i] == X(*p[2])) c[i] = 0;
else if(X(*p[0]) + X(*p[1]) - 10 + c[i] == X(*p[2])) c[i] = 1;
else x[i] = 1;
p[0]++;p[1]++;p[2]++;
}
for(i=0;i<10;i++) if(!x[i]) return i;
return -1;
}
int main(){
long i,j,n;
char buf[150], p;
while(fgets(buf, 130, stdin)){
char *p, *num[3], sp[3][150]={{0},{0},{0}};
strrev(buf);
num[2] = buf+1;
*(p=strchr(buf, '='))=0;
num[1]=++p;
*(p=strchr(p, '+'))=0;
num[0]=++p;
cout << num[0] << "," << num[1] << "," << num[2] << endl;
strcpy(sp[0], num[0]);
for(i=strlen(sp[0]);i<126;i++) sp[0][i] = '0';
strcpy(sp[1], num[1]);
for(i=strlen(sp[1]);i<126;i++) sp[1][i] = '0';
strcpy(sp[2], num[2]);
num[0]=sp[0];num[1]=sp[1];num[2]=sp[2];
int ret = resX(num);
if(ret < 0) cout << "NA" <<endl;
else cout << ret <<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:17: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
25 | strrev(buf);
| ^~~~~~
| strsep
|
s264609874 | p00110 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int main(){
string s;
while(cin>>s){
vector<int> v;
int ans=-1;int f=0;
for(int i=s.size()-1,frag=0;i>-1;--i){
if(s[i]=='X'||('0'<=s[i]&&s[i]<='9')){
++frag;
if(s[i]=='X'){
v.push_back(i);
if(i==0&&frag>=2)f=1;
}dd
}
else if(s[i]=='+'||s[i]=='='){
if(frag>=2)f=1;
frag=0;
}else frag=0;
}
for(int i=f,a,b,c;i<10;++i){
for(int j=0;j<v.size();++j){
s[v[j]]=i+'0';
}
sscanf(s.c_str(),"%d+%d=%d",&a,&b,&c);
if(a+b==c)ans=i;
}
if(ans!=-1) cout<<ans<<"\n";
else cout<<"NA\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:34: error: 'dd' was not declared in this scope
16 | }dd
| ^~
|
s085441534 | p00110 | C++ | #include <iostream>
#include <cstring>
#include <ctype>
int main()
{
const int N = 128;
char str[N];
while (std::cin >> str) {
int cs[N] = {0}, vs[N] = {0};
int sFlag = 1, cDigit = 0, maxDigit = 0;;
for (int i = strlen(str) - 1; i >= 0; --i) {
if (isdigit(str[i])) {
cs[cDigit] += sFlag * (str[i] - '0');
if (cs[cDigit] < -9 || 9 < cs[cDigit]) {
cs[cDigit] %= 10;
cs[cDigit + 1] += sFlag;
}
++cDigit;
} else {
switch (str[i]) {
case '=':
sFlag = -1;
case '+':
if (cDigit > maxDigit) maxDigit = cDigit;
cDigit = 0;
break;
case 'X':
vs[cDigit++] -= sFlag;
break;
default:
break;
}
}
}
int b;
for (b = 0; vs[b] == 0; ++b);
int ans = cs[b] / vs[b];
if (ans != 0 || vs[maxDigit - 1] == 0) {
for (int i = 0; i < maxDigit; ++i) {
if (cs[i] != vs[i] * ans) {
ans = -1;
break;
}
}
} else {
ans = -1;
}
if (ans == -1) {
std::cout << "NA";
} else {
std::cout << ans;
}
std::cout << std::endl;
}
return 0;
} | a.cc:3:10: fatal error: ctype: No such file or directory
3 | #include <ctype>
| ^~~~~~~
compilation terminated.
|
s222362142 | p00110 | C++ | import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run() {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
String line = sc.nextLine();
int plusPos = line.indexOf('+');
int equalPos = line.indexOf('=');
String leftOp = line.substring(0, plusPos);
String rightOp = line.substring(plusPos + 1, equalPos);
String answerOp = line.substring(equalPos + 1);
int res = -1;
for(int i = 0; i <= 9; i++) {
BigInteger l = new BigInteger(leftOp.replace("X", Integer.toString(i)));
BigInteger r = new BigInteger(rightOp.replace("X", Integer.toString(i)));
BigInteger a = new BigInteger(answerOp.replace("X", Integer.toString(i)));
if(a.equals(l.add(r))) res = i;
}
if(res == -1) System.out.println("NA");
else System.out.println(res);
}
}
void tr(Object... o) {
System.err.println(Arrays.deepToString(o));
}
} | 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: 'import' does not name a type
2 | import java.math.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main {
| ^~~~~~
|
s246532604 | p00110 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
bool check(int n, string s){
rep(i, s.size()){
if (s[i] == 'X') s[i] = n + '0';
}
auto iplus = s.find('+');
auto ieq = s.find('=');
vs ss(3);
ss[0] = s.substr(0, iplus);
ss[1] = s.substr(iplus + 1, ieq - iplus - 1);
ss[2] = s.substr(ieq + 1);
rep(i, 3){
if (ss[i].size() != 1 && ss[i][0] == '0') return false;
}
rep(i, 3){
reverse(all(ss[i]));
ss[i].resize(ss[2].size(),'0');
}
int carry = 0;
rep(i, ss[2].size()){
if ((ss[0][i] + ss[1][i] - 2 * '0' + carry)%10 == ss[2][i] - '0'){
carry = ss[0][i] + ss[1][i] - 2 * '0' + carry >= 10;
}
else {
return false;
}
}
return true;
}
int main(){
string s;
while (cin >> s){
int ans = -1;
rep(i, 10){
if (check(i, s)){
ans = i;
break;
}
}
if (ans == -1) cout << "NA";
else cout << ans;
cout << endl;
}
} | a.cc: In function 'bool check(int, std::string)':
a.cc:34:9: error: 'reverse' was not declared in this scope
34 | reverse(all(ss[i]));
| ^~~~~~~
|
s647353619 | p00111 | Java | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
//Doctor's Memorable Codes
public class AOJ0111 {
public static void main(String[] args) {
Map<String, Character> t = new HashMap<String, Character>();
t.put("101", ' ');
t.put("000000", '\'');
t.put("000011", ',');
t.put("10010001", '-');
t.put("010001", '.');
t.put("000001", '?');
t.put("100101", 'A');
t.put("10011010", 'B');
t.put("0101", 'C');
t.put("0001", 'D');
t.put("110", 'E');
t.put("01001", 'F');
t.put("10011011", 'G');
t.put("010000", 'H');
t.put("0111", 'I');
t.put("10011000", 'J');
t.put("0110", 'K');
t.put("00100", 'L');
t.put("10011001", 'M');
t.put("10011110", 'N');
t.put("00101", 'O');
t.put("111", 'P');
t.put("10011111", 'Q');
t.put("1000", 'R');
t.put("00110", 'S');
t.put("00111", 'T');
t.put("10011100", 'U');
t.put("10011101", 'V');
t.put("000010", 'W');
t.put("10010010", 'X');
t.put("10010011", 'Y');
t.put("10010000", 'Z');
Map<Character, String> r = new HashMap<Character, String>();
r.put('A', "00000");
r.put('B', "00001");
r.put('C', "00010");
r.put('D', "00011");
r.put('E', "00100");
r.put('F', "00101");
r.put('G', "00110");
r.put('H', "00111");
r.put('I', "01000");
r.put('J', "01001");
r.put('K', "01010");
r.put('L', "01011");
r.put('M', "01100");
r.put('N', "01101");
r.put('O', "01110");
r.put('P', "01111");
r.put('Q', "10000");
r.put('R', "10001");
r.put('S', "10010");
r.put('T', "10011");
r.put('U', "10100");
r.put('V', "10101");
r.put('W', "10110");
r.put('X', "10111");
r.put('Y', "11000");
r.put('Z', "11001");
r.put(' ', "11010");
r.put('.', "11011");
r.put(',', "11100");
r.put('-', "11101");
r.put('\'', "11110");
r.put('?', "11111");
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
char[] m = sc.nextLine().toCharArray();
StringBuilder sb = new StringBuilder();
for(char c:m)sb.append(r.get(c));
String s = sb.toString();
sb = new StringBuilder();
int i=0;
while(i<s.length()){
int k;
for(k=3;i+k<=s.length();k++){
String sub = s.substring(i,i+k);
boolean f = false;
for(String v : t.keySet()){
if(v.equals(sub)){
f = true;
break;
}
}
if(f)break;
}
if(i+k>s.length())break;
sb.append(t.get(s.substring(i,i+k)));
i+=k;
}
System.out.println(sb);
}
}
} | Main.java:6: error: class AOJ0111 is public, should be declared in a file named AOJ0111.java
public class AOJ0111 {
^
1 error
|
s125757286 | p00111 | Java | import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
/*
PETER POTTER
PETER PIPER PICKED A PECK OF PICKLED PEPPERS. A PECK OF PICKLED
PEPPERS PETER PIPER PICKED. IF PETER PIPER PICKED A PECK OF PICKLED
PEPPERS, WHERE'S THE PECK OF PICKLED PEPPERS PETER PIPER PICKED?
*/
class AsciiCode
{
String name;
static HashMap<String,String> a2b;
static HashMap<String,String> a2d;
AsciiCode()
{
a2b = new HashMap<String,String>();
a2d = new HashMap<String,String>();
a2b.put("A","00000");
a2b.put("B","00001");
a2b.put("C","00010");
a2b.put("D","00011");
a2b.put("E","00100");
a2b.put("F","00101");
a2b.put("G","00110");
a2b.put("H","00111");
a2b.put("I","01000");
a2b.put("J","01001");
a2b.put("K","01010");
a2b.put("L","01011");
a2b.put("M","01100");
a2b.put("N","01101");
a2b.put("O","01110");
a2b.put("P","01111");
a2b.put("Q","10000");
a2b.put("R","10001");
a2b.put("S","10010");
a2b.put("T","10011");
a2b.put("U","10100");
a2b.put("V","10101");
a2b.put("W","10110");
a2b.put("X","10111");
a2b.put("Y","11000");
a2b.put("Z","11001");
a2b.put(" ","11010");
a2b.put(".","11011");
a2b.put(",","11100");
a2b.put("-","11101");
a2b.put("'","11110");
a2b.put("?","11111");
a2d.put("101", " ");
a2d.put("000000", "'");
a2d.put("000011", "");
a2d.put("10010001", "-");
a2d.put("010001", ".");
a2d.put("000001", "?");
a2d.put("100101", "A");
a2d.put("10011010", "B");
a2d.put("0101", "C");
a2d.put("0001", "D");
a2d.put("110", "E");
a2d.put("01001", "F");
a2d.put("10011011", "G");
a2d.put("010000", "H");
a2d.put("0111", "I");
a2d.put("10011000", "J");
a2d.put("0110", "K");
a2d.put("00100", "L");
a2d.put("10011001", "M");
a2d.put("10011110", "N");
a2d.put("00101", "O");
a2d.put("111", "P");
a2d.put("10011111", "Q");
a2d.put("1000", "R");
a2d.put("00110", "S");
a2d.put("00111", "T");
a2d.put("10011100", "U");
a2d.put("10011101", "V");
a2d.put("000010", "W");
a2d.put("10010010", "X");
a2d.put("10010011", "Y");
a2d.put("10010000", "Z");
}
public static String s2c(String line)
{
String ans="";
for (int i=0; i<line.length(); i++){
ans += a2b.get(line.substring(i,i+1));
}
return ans;
}
public static String decode(String bin0)
{
String bin=bin0;
String t = "";
while (bin.length()>0) {
for (int i=3; i<=8; i++){
if (bin.length()>=i && a2d.containsKey(bin.substring(0, i))) {
t += a2d.get(bin.substring(0, i));
bin = bin.substring(i);
break;
}
}
if (bin.length()<=8) {
bin = "";
}
}
return t;
}
}
public class vol1_0111
{
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
AsciiCode ac = new AsciiCode();
while((line = br.readLine()) != null) {
String bin = ac.s2c(line);
String s = ac.decode(bin);
System.out.println(s);
}
}
} | Main.java:122: error: class vol1_0111 is public, should be declared in a file named vol1_0111.java
public class vol1_0111
^
1 error
|
s164905948 | p00111 | Java | class AsciiCode
{
String name;
static HashMap<String,String> a2b;
static HashMap<String,String> a2d;
AsciiCode()
{
a2b = new HashMap<String,String>();
a2d = new HashMap<String,String>();
a2b.put("A","00000");
a2b.put("B","00001");
a2b.put("C","00010");
a2b.put("D","00011");
a2b.put("E","00100");
a2b.put("F","00101");
a2b.put("G","00110");
a2b.put("H","00111");
a2b.put("I","01000");
a2b.put("J","01001");
a2b.put("K","01010");
a2b.put("L","01011");
a2b.put("M","01100");
a2b.put("N","01101");
a2b.put("O","01110");
a2b.put("P","01111");
a2b.put("Q","10000");
a2b.put("R","10001");
a2b.put("S","10010");
a2b.put("T","10011");
a2b.put("U","10100");
a2b.put("V","10101");
a2b.put("W","10110");
a2b.put("X","10111");
a2b.put("Y","11000");
a2b.put("Z","11001");
a2b.put(" ","11010");
a2b.put(".","11011");
a2b.put(",","11100");
a2b.put("-","11101");
a2b.put("'","11110");
a2b.put("?","11111");
a2d.put("101", " ");
a2d.put("000000", "'");
a2d.put("000011", "");
a2d.put("10010001", "-");
a2d.put("010001", ".");
a2d.put("000001", "?");
a2d.put("100101", "A");
a2d.put("10011010", "B");
a2d.put("0101", "C");
a2d.put("0001", "D");
a2d.put("110", "E");
a2d.put("01001", "F");
a2d.put("10011011", "G");
a2d.put("010000", "H");
a2d.put("0111", "I");
a2d.put("10011000", "J");
a2d.put("0110", "K");
a2d.put("00100", "L");
a2d.put("10011001", "M");
a2d.put("10011110", "N");
a2d.put("00101", "O");
a2d.put("111", "P");
a2d.put("10011111", "Q");
a2d.put("1000", "R");
a2d.put("00110", "S");
a2d.put("00111", "T");
a2d.put("10011100", "U");
a2d.put("10011101", "V");
a2d.put("000010", "W");
a2d.put("10010010", "X");
a2d.put("10010011", "Y");
a2d.put("10010000", "Z");
}
public static String s2c(String line)
{
String ans="";
for (int i=0; i<line.length(); i++){
ans += a2b.get(line.substring(i,i+1));
}
return ans;
}
public static String decode(String bin0)
{
String bin=bin0;
String t = "";
while (bin.length()>0) {
for (int i=3; i<=8; i++){
if (bin.length()>=i && a2d.containsKey(bin.substring(0, i))) {
t += a2d.get(bin.substring(0, i));
bin = bin.substring(i);
break;
}
}
if (bin.length()<=8) {
bin = "";
}
}
return t;
}
}
public class Main
{
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
AsciiCode ac = new AsciiCode();
while((line = br.readLine()) != null) {
String bin = ac.s2c(line);
String s = ac.decode(bin);
System.out.println(s);
}
}
} | Main.java:4: error: cannot find symbol
static HashMap<String,String> a2b;
^
symbol: class HashMap
location: class AsciiCode
Main.java:5: error: cannot find symbol
static HashMap<String,String> a2d;
^
symbol: class HashMap
location: class AsciiCode
Main.java:112: error: cannot find symbol
public static void main(String args[]) throws IOException {
^
symbol: class IOException
location: class Main
Main.java:9: error: cannot find symbol
a2b = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:10: error: cannot find symbol
a2d = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class InputStreamReader
location: class Main
8 errors
|
s042045708 | p00111 | Java | class AsciiCode
{
String name;
static HashMap<String,String> a2b;
static HashMap<String,String> a2d;
AsciiCode()
{
a2b = new HashMap<String,String>();
a2d = new HashMap<String,String>();
a2b.put("A","00000");
a2b.put("B","00001");
a2b.put("C","00010");
a2b.put("D","00011");
a2b.put("E","00100");
a2b.put("F","00101");
a2b.put("G","00110");
a2b.put("H","00111");
a2b.put("I","01000");
a2b.put("J","01001");
a2b.put("K","01010");
a2b.put("L","01011");
a2b.put("M","01100");
a2b.put("N","01101");
a2b.put("O","01110");
a2b.put("P","01111");
a2b.put("Q","10000");
a2b.put("R","10001");
a2b.put("S","10010");
a2b.put("T","10011");
a2b.put("U","10100");
a2b.put("V","10101");
a2b.put("W","10110");
a2b.put("X","10111");
a2b.put("Y","11000");
a2b.put("Z","11001");
a2b.put(" ","11010");
a2b.put(".","11011");
a2b.put(",","11100");
a2b.put("-","11101");
a2b.put("'","11110");
a2b.put("?","11111");
a2d.put("101", " ");
a2d.put("000000", "'");
a2d.put("000011", "");
a2d.put("10010001", "-");
a2d.put("010001", ".");
a2d.put("000001", "?");
a2d.put("100101", "A");
a2d.put("10011010", "B");
a2d.put("0101", "C");
a2d.put("0001", "D");
a2d.put("110", "E");
a2d.put("01001", "F");
a2d.put("10011011", "G");
a2d.put("010000", "H");
a2d.put("0111", "I");
a2d.put("10011000", "J");
a2d.put("0110", "K");
a2d.put("00100", "L");
a2d.put("10011001", "M");
a2d.put("10011110", "N");
a2d.put("00101", "O");
a2d.put("111", "P");
a2d.put("10011111", "Q");
a2d.put("1000", "R");
a2d.put("00110", "S");
a2d.put("00111", "T");
a2d.put("10011100", "U");
a2d.put("10011101", "V");
a2d.put("000010", "W");
a2d.put("10010010", "X");
a2d.put("10010011", "Y");
a2d.put("10010000", "Z");
}
public static String s2c(String line)
{
String ans="";
for (int i=0; i<line.length(); i++){
ans += a2b.get(line.substring(i,i+1));
}
return ans;
}
public static String decode(String bin0)
{
String bin=bin0;
String t = "";
while (bin.length()>0) {
for (int i=3; i<=8; i++){
if (bin.length()>=i && a2d.containsKey(bin.substring(0, i))) {
t += a2d.get(bin.substring(0, i));
bin = bin.substring(i);
break;
}
}
if (bin.length()<=8) {
bin = "";
}
}
return t;
}
}
public class Main
{
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
AsciiCode ac = new AsciiCode();
while((line = br.readLine()) != null) {
String bin = ac.s2c(line);
String s = ac.decode(bin);
System.out.println(s);
}
}
} | Main.java:4: error: cannot find symbol
static HashMap<String,String> a2b;
^
symbol: class HashMap
location: class AsciiCode
Main.java:5: error: cannot find symbol
static HashMap<String,String> a2d;
^
symbol: class HashMap
location: class AsciiCode
Main.java:112: error: cannot find symbol
public static void main(String args[]) throws IOException {
^
symbol: class IOException
location: class Main
Main.java:9: error: cannot find symbol
a2b = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:10: error: cannot find symbol
a2d = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class InputStreamReader
location: class Main
8 errors
|
s999329114 | p00111 | Java | class AsciiCode
{
String name;
static HashMap<String,String> a2b;
static HashMap<String,String> a2d;
AsciiCode()
{
a2b = new HashMap<String,String>();
a2d = new HashMap<String,String>();
a2b.put("A","00000");
a2b.put("B","00001");
a2b.put("C","00010");
a2b.put("D","00011");
a2b.put("E","00100");
a2b.put("F","00101");
a2b.put("G","00110");
a2b.put("H","00111");
a2b.put("I","01000");
a2b.put("J","01001");
a2b.put("K","01010");
a2b.put("L","01011");
a2b.put("M","01100");
a2b.put("N","01101");
a2b.put("O","01110");
a2b.put("P","01111");
a2b.put("Q","10000");
a2b.put("R","10001");
a2b.put("S","10010");
a2b.put("T","10011");
a2b.put("U","10100");
a2b.put("V","10101");
a2b.put("W","10110");
a2b.put("X","10111");
a2b.put("Y","11000");
a2b.put("Z","11001");
a2b.put(" ","11010");
a2b.put(".","11011");
a2b.put(",","11100");
a2b.put("-","11101");
a2b.put("'","11110");
a2b.put("?","11111");
a2d.put("101", " ");
a2d.put("000000", "'");
a2d.put("000011", "");
a2d.put("10010001", "-");
a2d.put("010001", ".");
a2d.put("000001", "?");
a2d.put("100101", "A");
a2d.put("10011010", "B");
a2d.put("0101", "C");
a2d.put("0001", "D");
a2d.put("110", "E");
a2d.put("01001", "F");
a2d.put("10011011", "G");
a2d.put("010000", "H");
a2d.put("0111", "I");
a2d.put("10011000", "J");
a2d.put("0110", "K");
a2d.put("00100", "L");
a2d.put("10011001", "M");
a2d.put("10011110", "N");
a2d.put("00101", "O");
a2d.put("111", "P");
a2d.put("10011111", "Q");
a2d.put("1000", "R");
a2d.put("00110", "S");
a2d.put("00111", "T");
a2d.put("10011100", "U");
a2d.put("10011101", "V");
a2d.put("000010", "W");
a2d.put("10010010", "X");
a2d.put("10010011", "Y");
a2d.put("10010000", "Z");
}
public static String s2c(String line)
{
String ans="";
for (int i=0; i<line.length(); i++){
ans += a2b.get(line.substring(i,i+1));
}
return ans;
}
public static String decode(String bin0)
{
String bin=bin0;
String t = "";
while (bin.length()>0) {
for (int i=3; i<=8; i++){
if (bin.length()>=i && a2d.containsKey(bin.substring(0, i))) {
t += a2d.get(bin.substring(0, i));
bin = bin.substring(i);
break;
}
}
if (bin.length()<=8) {
bin = "";
}
}
return t;
}
}
public class Main
{
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
AsciiCode ac = new AsciiCode();
while((line = br.readLine()) != null) {
String bin = ac.s2c(line);
String s = ac.decode(bin);
System.out.println(s);
}
}
} | Main.java:4: error: cannot find symbol
static HashMap<String,String> a2b;
^
symbol: class HashMap
location: class AsciiCode
Main.java:5: error: cannot find symbol
static HashMap<String,String> a2d;
^
symbol: class HashMap
location: class AsciiCode
Main.java:112: error: cannot find symbol
public static void main(String args[]) throws IOException {
^
symbol: class IOException
location: class Main
Main.java:9: error: cannot find symbol
a2b = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:10: error: cannot find symbol
a2d = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:113: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class InputStreamReader
location: class Main
8 errors
|
s276844306 | p00111 | Java | public class Main
{
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
AsciiCode ac = new AsciiCode();
while((line = br.readLine()) != null) {
String bin = ac.s2c(line);
String s = ac.decode(bin);
System.out.println(s);
}
}
}
class AsciiCode
{
String name;
static HashMap<String,String> a2b;
static HashMap<String,String> a2d;
AsciiCode()
{
a2b = new HashMap<String,String>();
a2d = new HashMap<String,String>();
a2b.put("A","00000");
a2b.put("B","00001");
a2b.put("C","00010");
a2b.put("D","00011");
a2b.put("E","00100");
a2b.put("F","00101");
a2b.put("G","00110");
a2b.put("H","00111");
a2b.put("I","01000");
a2b.put("J","01001");
a2b.put("K","01010");
a2b.put("L","01011");
a2b.put("M","01100");
a2b.put("N","01101");
a2b.put("O","01110");
a2b.put("P","01111");
a2b.put("Q","10000");
a2b.put("R","10001");
a2b.put("S","10010");
a2b.put("T","10011");
a2b.put("U","10100");
a2b.put("V","10101");
a2b.put("W","10110");
a2b.put("X","10111");
a2b.put("Y","11000");
a2b.put("Z","11001");
a2b.put(" ","11010");
a2b.put(".","11011");
a2b.put(",","11100");
a2b.put("-","11101");
a2b.put("'","11110");
a2b.put("?","11111");
a2d.put("101", " ");
a2d.put("000000", "'");
a2d.put("000011", "");
a2d.put("10010001", "-");
a2d.put("010001", ".");
a2d.put("000001", "?");
a2d.put("100101", "A");
a2d.put("10011010", "B");
a2d.put("0101", "C");
a2d.put("0001", "D");
a2d.put("110", "E");
a2d.put("01001", "F");
a2d.put("10011011", "G");
a2d.put("010000", "H");
a2d.put("0111", "I");
a2d.put("10011000", "J");
a2d.put("0110", "K");
a2d.put("00100", "L");
a2d.put("10011001", "M");
a2d.put("10011110", "N");
a2d.put("00101", "O");
a2d.put("111", "P");
a2d.put("10011111", "Q");
a2d.put("1000", "R");
a2d.put("00110", "S");
a2d.put("00111", "T");
a2d.put("10011100", "U");
a2d.put("10011101", "V");
a2d.put("000010", "W");
a2d.put("10010010", "X");
a2d.put("10010011", "Y");
a2d.put("10010000", "Z");
}
public static String s2c(String line)
{
String ans="";
for (int i=0; i<line.length(); i++){
ans += a2b.get(line.substring(i,i+1));
}
return ans;
}
public static String decode(String bin0)
{
String bin=bin0;
String t = "";
while (bin.length()>0) {
for (int i=3; i<=8; i++){
if (bin.length()>=i && a2d.containsKey(bin.substring(0, i))) {
t += a2d.get(bin.substring(0, i));
bin = bin.substring(i);
break;
}
}
if (bin.length()<=8) {
bin = "";
}
}
return t;
}
} | Main.java:3: error: cannot find symbol
public static void main(String args[]) throws IOException {
^
symbol: class IOException
location: class Main
Main.java:19: error: cannot find symbol
static HashMap<String,String> a2b;
^
symbol: class HashMap
location: class AsciiCode
Main.java:20: error: cannot find symbol
static HashMap<String,String> a2d;
^
symbol: class HashMap
location: class AsciiCode
Main.java:4: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:4: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:4: error: cannot find symbol
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
symbol: class InputStreamReader
location: class Main
Main.java:24: error: cannot find symbol
a2b = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
Main.java:25: error: cannot find symbol
a2d = new HashMap<String,String>();
^
symbol: class HashMap
location: class AsciiCode
8 errors
|
s453912292 | p00111 | Java | public class Main {
static final Node root = new Node();
static {
String[] zo = { "101", "000000", "000011", "10010001", "010001",
"000001", "100101", "10011010", "0101", "0001", "110", "01001",
"10011011", "010000", "0111", "10011000", "0110", "00100",
"10011001", "10011110", "00101", "111", "10011111", "1000",
"00110", "00111", "10011100", "10011101", "000010", "10010010",
"10010011", "10010000" };
char[] co = { ' ', '\'', ',', '-', '.', '?', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
for (int i = 0; i < co.length; i++) {
root.set(new Leaf(co[i]), zo[i].toCharArray(), 0);
}
}
public static void main(String[] arg) {
Scanner in = new Scanner(System.in);
while (in.hasNextLine()) {
char[] q = in.nextLine().trim().toCharArray();
StringBuilder sb = new StringBuilder();
for (char q0 : q) {
int b = 0;
switch (q0) {
case '?':
b += 1;
case '\'':
b += 1;
case '-':
b += 1;
case ',':
b += 1;
case '.':
b += 1;
case ' ':
b += 1;
b += (int) ('Z' - 'A');
break;
default:
b = (q0 - 'A');
}
String bs = Integer.toBinaryString(b);
for (int i = 0; i < 5 - bs.length(); i++) {
sb.append('0');
}
sb.append(bs);
}
char[] zo = sb.toString().toCharArray();
sb.setLength(0);
int index = 0;
while (index < zo.length) {
index = root.write(zo, index, sb);
}
System.out.println(sb.toString());
}
in.close();
}
}
enum Signal {
_0, _1;
static Signal of(char c) {
return (c == '0') ? _0 : _1;
}
}
interface Tree {
int write(char[] s, int i, StringBuilder sb);
}
class Node implements Tree {
EnumMap<Signal, Tree> node = new EnumMap<Signal, Tree>(Signal.class);
Tree set(Leaf c, char[] s, int index) {
Signal signal = Signal.of(s[index]);
Tree child;
if (index == s.length - 1) {
child = c;
node.put(signal, child);
} else if (node.containsKey(signal)) {
child = ((Node) node.get(signal)).set(c, s, index + 1);
node.put(signal, child);
} else {
child = new Node().set(c, s, index + 1);
node.put(signal, child);
}
return this;
}
public int write(char[] s, int start, StringBuilder sb) {
if (s.length <= start) {
return s.length;
}
return node.get(Signal.of(s[start])).write(s, start + 1, sb);
}
}
class Leaf implements Tree {
final char c;
Leaf(char c) {
this.c = c;
}
public int write(char[] s, int start, StringBuilder sb) {
sb.append(c);
return start;
}
} | Main.java:76: error: cannot find symbol
EnumMap<Signal, Tree> node = new EnumMap<Signal, Tree>(Signal.class);
^
symbol: class EnumMap
location: class Node
Main.java:19: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:19: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:76: error: cannot find symbol
EnumMap<Signal, Tree> node = new EnumMap<Signal, Tree>(Signal.class);
^
symbol: class EnumMap
location: class Node
4 errors
|
s873963238 | p00111 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
void conv(char *s,char c);
void cc(char *t,char *o,char *out);
int main(void){
char in[100]={""},o[1000]={""},s[20]={""},out[1000]={""},t[20]={""};
int i,l,step=0,f=0;
while(scanf("%s",in)!=EOF){
step=0;
i=0;
while(o[i]!=NULL){
o[i]=NULL;
i++;
}
while(1){
while(strlen(o)<=8){
conv(s,in[step]);
if(strlen(s)<5){
strcpy(t,s);
for(i=0;i<20;i++)s[i]=NULL;
for(i=0;(unsigned int)i<(unsigned int)5-strlen(t);i++)s[i]='0';
strcat(s,t);
}
strcat(o,s);
step++;
}
for(i=3;i<8;i++){
for(l=0;l<i;l++){
t[l]=o[l];
}
for(;l<20;l++)t[l]=NULL;
cc(t,o,out);
}
if(strcmp(t,o)==0)f++;
else f=0;
if(f==4){
i=0;
while(out[i]!=NULL){
printf("%c",out[i]);
i++;
}
printf("\n");
break;
}
}
}
return 0;
}
void conv(char *s,char c){
int a,i;
for(i=0;s[i]!=NULL;i++)s[i]=NULL;
if(c<=90 && c>=65){
a=c-65;
itoa(a,s,2);
}
else{
switch(c){
case ' ':
strcpy(s,"11010");
break;
case '.':
strcpy(s,"11011");
break;
case ',':
strcpy(s,"11100");
break;
case '-':
strcpy(s,"11101");
break;
case '\'':
strcpy(s,"11110");
break;
case '?':
strcpy(s,"11111");
break;
}
}
return;
}
void cc(char *t,char *o,char *out){
int i,l,a;
char c[1000];
for(i=0;i<1000;i++)c[i]=NULL;
a=3;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"101")==0){
out[strlen(out)]=' ';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"110")==0){
out[strlen(out)]='E';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"111")==0){
out[strlen(out)]='P';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=4;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"0101")==0){
out[strlen(out)]='C';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0001")==0){
out[strlen(out)]='D';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0111")==0){
out[strlen(out)]='I';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0110")==0){
out[strlen(out)]='K';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"1000")==0){
out[strlen(out)]='R';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=5;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"01001")==0){
out[strlen(out)]='F';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00100")==0){
out[strlen(out)]='L';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00101")==0){
out[strlen(out)]='O';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00110")==0){
out[strlen(out)]='S';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00111")==0){
out[strlen(out)]='T';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=6;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"000000")==0){
out[strlen(out)]='\'';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000011")==0){
out[strlen(out)]=',';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"010001")==0){
out[strlen(out)]='.';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000001")==0){
out[strlen(out)]='?';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"100101")==0){
out[strlen(out)]='A';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"010000")==0){
out[strlen(out)]='H';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000010")==0){
out[strlen(out)]='W';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=8;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"10010001")==0){
out[strlen(out)]='-';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011010")==0){
out[strlen(out)]='B';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011011")==0){
out[strlen(out)]='G';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011000")==0){
out[strlen(out)]='J';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011001")==0){
out[strlen(out)]='M';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011110")==0){
out[strlen(out)]='N';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011111")==0){
out[strlen(out)]='Q';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"100111001")==0){
out[strlen(out)]='U';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011101")==0){
out[strlen(out)]='V';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010010")==0){
out[strlen(out)]='X';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010011")==0){
out[strlen(out)]='Y';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010000")==0){
out[strlen(out)]='Z';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
}
| main.c: In function 'main':
main.c:18:27: warning: comparison between pointer and integer
18 | while(o[i]!=NULL){
| ^~
main.c:19:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
19 | o[i]=NULL;
| ^
main.c:28:62: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
28 | for(i=0;i<20;i++)s[i]=NULL;
| ^
main.c:39:51: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
39 | for(;l<20;l++)t[l]=NULL;
| ^
main.c:47:37: warning: comparison between pointer and integer
47 | while(out[i]!=NULL){
| ^~
main.c: In function 'conv':
main.c:69:21: warning: comparison between pointer and integer
69 | for(i=0;s[i]!=NULL;i++)s[i]=NULL;
| ^~
main.c:69:36: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
69 | for(i=0;s[i]!=NULL;i++)s[i]=NULL;
| ^
main.c:73:17: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
73 | itoa(a,s,2);
| ^~~~
main.c: In function 'cc':
main.c:106:32: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
106 | for(i=0;i<1000;i++)c[i]=NULL;
| ^
main.c:113:37: warning: comparison between pointer and integer
113 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:118:37: warning: comparison between pointer and integer
118 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:123:37: warning: comparison between pointer and integer
123 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:132:37: warning: comparison between pointer and integer
132 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:137:37: warning: comparison between pointer and integer
137 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:142:37: warning: comparison between pointer and integer
142 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:147:37: warning: comparison between pointer and integer
147 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:152:37: warning: comparison between pointer and integer
152 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:161:37: warning: comparison between pointer and integer
161 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:166:37: warning: comparison between pointer and integer
166 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:171:37: warning: comparison between pointer and integer
171 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:176:37: warning: comparison between pointer and integer
176 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:181:37: warning: comparison between pointer and integer
181 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:190:37: warning: comparison between pointer and integer
190 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:195:37: warning: comparison between pointer and integer
195 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:200:37: warning: comparison between pointer and integer
200 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:205:37: warning: comparison between pointer and integer
205 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:210:37: warning: comparison between pointer and integer
210 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:215:37: warning: comparison between pointer and integer
215 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:220:37: warning: comparison between pointer and integer
220 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:230:37: warning: comparison between pointer and integer
230 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:235:37: warning: comparison between pointer and integer
235 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:240:37: warning: comparison between pointer and integer
240 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:245:37: warning: comparison between pointer and integer
245 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:250:37: warning: comparison between pointer and integer
250 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:255:37: warning: comparison between pointer and integer
255 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:260:37: warning: comparison between pointer and integer
260 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:265:37: warning: comparison between pointer and integer
265 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:270:37: warning: comparison between pointer and integer
270 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:275:37: warning: comparison between pointer and integer
275 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:280:37: warning: comparison between pointer and integer
280 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:285:37: warning: comparison between pointer and integer
285 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
|
s151469177 | p00111 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
void conv(char *s,char c);
void cc(char *t,char *o,char *out);
int main(void){
char in[100]={""},o[1000]={""},s[20]={""},out[1000]={""},t[20]={""};
int i,l,step=0,f=0;
while(scanf("%s",in)!=EOF){
step=0;
f=0;
i=0;
while(o[i]!=NULL){
o[i]=NULL;
i++;
}
while(1){
while(strlen(o)<=8){
conv(s,in[step]);
if(strlen(s)<5){
strcpy(t,s);
for(i=0;i<20;i++)s[i]=NULL;
for(i=0;(unsigned int)i<(unsigned int)5-strlen(t);i++)s[i]='0';
strcat(s,t);
}
strcat(o,s);
step++;
}
for(i=3;i<8;i++){
for(l=0;l<i;l++){
t[l]=o[l];
}
for(;l<20;l++)t[l]=NULL;
cc(t,o,out);
}
if(strcmp(t,o)==0)f++;
else f=0;
if(f>4 || (unsigned int)step>=strlen(in)){
i=0;
while(out[i]!=NULL){
printf("%c",out[i]);
i++;
}
printf("\n");
break;
}
}
for(i=0;;i++){
if(in[i]!=NULL)in[i]=NULL;
else break;
}
for(i=0;;i++){
if(out[i]!=NULL)out[i]=NULL;
else break;
}
for(i=0;i<20;i++){
s[i]=NULL;
t[i]=NULL;
}
}
return 0;
}
void conv(char *s,char c){
int a,i;
for(i=0;s[i]!=NULL;i++)s[i]=NULL;
if(c<=90 && c>=65){
a=c-65;
itoa(a,s,2);
}
else{
switch(c){
case ' ':
strcpy(s,"11010");
break;
case '.':
strcpy(s,"11011");
break;
case ',':
strcpy(s,"11100");
break;
case '-':
strcpy(s,"11101");
break;
case '\'':
strcpy(s,"11110");
break;
case '?':
strcpy(s,"11111");
break;
}
}
return;
}
void cc(char *t,char *o,char *out){
int i,l,a;
char c[1000];
for(i=0;i<1000;i++)c[i]=NULL;
a=3;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"101")==0){
out[strlen(out)]=' ';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"110")==0){
out[strlen(out)]='E';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"111")==0){
out[strlen(out)]='P';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=4;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"0101")==0){
out[strlen(out)]='C';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0001")==0){
out[strlen(out)]='D';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0111")==0){
out[strlen(out)]='I';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0110")==0){
out[strlen(out)]='K';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"1000")==0){
out[strlen(out)]='R';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=5;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"01001")==0){
out[strlen(out)]='F';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00100")==0){
out[strlen(out)]='L';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00101")==0){
out[strlen(out)]='O';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00110")==0){
out[strlen(out)]='S';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00111")==0){
out[strlen(out)]='T';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=6;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"000000")==0){
out[strlen(out)]='\'';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000011")==0){
out[strlen(out)]=',';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"010001")==0){
out[strlen(out)]='.';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000001")==0){
out[strlen(out)]='?';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"100101")==0){
out[strlen(out)]='A';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"010000")==0){
out[strlen(out)]='H';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000010")==0){
out[strlen(out)]='W';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=8;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"10010001")==0){
out[strlen(out)]='-';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011010")==0){
out[strlen(out)]='B';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011011")==0){
out[strlen(out)]='G';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011000")==0){
out[strlen(out)]='J';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011001")==0){
out[strlen(out)]='M';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011110")==0){
out[strlen(out)]='N';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011111")==0){
out[strlen(out)]='Q';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"100111001")==0){
out[strlen(out)]='U';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011101")==0){
out[strlen(out)]='V';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010010")==0){
out[strlen(out)]='X';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010011")==0){
out[strlen(out)]='Y';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010000")==0){
out[strlen(out)]='Z';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
}
| main.c: In function 'main':
main.c:18:27: warning: comparison between pointer and integer
18 | while(o[i]!=NULL){
| ^~
main.c:19:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
19 | o[i]=NULL;
| ^
main.c:28:62: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
28 | for(i=0;i<20;i++)s[i]=NULL;
| ^
main.c:39:51: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
39 | for(;l<20;l++)t[l]=NULL;
| ^
main.c:47:37: warning: comparison between pointer and integer
47 | while(out[i]!=NULL){
| ^~
main.c:58:33: warning: comparison between pointer and integer
58 | if(in[i]!=NULL)in[i]=NULL;
| ^~
main.c:58:45: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
58 | if(in[i]!=NULL)in[i]=NULL;
| ^
main.c:63:34: warning: comparison between pointer and integer
63 | if(out[i]!=NULL)out[i]=NULL;
| ^~
main.c:63:47: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
63 | if(out[i]!=NULL)out[i]=NULL;
| ^
main.c:67:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
67 | s[i]=NULL;
| ^
main.c:68:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
68 | t[i]=NULL;
| ^
main.c: In function 'conv':
main.c:82:21: warning: comparison between pointer and integer
82 | for(i=0;s[i]!=NULL;i++)s[i]=NULL;
| ^~
main.c:82:36: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
82 | for(i=0;s[i]!=NULL;i++)s[i]=NULL;
| ^
main.c:86:17: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
86 | itoa(a,s,2);
| ^~~~
main.c: In function 'cc':
main.c:119:32: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
119 | for(i=0;i<1000;i++)c[i]=NULL;
| ^
main.c:126:37: warning: comparison between pointer and integer
126 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:131:37: warning: comparison between pointer and integer
131 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:136:37: warning: comparison between pointer and integer
136 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:145:37: warning: comparison between pointer and integer
145 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:150:37: warning: comparison between pointer and integer
150 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:155:37: warning: comparison between pointer and integer
155 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:160:37: warning: comparison between pointer and integer
160 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:165:37: warning: comparison between pointer and integer
165 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:174:37: warning: comparison between pointer and integer
174 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:179:37: warning: comparison between pointer and integer
179 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:184:37: warning: comparison between pointer and integer
184 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:189:37: warning: comparison between pointer and integer
189 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:194:37: warning: comparison between pointer and integer
194 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:203:37: warning: comparison between pointer and integer
203 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:208:37: warning: comparison between pointer and integer
208 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:213:37: warning: comparison between pointer and integer
213 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:218:37: warning: comparison between pointer and integer
218 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:223:37: warning: comparison between pointer and integer
223 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:228:37: warning: comparison between pointer and integer
228 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:233:37: warning: comparison between pointer and integer
233 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:243:37: warning: comparison between pointer and integer
243 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:248:37: warning: comparison between pointer and integer
248 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:253:37: warning: comparison between pointer and integer
253 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:258:37: warning: comparison between pointer and integer
258 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:263:37: warning: comparison between pointer and integer
263 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:268:37: warning: comparison between pointer and integer
268 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:273:37: warning: comparison between pointer and integer
273 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:278:37: warning: comparison between pointer and integer
278 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:283:37: warning: comparison between pointer and integer
283 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:288:37: warning: comparison between pointer and integer
288 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:293:37: warning: comparison between pointer and integer
293 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:298:37: warning: comparison between pointer and integer
298 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
|
s405309633 | p00111 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
void conv(char *s,char c);
void cc(char *t,char *o,char *out);
int main(void){
char in[100]={""},o[1000]={""},s[20]={""},out[1000]={""},t[20]={""};
int i,l,step=0,f=0;
while(scanf("%s",in)!=EOF){
step=0;
f=0;
i=0;
while(o[i]!=NULL){
o[i]=NULL;
i++;
}
while(1){
while(strlen(o)<=8){
conv(s,in[step]);
if(strlen(s)<5){
strcpy(t,s);
for(i=0;i<20;i++)s[i]=NULL;
for(i=0;(unsigned int)i<(unsigned int)5-strlen(t);i++)s[i]='0';
strcat(s,t);
}
strcat(o,s);
step++;
}
for(i=3;i<8;i++){
for(l=0;l<i;l++){
t[l]=o[l];
}
for(;l<20;l++)t[l]=NULL;
cc(t,o,out);
}
if(strcmp(t,o)==0)f++;
else f=0;
if(f>4 || (unsigned int)step>=strlen(in)){
i=0;
while(out[i]!=NULL){
printf("%c",out[i]);
i++;
}
printf("\n");
break;
}
}
for(i=0;;i++){
if(in[i]!=NULL)in[i]=NULL;
else break;
}
for(i=0;;i++){
if(out[i]!=NULL)out[i]=NULL;
else break;
}
for(i=0;i<20;i++){
s[i]=NULL;
t[i]=NULL;
}
}
return 0;
}
void conv(char *s,char c){
int a,i;
char s[10]={""},t[10]={""};
for(i=0;s[i]!=NULL;i++)s[i]=NULL;
if(c<=90 && c>=65){
a=c-65;
/*
itoa(a,s,2);
aの数字を二進数に変換してからsに文字として代入する
*/
for(i=0;;i++){
sprintf(&s[i],"%d",a%2);
a=a/2;
if(a==0)brek;
}
}
else{
switch(c){
case ' ':
strcpy(s,"11010");
break;
case '.':
strcpy(s,"11011");
break;
case ',':
strcpy(s,"11100");
break;
case '-':
strcpy(s,"11101");
break;
case '\'':
strcpy(s,"11110");
break;
case '?':
strcpy(s,"11111");
break;
}
}
return;
}
void cc(char *t,char *o,char *out){
int i,l,a;
char c[1000];
for(i=0;i<1000;i++)c[i]=NULL;
a=3;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"101")==0){
out[strlen(out)]=' ';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"110")==0){
out[strlen(out)]='E';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"111")==0){
out[strlen(out)]='P';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=4;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"0101")==0){
out[strlen(out)]='C';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0001")==0){
out[strlen(out)]='D';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0111")==0){
out[strlen(out)]='I';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"0110")==0){
out[strlen(out)]='K';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"1000")==0){
out[strlen(out)]='R';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=5;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"01001")==0){
out[strlen(out)]='F';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00100")==0){
out[strlen(out)]='L';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00101")==0){
out[strlen(out)]='O';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00110")==0){
out[strlen(out)]='S';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"00111")==0){
out[strlen(out)]='T';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=6;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"000000")==0){
out[strlen(out)]='\'';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000011")==0){
out[strlen(out)]=',';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"010001")==0){
out[strlen(out)]='.';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000001")==0){
out[strlen(out)]='?';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"100101")==0){
out[strlen(out)]='A';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"010000")==0){
out[strlen(out)]='H';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"000010")==0){
out[strlen(out)]='W';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
a=8;
if(strlen(t)==(unsigned int)a){
if(strcmp(t,"10010001")==0){
out[strlen(out)]='-';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011010")==0){
out[strlen(out)]='B';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011011")==0){
out[strlen(out)]='G';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011000")==0){
out[strlen(out)]='J';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011001")==0){
out[strlen(out)]='M';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011110")==0){
out[strlen(out)]='N';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011111")==0){
out[strlen(out)]='Q';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"100111001")==0){
out[strlen(out)]='U';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10011101")==0){
out[strlen(out)]='V';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010010")==0){
out[strlen(out)]='X';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010011")==0){
out[strlen(out)]='Y';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
if(strcmp(t,"10010000")==0){
out[strlen(out)]='Z';
for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
strcpy(o,c);
}
}
}
| main.c: In function 'main':
main.c:18:27: warning: comparison between pointer and integer
18 | while(o[i]!=NULL){
| ^~
main.c:19:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
19 | o[i]=NULL;
| ^
main.c:28:62: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
28 | for(i=0;i<20;i++)s[i]=NULL;
| ^
main.c:39:51: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
39 | for(;l<20;l++)t[l]=NULL;
| ^
main.c:47:37: warning: comparison between pointer and integer
47 | while(out[i]!=NULL){
| ^~
main.c:58:33: warning: comparison between pointer and integer
58 | if(in[i]!=NULL)in[i]=NULL;
| ^~
main.c:58:45: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
58 | if(in[i]!=NULL)in[i]=NULL;
| ^
main.c:63:34: warning: comparison between pointer and integer
63 | if(out[i]!=NULL)out[i]=NULL;
| ^~
main.c:63:47: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
63 | if(out[i]!=NULL)out[i]=NULL;
| ^
main.c:67:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
67 | s[i]=NULL;
| ^
main.c:68:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
68 | t[i]=NULL;
| ^
main.c: In function 'conv':
main.c:81:14: error: 's' redeclared as different kind of symbol
81 | char s[10]={""},t[10]={""};
| ^
main.c:79:17: note: previous definition of 's' with type 'char *'
79 | void conv(char *s,char c){
| ~~~~~~^
main.c:94:33: error: 'brek' undeclared (first use in this function)
94 | if(a==0)brek;
| ^~~~
main.c:94:33: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'cc':
main.c:129:32: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
129 | for(i=0;i<1000;i++)c[i]=NULL;
| ^
main.c:136:37: warning: comparison between pointer and integer
136 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:141:37: warning: comparison between pointer and integer
141 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:146:37: warning: comparison between pointer and integer
146 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:155:37: warning: comparison between pointer and integer
155 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:160:37: warning: comparison between pointer and integer
160 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:165:37: warning: comparison between pointer and integer
165 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:170:37: warning: comparison between pointer and integer
170 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:175:37: warning: comparison between pointer and integer
175 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:184:37: warning: comparison between pointer and integer
184 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:189:37: warning: comparison between pointer and integer
189 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:194:37: warning: comparison between pointer and integer
194 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:199:37: warning: comparison between pointer and integer
199 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:204:37: warning: comparison between pointer and integer
204 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:213:37: warning: comparison between pointer and integer
213 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:218:37: warning: comparison between pointer and integer
218 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:223:37: warning: comparison between pointer and integer
223 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:228:37: warning: comparison between pointer and integer
228 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:233:37: warning: comparison between pointer and integer
233 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:238:37: warning: comparison between pointer and integer
238 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:243:37: warning: comparison between pointer and integer
243 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:253:37: warning: comparison between pointer and integer
253 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:258:37: warning: comparison between pointer and integer
258 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:263:37: warning: comparison between pointer and integer
263 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:268:37: warning: comparison between pointer and integer
268 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:273:37: warning: comparison between pointer and integer
273 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:278:37: warning: comparison between pointer and integer
278 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:283:37: warning: comparison between pointer and integer
283 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:288:37: warning: comparison between pointer and integer
288 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:293:37: warning: comparison between pointer and integer
293 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:298:37: warning: comparison between pointer and integer
298 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:303:37: warning: comparison between pointer and integer
303 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
main.c:308:37: warning: comparison between pointer and integer
308 | for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
| ^~
|
s108065974 | p00111 | C++ | type Binary = String
main = interact $ unlines.map (readNumLine.concat.map (toBin code_charTable)).lines
toBin :: [(Char,String)] -> Char -> String
toBin list char = case lookup char list of
Just b -> b
Nothing -> ""
readNumLine :: String -> String
readNumLine (x:xs) = rnl [x] xs
rnl _ [] = []
rnl acc line = case lookup acc char_codeTable of
Just c -> c:readNumLine line
Nothing -> rnl (acc++[head line]) $ tail line
bin2dec :: Binary -> Int
bin2dec = foldl (\x y -> 2*x +y) 0.map (\x -> read [x])
dec2bin :: Int -> Binary
dec2bin = concat.map show.reverse.i2b
where i2b 0 = []
i2b n = mod n 2: i2b (div n 2)
showBin :: Int -> Binary -> String
showBin d n = if length n <= d then replicate (d- length n) '0' ++ n
else n
charTable = ['A','B'..'Z'] ++ [' ','.',',','-','\'','?']
codeTable = map (showBin 5.dec2bin) $ [0..31]
code_charTable = zip charTable codeTable
char_codeTable = [("101",' '),("000000",'\''),("000011",','),("10010001",'-')
,("010001",'.'),("000001",'?'),("100101",'A'),("10011010",'B')
,("0101",'C'),("0001",'D'),("110",'E'),("01001",'F'),("10011011",'G')
,("010000",'H'),("0111",'I'),("10011000",'J'),("0110",'K'),("00100",'L')
,("10011001",'M'),("10011110",'N'),("00101",'O'),("111",'P')
,("10011111",'Q'),("1000",'R'),("00110",'S'),("00111",'T'),("10011100",'U')
,("10011101",'V'),("000010",'W'),("10010010",'X'),("10010011",'Y'),("10010000",'Z')] | a.cc:19:18: error: stray '\' in program
19 | bin2dec = foldl (\x y -> 2*x +y) 0.map (\x -> read [x])
| ^
a.cc:19:41: error: stray '\' in program
19 | bin2dec = foldl (\x y -> 2*x +y) 0.map (\x -> read [x])
| ^
a.cc:31:40: error: too many decimal points in number
31 | codeTable = map (showBin 5.dec2bin) $ [0..31]
| ^~~~~
a.cc:1:1: error: 'type' does not name a type; did you mean 'typeof'?
1 | type Binary = String
| ^~~~
| typeof
|
s889356030 | p00111 | C++ | nclude<bits/stdc++.h>
using namespace std;
int main(){
map<string,char>t2;
map<char,string>t1;
t1['A']="00000";t1['R']="10001";
t1['B']="00001";t1['S']="10010";
t1['C']="00010";t1['T']="10011";
t1['D']="00011";t1['U']="10100";
t1['E']="00100";t1['V']="10101";
t1['F']="00101";t1['W']="10110";
t1['G']="00110";t1['X']="10111";
t1['H']="00111";t1['Y']="11000";
t1['I']="01000";t1['Z']="11001";
t1['J']="01001";t1[' ']="11010";
t1['K']="01010";t1['.']="11011";
t1['L']="01011";t1[',']="11100";
t1['M']="01100";t1['-']="11101";
t1['N']="01101";t1['\'']="11110";
t1['O']="01110";t1['?']="11111";
t1['P']="01111";t1['Q']="10000";
t2["101"]=' ';t2["100101"]='A';
t2["000000"]='\'';t2["10011010"]='B';
t2["000011"]=',';t2["0101"]='C';
t2["10010001"]='-';t2["0001"]='D';
t2["010001"]='.';t2["110"]='E';
t2["000001"]='?';t2["01001"]='F';
t2["10011011"]='G';t2["010000"]='H';
t2["0111"]='I';t2["10011000"]='J';
t2["0110"]='K';t2["00100"]='L';
t2["10011001"]='M';t2["10011110"]='N';
t2["00101"]='O';t2["111"]='P';
t2["10011111"]='Q';t2["1000"]='R';
t2["00110"]='S';t2["00111"]='T';
t2["10011100"]='U';t2["10011101"]='V';
t2["000010"]='W';t2["10010011"]='X';
t2["10010011"]='Y';t2["10010000"]='Z';
string s,t;
while(getline(cin,s)){
t="";
for(int i=0;i<s.size();i++)
t+=t1[s[i]];
string q;
for(int i=0;i<t.size();i++){
q+=t[i];
if(t2[q]){
cout<<t2[q];
q="";
}
}
cout<<endl;
}
} | a.cc:1:1: error: 'nclude' does not name a type
1 | nclude<bits/stdc++.h>
| ^~~~~~
a.cc: In function 'int main()':
a.cc:4:2: error: 'map' was not declared in this scope
4 | map<string,char>t2;
| ^~~
a.cc:4:6: error: 'string' was not declared in this scope
4 | map<string,char>t2;
| ^~~~~~
a.cc:4:13: error: expected primary-expression before 'char'
4 | map<string,char>t2;
| ^~~~
a.cc:5:6: error: expected primary-expression before 'char'
5 | map<char,string>t1;
| ^~~~
a.cc:6:2: error: 't1' was not declared in this scope
6 | t1['A']="00000";t1['R']="10001";
| ^~
a.cc:22:2: error: 't2' was not declared in this scope
22 | t2["101"]=' ';t2["100101"]='A';
| ^~
a.cc:38:8: error: expected ';' before 's'
38 | string s,t;
| ^~
| ;
a.cc:39:16: error: 'cin' was not declared in this scope
39 | while(getline(cin,s)){
| ^~~
a.cc:39:20: error: 's' was not declared in this scope
39 | while(getline(cin,s)){
| ^
a.cc:39:8: error: 'getline' was not declared in this scope
39 | while(getline(cin,s)){
| ^~~~~~~
a.cc:40:3: error: 't' was not declared in this scope
40 | t="";
| ^
a.cc:43:8: error: expected ';' before 'q'
43 | string q;
| ^~
| ;
a.cc:45:3: error: 'q' was not declared in this scope
45 | q+=t[i];
| ^
a.cc:47:5: error: 'cout' was not declared in this scope
47 | cout<<t2[q];
| ^~~~
a.cc:51:2: error: 'cout' was not declared in this scope
51 | cout<<endl;
| ^~~~
a.cc:51:8: error: 'endl' was not declared in this scope
51 | cout<<endl;
| ^~~~
|
s436913707 | p00111 | C++ | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx,'b').zfill(5))
decode = {"101" : " ", "0101" : "C", "0110" : "K", "00110" : "S",
"000000" : "'", "0001" : "D", "00100" : "L", "00111" : "T",
"000011" : ",", "110" : "E", "10011001" : "M", "10011100" : "U",
"10010001" : "-", "01001" : "F", "10011110" : "N", "10011101" : "V",
"010001" : ".", "10011011" : "G", "00101" : "O", "000010" : "W",
"000001" : "?", "010000" : "H", "111" : "P", "10010010" : "X",
"100101" : "A", "0111" : "I", "10011111" : "Q", "10010011" : "Y",
"10011010" : "B", "10011000" : "J", "1000" : "R", "10010000" : "Z"}
#print(dic)
while True:
try:
line = input()
except:
break
s = ""
for c in line:
s += dic[c]
ans = ""
tmp = ""
for c in s:
tmp += c
if tmp in decode:
ans += decode[tmp]
tmp = ''
# print(ans, s)
print(ans) | a.cc:1:2: error: invalid preprocessing directive #!
1 | #! python.exe
| ^
a.cc:14:2: error: invalid preprocessing directive #print
14 | #print(dic)
| ^~~~~
a.cc:29:19: error: empty character constant
29 | tmp = ''
| ^~
a.cc:30:10: error: invalid preprocessing directive #print
30 | # print(ans, s)
| ^~~~~
a.cc:2:1: error: 'dic' does not name a type
2 | dic = {}
| ^~~
a.cc:3:1: error: expected unqualified-id before 'for'
3 | for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
| ^~~
a.cc:15:1: error: expected unqualified-id before 'while'
15 | while True:
| ^~~~~
|
s210915347 | p00111 | C++ | #include<cstdlib>
#include<string>
using namespace std;
string tbl01[]={
"101","000000","000011","10010001","010001","000001","100101","10011010",
"0101","0001","110","01001","10011011","010000","0111","10011000",
"0110","00100","10011001","10011110","00101","111","10011111","1000",
"00110","00111","10011100","10011101","000010","10010010","10010011","10010000"
};
string tbl01_idx=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string str_AB=" .,-'?";
string from01(string s){
string r;
for(int i=0;i<s.size();){
for(int j=0;j<32;j++){
if(s.substr(i,tbl01[j].size())!=tbl01[j]){
if(j==31)return r;;
continue;
}
i+=tbl01[j].size();
r+=tbl01_idx[j];
break;
}
}
}
string fromAB(string &s){
string r; char t[9],u[9];
for(int i=0;i<s.size();i++){
int c=str_AB.find(s[i]);
if(c==str_AB.npos)c=s[i]-'A';
else c+=26;
itoa(c,t,2); sprintf(u,"%05s",t);
r+=u;
}
return r;
}
int main(){
string s;
while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
return 0;
} | a.cc: In function 'std::string fromAB(std::string&)':
a.cc:33:17: error: 'itoa' was not declared in this scope
33 | itoa(c,t,2); sprintf(u,"%05s",t);
| ^~~~
a.cc: In function 'int main()':
a.cc:40:23: error: 'cin' was not declared in this scope
40 | while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<string>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:40:30: error: 'cout' was not declared in this scope
40 | while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
| ^~~~
a.cc:40:30: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:55: error: 'endl' was not declared in this scope
40 | while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<string>
+++ |+#include <ostream>
3 | using namespace std;
a.cc: In function 'std::string from01(std::string)':
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
26 | }
| ^
|
s335258391 | p00111 | C++ | #include<cstdlib>
#include<cstring>
#include<string>
using namespace std;
void itoa0(int value, char *buff ,int tmp){
char *p;
int mod;
p = buff;
do{
mod = value % tmp + 48;
*p++ = (char)mod;
value /= tmp;
}while(value);
*p = '\0';
strrev(buff);
}
string tbl01[]={
"101","000000","000011","10010001","010001","000001","100101","10011010",
"0101","0001","110","01001","10011011","010000","0111","10011000",
"0110","00100","10011001","10011110","00101","111","10011111","1000",
"00110","00111","10011100","10011101","000010","10010010","10010011","10010000"
};
string tbl01_idx=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string str_AB=" .,-'?";
string from01(string s){
string r;
for(int i=0;i<s.size();){
for(int j=0;j<32;j++){
if(s.substr(i,tbl01[j].size())!=tbl01[j]){
if(j==31)return r;;
continue;
}
i+=tbl01[j].size();
r+=tbl01_idx[j];
break;
}
}
}
string fromAB(string &s){
string r; char t[9],u[9];
for(int i=0;i<s.size();i++){
int c=str_AB.find(s[i]);
if(c==str_AB.npos)c=s[i]-'A';
else c+=26;
itoa0(c,t,2); sprintf(u,"%05s",t);
r+=u;
}
return r;
}
int main(){
string s;
while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
return 0;
} | a.cc: In function 'void itoa0(int, char*, int)':
a.cc:16:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
16 | strrev(buff);
| ^~~~~~
| strsep
a.cc: In function 'int main()':
a.cc:55:23: error: 'cin' was not declared in this scope
55 | while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include<string>
+++ |+#include <iostream>
4 | using namespace std;
a.cc:55:30: error: 'cout' was not declared in this scope
55 | while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
| ^~~~
a.cc:55:30: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:55:55: error: 'endl' was not declared in this scope
55 | while(getline(cin,s))cout<<from01(fromAB(s))<<endl;
| ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
3 | #include<string>
+++ |+#include <ostream>
4 | using namespace std;
a.cc: In function 'std::string from01(std::string)':
a.cc:41:1: warning: control reaches end of non-void function [-Wreturn-type]
41 | }
| ^
|
s301385568 | p00111 | C++ | #include <string>
#include <bitset>
#include <map>
#include <cstring>
#include <windows.h>
using namespace std;
const char *t1=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char *v1[]={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001","110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
const char *t2="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
int main(){
string s,t,z;
int i,j;
map<string,char>m;
for(i=0;i<32;i++)m[string(v1[i])]=t1[i];
for(;z=t="",getline(cin,s);cout<<t<<endl){
for(i=0;i<s.size();i++)
if((j=strchr(t2,s[i])-t2)+t2)z+=bitset<5>(j).to_string();
for(i=0;;i+=j){
for(j=1;i+j<=z.size();j++)
if(m[z.substr(i,j)]){t+=m[z.substr(i,j)];break;}
if(i+j>z.size())break;
}
}
} | a.cc:5:10: fatal error: windows.h: No such file or directory
5 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s063919277 | p00111 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
using namespace std;
int main(){
map<string,char> table;
table["101"]=' ';
table["000000"]=(char)39;
table["000011"]=',';
table["10010001"]='-';
table["010001"]='.';
table["000001"]='?';
table["100101"]='A';
table["10011010"]='B';
table["0101"]='C';
table["0001"]='D';
table["110"]='E';
table["01001"]='F';
table["10011011"]='G';
table["010000"]='H';
table["0111"]='I';
table["10011000"]='J';
table["0110"]='K';
table["00100"]='L';
table["10011001"]='M';
table["10011110"]='N';
table["00101"]='O';
table["111"]='P';
table["10011111"]='Q';
table["1000"]='R';
table["00110"]='S';
table["00111"]='T';
table["10011100"]='U';
table["10011101"]='V';
table["000010"]='W';
table["10010010"]='X';
table["10010011"]='Y';
table["10010000"]='Z';
// \
map<char,string> table2;
for(int i = 0; i < 26; i++){
string ms;
for(int j = 0; j < 5; j++){
if((i>>j)&1){
ms+='1';
}
else
ms+='0';
}
reverse(ms.begin(),ms.end());
table2['A'+i]=ms;
}
table2[' ']="11010";
table2['.']="11011";
table2[',']="11100";
table2['-']="11101";
table2[(char)39]="11110";
table2['?']="11111";
string str;
while(getline(cin,str)){
// ¶ð»
string nstr;
for(int i = 0; i < str.size(); i++){
nstr+=(table2[str[i]]);
}
//¡
string dstr;
for(int i = 0; i < nstr.size(); i++){
for(map<string,char>::iterator it = table.begin(); it !=table.end(); it++){
string s=it->first;
if(i+s.size()-1<nstr.size()){
string ss=nstr.substr(i,s.size());
if(it->first==ss){
dstr+=it->second;
i+=s.size()-1;
break;
}
}
}
}
cout<<dstr<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:58:17: error: 'table2' was not declared in this scope; did you mean 'table'?
58 | table2['A'+i]=ms;
| ^~~~~~
| table
a.cc:60:9: error: 'table2' was not declared in this scope; did you mean 'table'?
60 | table2[' ']="11010";
| ^~~~~~
| table
|
s318419501 | p00111 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
using namespace std;
map<char,string> m;
map<string,char> n;
int main()
{
m.insert( map<char,string>::value_type('A',"00000") );
m.insert( map<char,string>::value_type('B',"00001") );
m.insert( map<char,string>::value_type('C',"00010") );
m.insert( map<char,string>::value_type('D',"00011") );
m.insert( map<char,string>::value_type('E',"00100") );
m.insert( map<char,string>::value_type('F',"00101") );
m.insert( map<char,string>::value_type('G',"00110") );
m.insert( map<char,string>::value_type('H',"00111") );
m.insert( map<char,string>::value_type('I',"01000") );
m.insert( map<char,string>::value_type('J',"01001") );
m.insert( map<char,string>::value_type('K',"01010") );
m.insert( map<char,string>::value_type('L',"01011") );
m.insert( map<char,string>::value_type('M',"01100") );
m.insert( map<char,string>::value_type('N',"01101") );
m.insert( map<char,string>::value_type('O',"01110") );
m.insert( map<char,string>::value_type('P',"01111") );
m.insert( map<char,string>::value_type('Q',"10000") );
m.insert( map<char,string>::value_type('R',"10001") );
m.insert( map<char,string>::value_type('S',"10010") );
m.insert( map<char,string>::value_type('T',"10011") );
m.insert( map<char,string>::value_type('U',"10100") );
m.insert( map<char,string>::value_type('V',"10101") );
m.insert( map<char,string>::value_type('W',"10110") );
m.insert( map<char,string>::value_type('X',"10111") );
m.insert( map<char,string>::value_type('Y',"11000") );
m.insert( map<char,string>::value_type('Z',"11001") );
m.insert( map<char,string>::value_type(' ',"11010") );
m.insert( map<char,string>::value_type('.',"11011") );
m.insert( map<char,string>::value_type(',',"11100") );
m.insert( map<char,string>::value_type('-',"11101") );
m.insert( map<char,string>::value_type('\'',"11110") );
m.insert( map<char,string>::value_type('?',"11111") );
n.insert( map<string,char>::value_type("101",' ') );
n.insert( map<string,char>::value_type("000000",'\'') );
n.insert( map<string,char>::value_type("000011",',') );
n.insert( map<string,char>::value_type("10010001",'-') );
n.insert( map<string,char>::value_type("010001",'.') );
n.insert( map<string,char>::value_type("000001",'?') );
n.insert( map<string,char>::value_type("100101",'A') );
n.insert( map<string,char>::value_type("10011010",'B') );
n.insert( map<string,char>::value_type("0101",'C') );
n.insert( map<string,char>::value_type("0001",'D') );
n.insert( map<string,char>::value_type("110",'E') );
n.insert( map<string,char>::value_type("01001",'F') );
n.insert( map<string,char>::value_type("10011011",'G') );
n.insert( map<string,char>::value_type("010000",'H') );
n.insert( map<string,char>::value_type("0111",'I') );
n.insert( map<string,char>::value_type("10011000",'J') );
n.insert( map<string,char>::value_type("0110",'K') );
n.insert( map<string,char>::value_type("00100",'L') );
n.insert( map<string,char>::value_type("10011001",'M') );
n.insert( map<string,char>::value_type("10011110",'N') );
n.insert( map<string,char>::value_type("00101",'O') );
n.insert( map<string,char>::value_type("111",'P') );
n.insert( map<string,char>::value_type("10011111",'Q') );
n.insert( map<string,char>::value_type("1000",'R') );
n.insert( map<string,char>::value_type("00110",'S') );
n.insert( map<string,char>::value_type("00111",'T') );
n.insert( map<string,char>::value_type("10011100",'U') );
n.insert( map<string,char>::value_type("10011101",'V') );
n.insert( map<string,char>::value_type("000010",'W') );
n.insert( map<string,char>::value_type("10010010",'X') );
n.insert( map<string,char>::value_type("10010011",'Y') );
n.insert( map<string,char>::value_type("10010000",'Z') );
string s;
char t[1200];
gets(t);
int i,l = strlen(t);
for(i=0;i<l;i++){
s += m[t[i]];
}
map<string,char>::iterator it;
for(;;){
it = n.begin();
while(it != n.end()){
if(s.find((*it).first) == 0) {
s = s.substr((*it).first.length());
cout << (*it).second;
break;
}
it++;
}
if(it == n.end()) break;
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:78:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
78 | gets(t);
| ^~~~
| getw
|
s518803531 | p00111 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
using namespace std;
map<char,string> m;
map<string,char> n;
int main()
{
m.insert( map<char,string>::value_type('A',"00000") );
m.insert( map<char,string>::value_type('B',"00001") );
m.insert( map<char,string>::value_type('C',"00010") );
m.insert( map<char,string>::value_type('D',"00011") );
m.insert( map<char,string>::value_type('E',"00100") );
m.insert( map<char,string>::value_type('F',"00101") );
m.insert( map<char,string>::value_type('G',"00110") );
m.insert( map<char,string>::value_type('H',"00111") );
m.insert( map<char,string>::value_type('I',"01000") );
m.insert( map<char,string>::value_type('J',"01001") );
m.insert( map<char,string>::value_type('K',"01010") );
m.insert( map<char,string>::value_type('L',"01011") );
m.insert( map<char,string>::value_type('M',"01100") );
m.insert( map<char,string>::value_type('N',"01101") );
m.insert( map<char,string>::value_type('O',"01110") );
m.insert( map<char,string>::value_type('P',"01111") );
m.insert( map<char,string>::value_type('Q',"10000") );
m.insert( map<char,string>::value_type('R',"10001") );
m.insert( map<char,string>::value_type('S',"10010") );
m.insert( map<char,string>::value_type('T',"10011") );
m.insert( map<char,string>::value_type('U',"10100") );
m.insert( map<char,string>::value_type('V',"10101") );
m.insert( map<char,string>::value_type('W',"10110") );
m.insert( map<char,string>::value_type('X',"10111") );
m.insert( map<char,string>::value_type('Y',"11000") );
m.insert( map<char,string>::value_type('Z',"11001") );
m.insert( map<char,string>::value_type(' ',"11010") );
m.insert( map<char,string>::value_type('.',"11011") );
m.insert( map<char,string>::value_type(',',"11100") );
m.insert( map<char,string>::value_type('-',"11101") );
m.insert( map<char,string>::value_type('\'',"11110") );
m.insert( map<char,string>::value_type('?',"11111") );
n.insert( map<string,char>::value_type("101",' ') );
n.insert( map<string,char>::value_type("000000",'\'') );
n.insert( map<string,char>::value_type("000011",',') );
n.insert( map<string,char>::value_type("10010001",'-') );
n.insert( map<string,char>::value_type("010001",'.') );
n.insert( map<string,char>::value_type("000001",'?') );
n.insert( map<string,char>::value_type("100101",'A') );
n.insert( map<string,char>::value_type("10011010",'B') );
n.insert( map<string,char>::value_type("0101",'C') );
n.insert( map<string,char>::value_type("0001",'D') );
n.insert( map<string,char>::value_type("110",'E') );
n.insert( map<string,char>::value_type("01001",'F') );
n.insert( map<string,char>::value_type("10011011",'G') );
n.insert( map<string,char>::value_type("010000",'H') );
n.insert( map<string,char>::value_type("0111",'I') );
n.insert( map<string,char>::value_type("10011000",'J') );
n.insert( map<string,char>::value_type("0110",'K') );
n.insert( map<string,char>::value_type("00100",'L') );
n.insert( map<string,char>::value_type("10011001",'M') );
n.insert( map<string,char>::value_type("10011110",'N') );
n.insert( map<string,char>::value_type("00101",'O') );
n.insert( map<string,char>::value_type("111",'P') );
n.insert( map<string,char>::value_type("10011111",'Q') );
n.insert( map<string,char>::value_type("1000",'R') );
n.insert( map<string,char>::value_type("00110",'S') );
n.insert( map<string,char>::value_type("00111",'T') );
n.insert( map<string,char>::value_type("10011100",'U') );
n.insert( map<string,char>::value_type("10011101",'V') );
n.insert( map<string,char>::value_type("000010",'W') );
n.insert( map<string,char>::value_type("10010010",'X') );
n.insert( map<string,char>::value_type("10010011",'Y') );
n.insert( map<string,char>::value_type("10010000",'Z') );
string s;
char t[1200];
gets(t);
int i,l = strlen(t);
for(i=0;i<l;i++){
s += m[t[i]];
}
map<string,char>::iterator it;
for(;;){
it = n.begin();
while(it != n.end()){
if(s.find((*it).first) == 0) {
s = s.substr((*it).first.length());
cout << (*it).second;
break;
}
it++;
}
if(it == n.end()) break;
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:78:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
78 | gets(t);
| ^~~~
| getw
|
s880014108 | p00111 | C++ | #include "iostream"
#include "map"
#include "string"
using namespace std;
map< char, string > toBits;
map< string, char > toChar;
#define INSB( k, s ) (toBits.insert( map<char, string>::value_type(k, s)))
#define INSC( k, s ) (toChar.insert( map<string, char>::value_type(k, s)))
string ToBits( char ch ) {
string res = "", tmp = "";
int num = ch - 'A';
for( int i = 0; i < 5; ++i ) {
tmp += (char)((num % 2) + '0' );
num /= 2;
}
for( int i = 4; i >= 0; --i ) {
res += tmp[ i ];
}
return res;
}
void Init() {
// toBitsの初期化
INSB( ' ', "11010" ); INSB( '.', "11011" ); INSB( ',', "11100" );
INSB( '-', "11101" ); INSB( '\'', "11110" ); INSB( '?', "11111" );
for( char c = 'A'; c <= 'Z'; ++c ) {
INSB( c, ToBits( c ) );
}
// toCharの初期化
INSC( "101", ' ' ); INSC( "000000", '\'' ); INSC( "000011", ',' );
INSC( "10010001", '-' ); INSC( "010001", '.' ); INSC( "000001", '?' );
INSC( "100101", 'A' ); INSC( "10011010", 'B' ); INSC( "0101", 'C' );
INSC( "0001", 'D' ); INSC( "110", 'E' ); INSC( "01001", 'F' );
INSC( "10011011", 'G' ); INSC( "010000", 'H' ); INSC( "0111", 'I' );
INSC( "10011000", 'J' ); INSC( "0110", 'K' ); INSC( "00100", 'L' );
INSC( "10011001", 'M' ); INSC( "10011110", 'N' ); INSC( "00101", 'O' );
INSC( "111", 'P' ); INSC( "10011111", 'O' ); INSC( "1000", 'R' );
INSC( "00110", 'S' ); INSC( "00111", 'T' ); INSC( "10011100", 'U' );
INSC( "10011101", 'V' ); INSC( "000010", 'W' ); INSC( "10010010", 'X' );
INSC( "10010011", 'Y' ); INSC( "10010000", 'Z' );
}
int _tmain(int argc, _TCHAR* argv[])
{
Init();
string in;
while( getline( cin, in ) ) {
string bits = "";
string tmp = "";
for( int i = 0; i < in.length(); ++i ) {
bits += toBits[ in[ i ] ];
}
for( int i = 0; i < bits.length(); ++i ) {
tmp += bits[ i ];
if( toChar.find( tmp ) != toChar.end() ) {
cout << toChar[ tmp ];
tmp = "";
}
}
cout << endl;
}
return 0;
} | a.cc:50:22: error: '_TCHAR' has not been declared
50 | int _tmain(int argc, _TCHAR* argv[])
| ^~~~~~
|
s058304147 | p00112 | Java | import java.util.Arrays;
import java.util.Scanner;
public class AMilkShop {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while(true){
int cnt = s.nextInt();
if(cnt==0)
return;
int[] times = new int[cnt];
for(int i=0 ; i<cnt ; i++) {
times[i] = s.nextInt();
}
Arrays.sort(times);
solve(times);
}
}
public static void solve(int[] times) {
int sumWaitTime = 0;
int waitT = 0;
for(int i=0 ; i<times.length-1 ; i++) {
waitT += times[i];
sumWaitTime += waitT;
}
System.out.println(sumWaitTime);
}
} | Main.java:5: error: class AMilkShop is public, should be declared in a file named AMilkShop.java
public class AMilkShop {
^
1 error
|
s632342170 | p00112 | Java | mport java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
if (n == 0)
break;
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
Collections.sort(list);
long[] a = new long[n];
long ans = 0;
long v = list.get(0);
a[0] = 0;
for (int i = 1; i < n; i++) {
a[i] = v;
v += list.get(i);
ans += a[i];
}
System.out.println(ans);
}
}
} | Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
Main.java:2: error: class, interface, enum, or record expected
import java.util.Collections;
^
Main.java:3: error: class, interface, enum, or record expected
import java.util.ArrayList;
^
3 errors
|
s920189899 | p00112 | C | #include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
int n,i,j,sum,sum2,x[10000],a;
while(1){
sum=0;
sum2=0;
scanf("%d",&n);
if(n==0)break;
for(i=0;i<n;i++){
scanf("%d",&x[i]);
}
sort(x,x+n);
sum=x[0];
for(i=1;i<n;i++){
sum2+=sum;
sum+=x[i];
}
printf("%d\n",sum2);
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s528068890 | p00112 | C | #include <algorithm>
using namespace std;
int a[10000];
int main(){
int n,i;
long long int z,r;
for(;scanf("%d",&n),n;printf("%lld\n",r)){
for(i=0;i<n;i++)scanf("%d",a+i);
sort(a,a+n);
for(z=r=i=0;i<n-1;i++)z+=a[i],r+=z;
}
} | main.c:1:10: fatal error: algorithm: No such file or directory
1 | #include <algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s487256927 | p00112 | C | #include <stdio.h>
#define MAX_PEAPLE ( 10000 )
int needTime[ MAX_PEAPLE ];
int tmp[ MAX_PEAPLE ];
void sort( int data[], int size );
__int64 getWaitTime( int data[], int size );
int main( void )
{
int n;
int i;
while( scanf( "%d", &n ) != EOF )
{
if( n == 0 )break;
for( i = 0; i < n; i++ )
{
scanf( "%d", &needTime[i] );
}
sort( needTime, n );
printf( "%llu\n", (unsigned)getWaitTime( needTime, n ) );
}
return (0);
}
__int64 getWaitTime( int data[], int size )
{
__int64 waitTime[ MAX_PEAPLE ];
int i;
__int64 totalWaitTime;
waitTime[0] = 0;
for( i = 1; i < size; i++ )
{
waitTime[i] = waitTime[i - 1] + data[i - 1];
}
for( i = 0, totalWaitTime = 0; i < size; i++ )
{
totalWaitTime += waitTime[i];
}
return (totalWaitTime);
}
void sort( int data[], int size )
{
int i;
int j;
int k;
int l;
if( size <= 1 )return;
i = 0;
j = size / 2;
k = 0;
sort( data, size / 2 );
sort( data + size / 2, size - (size / 2) );
while( i < size / 2 && j < size )
{
if( data[i] < data[j] )
{
tmp[k] = data[i];
k++;
i++;
}
else
{
tmp[k] = data[j];
k++;
j++;
}
}
while( i < size / 2 )
{
tmp[k] = data[i];
k++;
i++;
}
while( j < size )
{
tmp[k] = data[j];
k++;
j++;
}
for( l = 0; l < size; l++ )
{
data[l] = tmp[l];
}
} | main.c:10:1: error: unknown type name '__int64'; did you mean '__int64_t'?
10 | __int64 getWaitTime( int data[], int size );
| ^~~~~~~
| __int64_t
main.c:31:1: error: unknown type name '__int64'; did you mean '__int64_t'?
31 | __int64 getWaitTime( int data[], int size )
| ^~~~~~~
| __int64_t
main.c: In function 'getWaitTime':
main.c:33:9: error: unknown type name '__int64'; did you mean '__int64_t'?
33 | __int64 waitTime[ MAX_PEAPLE ];
| ^~~~~~~
| __int64_t
main.c:35:9: error: unknown type name '__int64'; did you mean '__int64_t'?
35 | __int64 totalWaitTime;
| ^~~~~~~
| __int64_t
|
s075297713 | p00112 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n;
while (scanf("%d", &n) != EOF){
int waitt[10000] = {0};
int i, j;
long long sum;
for (i = 0; i < n; i++) scanf("%d", waitt + i);
sort(waitt, waitt + n);
for (i = 0; i < n; i++){
for (j = 0; j <= i; j++){
sum += waitt[i][j];
}
}
printf("%ld\n", sum);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:48: error: invalid types 'int[int]' for array subscript
19 | sum += waitt[i][j];
| ^
|
s576501775 | p00112 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#define rep(X, Y) for( int (X) = 0; (X) < (Y); ++(X) )
int main(){
int i, cnt;
std::vector<int> vec;
while( std::cin >> cnt, cnt ){
while(cnt--)
std::cin >> i, vec.push_back(i);
std::sort( vec.begin(), vec.end() );
rep( i, 2 )
rep( l, vec.size() - 2 )
vec[l + 1] += vec[l];
std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
vec.clear();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:42: error: no matching function for call to 'min(std::vector<int>::size_type, int)'
21 | std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:21:42: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
21 | std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:21:42: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
21 | std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~
|
s142117023 | p00112 | C++ | int main(){
vector<unsigned long long> t(10001, 61);
int p;
int i;
vector<unsigned long long> total(10001, 0);
int matu = 0;
while (1){
for (i = 0; i <= 10000; i++){
t[i] = 61;
}
for (i = 0; i <= 10000; i++){
total[i] = 0;
}
matu = 0;
cin >> p;
if (p == 0){
break;
}
for (i = 0; i < p; i++){
cin >> t[i];
}
sort(t.begin(), t.begin() + i - 1);
for (i = 1; i < p; i++){
total[i] = t[i - 1] + total[i - 1];
}
for (i = 0; i < p; i++){
matu += total[i];
}
cout << matu << endl;
}
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'vector' was not declared in this scope
4 | vector<unsigned long long> t(10001, 61);
| ^~~~~~
a.cc:4:16: error: expected primary-expression before 'unsigned'
4 | vector<unsigned long long> t(10001, 61);
| ^~~~~~~~
a.cc:7:16: error: expected primary-expression before 'unsigned'
7 | vector<unsigned long long> total(10001, 0);
| ^~~~~~~~
a.cc:14:25: error: 't' was not declared in this scope
14 | t[i] = 61;
| ^
a.cc:17:25: error: 'total' was not declared in this scope
17 | total[i] = 0;
| ^~~~~
a.cc:21:17: error: 'cin' was not declared in this scope
21 | cin >> p;
| ^~~
a.cc:27:32: error: 't' was not declared in this scope
27 | cin >> t[i];
| ^
a.cc:29:22: error: 't' was not declared in this scope
29 | sort(t.begin(), t.begin() + i - 1);
| ^
a.cc:29:17: error: 'sort' was not declared in this scope; did you mean 'short'?
29 | sort(t.begin(), t.begin() + i - 1);
| ^~~~
| short
a.cc:33:25: error: 'total' was not declared in this scope
33 | total[i] = t[i - 1] + total[i - 1];
| ^~~~~
a.cc:37:33: error: 'total' was not declared in this scope
37 | matu += total[i];
| ^~~~~
a.cc:40:17: error: 'cout' was not declared in this scope
40 | cout << matu << endl;
| ^~~~
a.cc:40:33: error: 'endl' was not declared in this scope
40 | cout << matu << endl;
| ^~~~
|
s377022080 | p00112 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int func(int dt[],int num){
unsigned long long int c=num;
unsigned long long int time=0;
for(int i=0;i<c-1;i++){
time+=(c-(i+1))*dt[i];
}
return time;
}
int main(){
int n;
while(1){
cin>>n;
if(n==0)break;
unsigned long long int cost[n];
unsigned long long int ans=0;
for(int i=0;i<n;i++){
cin>>cost[i];
}
sort(cost,cost+n);
ans=func(cost,n);
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:26: error: cannot convert 'long long unsigned int*' to 'int*'
25 | ans=func(cost,n);
| ^~~~
| |
| long long unsigned int*
a.cc:5:14: note: initializing argument 1 of 'int func(int*, int)'
5 | int func(int dt[],int num){
| ~~~~^~~~
|
s869570479 | p00112 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int n,a[10000];
while(true){
scanf("%d",&n);
if(n==0)return 0;
for(int i=0;i<n;i++)scanf("%d",&a[i]);
long long int ans=0;
sort(a,a+n);
for(int i=0;i<n;i++)ans+=(ll)a[i]*(n-1-i);
printf("%lld\n",ans);
}
} | a.cc: In function 'int main()':
a.cc:14:27: error: 'll' was not declared in this scope
14 | for(int i=0;i<n;i++)ans+=(ll)a[i]*(n-1-i);
| ^~
|
s890132476 | p00112 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<climits>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<set>
#include<stack>
#include<functional>
#include<queue>
using namespace std;
#define int long long long
signed main(){
int N,T[10000];
while(cin>>N,N){
for(int i=0;i<N;i++) cin>>T[i];
sort(T,T+N);
int ans=0,sum=0;
for(int i=0;i<N;i++){
ans += sum; sum += T[i];
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:23: error: 'long long long' is too long for GCC
15 | #define int long long long
| ^~~~
a.cc:18:5: note: in expansion of macro 'int'
18 | int N,T[10000];
| ^~~
a.cc:15:23: error: 'long long long' is too long for GCC
15 | #define int long long long
| ^~~~
a.cc:20:13: note: in expansion of macro 'int'
20 | for(int i=0;i<N;i++) cin>>T[i];
| ^~~
a.cc:15:23: error: 'long long long' is too long for GCC
15 | #define int long long long
| ^~~~
a.cc:22:9: note: in expansion of macro 'int'
22 | int ans=0,sum=0;
| ^~~
a.cc:15:23: error: 'long long long' is too long for GCC
15 | #define int long long long
| ^~~~
a.cc:23:13: note: in expansion of macro 'int'
23 | for(int i=0;i<N;i++){
| ^~~
|
s280557786 | p00112 | C++ | #include<stdio.h>
int main(){
int [10001]={};
int a=0.s=0;
int n;
while(1){
scanf("%d",&n);
if(n==0)break;
for(int i=0;i<n;i++)
scanf("%d",&n[i]);
for(int i=0;i<n;i++)
for(int j=n-1;j>i;j--)
if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
if(n==1)s=0;
else{
for(int i=1;i<n;i++)
{
a=a+n[i-1];s+=a;
}
}
printf("%d\n",s);
a=0;s=0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:4:6: error: expected identifier before numeric constant
4 | int [10001]={};
| ^~~~~
a.cc:4:6: error: expected ']' before numeric constant
4 | int [10001]={};
| ^~~~~
| ]
a.cc:4:5: error: structured binding declaration cannot have type 'int'
4 | int [10001]={};
| ^
a.cc:4:5: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:4:5: error: empty structured binding declaration
a.cc:5:7: error: unable to find numeric literal operator 'operator""s'
5 | int a=0.s=0;
| ^~~
a.cc:12:14: error: invalid types 'int[int]' for array subscript
12 | scanf("%d",&n[i]);
| ^
a.cc:16:5: error: invalid types 'int[int]' for array subscript
16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
| ^
a.cc:16:10: error: invalid types 'int[int]' for array subscript
16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
| ^
a.cc:16:24: error: invalid types 'int[int]' for array subscript
16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
| ^
a.cc:16:29: error: invalid types 'int[int]' for array subscript
16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
| ^
a.cc:16:34: error: invalid types 'int[int]' for array subscript
16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
| ^
a.cc:16:41: error: invalid types 'int[int]' for array subscript
16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
| ^
a.cc:18:9: error: 's' was not declared in this scope
18 | if(n==1)s=0;
| ^
a.cc:22:6: error: invalid types 'int[int]' for array subscript
22 | a=a+n[i-1];s+=a;
| ^
a.cc:22:12: error: 's' was not declared in this scope
22 | a=a+n[i-1];s+=a;
| ^
a.cc:26:15: error: 's' was not declared in this scope
26 | printf("%d\n",s);
| ^
|
s354730880 | p00112 | C++ | #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void)
{
int n;
while(cin >> n, n){
int a = 0;
long longint ans = 0;
int time[10000];
for(int i = 0; i < n; i++){
cin >> time[i];
}
sort(time, time + n);
int temp = n;
for(int j = 0; j < n-1; j++){
a = 0;
for(int ii = 0; ii < temp-1; ii++){
a += time[ii];
}
ans += a;
temp--;
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:30: error: expected initializer before 'ans'
13 | long longint ans = 0;
| ^~~
a.cc:26:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
26 | ans += a;
| ^~~
| abs
a.cc:29:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
29 | cout << ans << endl;
| ^~~
| abs
|
s006312966 | p00112 | C++ | #include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int x[10000000]; int n, sum2; long long sum;
int main() {
while (true) {
memset(x, 0, sizeof(x));
cin >> n;
if (!n) { break; }
for (int i = 0; i < n; i++) {
cin >> x[i];
}
sort(x, x + n);
sum2 = 0;
sum = 0;
for (int i = 0; i < n; i++) {
sum += sum2;
sum2 += a[i];
}
cout << sum << endl;
}
} | a.cc: In function 'int main()':
a.cc:19:33: error: 'a' was not declared in this scope
19 | sum2 += a[i];
| ^
|
s774307325 | p00112 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n,i,sum,wait;
vector<int> w;
while(cin>>n,n){
w.assign(n,0);
for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
sort(w.begin(),w.end());
for(sum=wait=0,i=0;i<n-1;wait+=w[i],sum+=wait,++i);
co
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:39: error: 'ut' was not declared in this scope
11 | for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
| ^~
a.cc:11:52: error: expected ')' before ';' token
11 | for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
| ~ ^
| )
a.cc:11:56: error: expected ';' before ')' token
11 | for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
| ^
| ;
a.cc:14:17: error: 'co' was not declared in this scope
14 | co
| ^~
|
s736118871 | p00112 | C++ | #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
using namespace std;
int main() {
int n;;
while (cin >> n, n) {
vector<long long> a(n);
for (long long &x : a)cin >> x;
sort(a.begin(), a.end());
long long sum = 0;
for (long long &x : a)sum1+=sum,sum+=x;
//sum = 0;
//for (long long &x : a)x = (sum += x);
cout << sum1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:39: error: 'sum1' was not declared in this scope; did you mean 'sum'?
18 | for (long long &x : a)sum1+=sum,sum+=x;
| ^~~~
| sum
a.cc:21:25: error: 'sum1' was not declared in this scope; did you mean 'sum'?
21 | cout << sum1 << endl;
| ^~~~
| sum
|
s884557006 | p00112 | C++ | #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
using namespace std;
int main() {
int n;;
while (cin >> n, n) {
vector<long long> a(n);
for (long long &x : a)cin >> x;
sort(a.begin(), a.end());
long long sum = 0,sum1=0;
//for (long long &x : a)sum1+=sum,sum+=x;
for (long long &x : a)x = (sum += x);
sum = 0;
for (long long &x : a)x = (sum += x);
cout << n==1?0:a[n - 2] << endl;
//cout << sum1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:26: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
22 | cout << n==1?0:a[n - 2] << endl;
| ~~~~~~~~~^~~
| | |
| | int
| std::basic_ostream<char>
a.cc:22:26: note: candidate: 'operator==(int, int)' (built-in)
22 | cout << n==1?0:a[n - 2] << endl;
| ~~~~~~~~~^~~
a.cc:22:26: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/vector:62,
from a.cc:1:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/vector:63:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_Tp1>&, 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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_Tp1>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2050 | operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: template argument deduction/substitution failed:
a.cc:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::vector<_Tp, _Alloc>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
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:2:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/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/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28 |
s102494838 | p00112 | C++ | #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
using namespace std;
int main() {
int n;;
while (cin >> n, n) {
vector<long long> a(n);
for (long long &x : a)cin >> x;
sort(a.begin(), a.end());
long long sum = 0,sum1=0;
//for (long long &x : a)sum1+=sum,sum+=x;
for (long long &x : a)x = (sum += x);
sum = 0;
for (long long &x : a)x = (sum += x);
cout << n==1?0:a[n - 2] << endl;
//cout << sum1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:26: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
22 | cout << n==1?0:a[n - 2] << endl;
| ~~~~~~~~~^~~
| | |
| | int
| std::basic_ostream<char>
a.cc:22:26: note: candidate: 'operator==(int, int)' (built-in)
22 | cout << n==1?0:a[n - 2] << endl;
| ~~~~~~~~~^~~
a.cc:22:26: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/vector:62,
from a.cc:1:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/vector:63:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_Tp1>&, 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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_Tp1>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2050 | operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: template argument deduction/substitution failed:
a.cc:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::vector<_Tp, _Alloc>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
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:2:
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/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/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
22 | cout << n==1?0:a[n - 2] << endl;
| ^
/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:22:28 |
s155870781 | p00112 | C++ | #include <iostream>
using namespace std;
int main() {
int n, t[10000];
while(1) {
cin >> n;
if (n == 0) break;
for (int i = 0; i < n; i++) cin >> t[i];
sort(t, t+n);
int ans = 0;
for (int i = 0; i < n; i++) ans += ans + t[i] - t[0];
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(t, t+n);
| ^~~~
| short
|
s403168258 | p00112 | C++ | #include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
int n;
long long unsigned int sum;
while (scanf("%d", &n), n){
vector<int> vec;
for (int i=0; i<n; i++){
int x;
scanf("%d", &x);
vec.push_back(x);
}
sort(vec.begin(), vec.end());
sum = 0;
for (int i=0; i<n-1; i++){
sum += vec[i]*(n-1-i);
}
cout << sum << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:5: error: 'cout' was not declared in this scope
23 | cout << sum << endl;
| ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <algorithm>
+++ |+#include <iostream>
4 |
a.cc:23:20: error: 'endl' was not declared in this scope
23 | cout << sum << endl;
| ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
3 | #include <algorithm>
+++ |+#include <ostream>
4 |
|
s108038943 | p00112 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<int> list;
int main(){
int n;
while(cin>>n,n!=0){
list.clear();
for(int i=0;i<n;i++){
int tmp;
cin>>tmp;
list.push_back(tmp);
}
sort(list.begin(),list.end());
long long ans=0;
long long pre=0;
for(int i=0;i<n;i++){
ans+=pre;
pre=pre+list[i];
}
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:9:5: error: reference to 'list' is ambiguous
9 | list.clear();
| ^~~~
In file included from /usr/include/c++/14/list:65,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:4:13: note: 'std::vector<int> list'
4 | vector<int> list;
| ^~~~
a.cc:13:7: error: reference to 'list' is ambiguous
13 | list.push_back(tmp);
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:4:13: note: 'std::vector<int> list'
4 | vector<int> list;
| ^~~~
a.cc:15:10: error: reference to 'list' is ambiguous
15 | sort(list.begin(),list.end());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:4:13: note: 'std::vector<int> list'
4 | vector<int> list;
| ^~~~
a.cc:15:23: error: reference to 'list' is ambiguous
15 | sort(list.begin(),list.end());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:4:13: note: 'std::vector<int> list'
4 | vector<int> list;
| ^~~~
a.cc:20:15: error: reference to 'list' is ambiguous
20 | pre=pre+list[i];
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:4:13: note: 'std::vector<int> list'
4 | vector<int> list;
| ^~~~
|
s292475947 | p00112 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<int> list;
int main(){
int n;
while(cin>>n,n!=0){
list.clear();
for(int i=0;i<n;i++){
int tmp;
cin>>tmp;
list.push_back(tmp);
}
sort(list.begin(),list.end());
long long ans=0;
long long pre=0;
for(int i=0;i<n;i++){
ans+=pre;
pre=pre+list[i];
}
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:8:5: error: reference to 'list' is ambiguous
8 | list.clear();
| ^~~~
In file included from /usr/include/c++/14/list:65,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:3:13: note: 'std::vector<int> list'
3 | vector<int> list;
| ^~~~
a.cc:12:7: error: reference to 'list' is ambiguous
12 | list.push_back(tmp);
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:3:13: note: 'std::vector<int> list'
3 | vector<int> list;
| ^~~~
a.cc:14:10: error: reference to 'list' is ambiguous
14 | sort(list.begin(),list.end());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:3:13: note: 'std::vector<int> list'
3 | vector<int> list;
| ^~~~
a.cc:14:23: error: reference to 'list' is ambiguous
14 | sort(list.begin(),list.end());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:3:13: note: 'std::vector<int> list'
3 | vector<int> list;
| ^~~~
a.cc:19:15: error: reference to 'list' is ambiguous
19 | pre=pre+list[i];
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:3:13: note: 'std::vector<int> list'
3 | vector<int> list;
| ^~~~
|
s169065888 | p00112 | C++ | #include "bits/stdc++.h"
#include<iostream>
#include<cstdio>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> list;
int main(){
int n;
while(cin>>n,n!=0){
list.clear();
for(int i=0;i<n;i++){
int tmp;
cin>>tmp;
list.push_back(tmp);
}
sort(list.begin(),list.end());
long long ans=0;
long long pre=0;
for(int i=0;i<n;i++){
ans+=pre;
pre=pre+list[i];
}
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:14:5: error: reference to 'list' is ambiguous
14 | list.clear();
| ^~~~
In file included from /usr/include/c++/14/list:65,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:13: note: 'std::vector<int> list'
9 | vector<int> list;
| ^~~~
a.cc:18:7: error: reference to 'list' is ambiguous
18 | list.push_back(tmp);
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:13: note: 'std::vector<int> list'
9 | vector<int> list;
| ^~~~
a.cc:20:10: error: reference to 'list' is ambiguous
20 | sort(list.begin(),list.end());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:13: note: 'std::vector<int> list'
9 | vector<int> list;
| ^~~~
a.cc:20:23: error: reference to 'list' is ambiguous
20 | sort(list.begin(),list.end());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:13: note: 'std::vector<int> list'
9 | vector<int> list;
| ^~~~
a.cc:25:15: error: reference to 'list' is ambiguous
25 | pre=pre+list[i];
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:13: note: 'std::vector<int> list'
9 | vector<int> list;
| ^~~~
|
s900139709 | p00112 | C++ | import java.util.Arrays;
import java.util.Scanner;
public class Main {
private Scanner sc;
public static void main(String[] args) {
new Main();
}
public Main() {
sc = new Scanner(System.in);
int lines = Integer.parseInt(sc.nextLine());
while (lines != 0) {
int[] wait = new int[lines];
for (int i = 0; i < lines; i++) {
wait[i] = Integer.parseInt(sc.nextLine());
}
Arrays.sort(wait);
long sum = 0;
for (int i = 0; i < lines; i++) {
sum = sum + (lines - i - 1) * wait[i];
}
System.out.println(sum);
lines = Integer.parseInt(sc.nextLine());
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Arrays;
| ^~~~~~
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 java.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main {
| ^~~~~~
|
s886825028 | p00112 | C++ | #include <algorithm>
using namespace std;
const int MAX = 10000;
int main()
{
int N;
while (cin >> N, N)
{
int a[MAX];
for (int i=0; i<N; i++)
cin >> a[i];
sort(&a[0], &a[N]);
int sum = 0;
for (int i=1; i<N; i++)
sum += (N-i)*a[i-1];
cout << sum << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:16: error: 'cin' was not declared in this scope
8 | while (cin >> N, N)
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <algorithm>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:20:17: error: 'cout' was not declared in this scope
20 | cout << sum << endl;
| ^~~~
a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:32: error: 'endl' was not declared in this scope
20 | cout << sum << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <algorithm>
+++ |+#include <ostream>
2 | using namespace std;
|
s537259124 | p00112 | C++ | #include <iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main(int argc, char **argv)
{
int n, *array, tmp;
while(1){
cin >> n;
if(n == 0){
break;
}
array = (int *)calloc(n, sizeof(int));
for(int i = 0; i < n; i++)[
cin >> array[i];
}
sort(array, array+n);
tmp = array[0];
for(int i = 1; i < (n-1); i++){
array[i] += array[i-1];
tmp += array[i];
}
cout << tmp << endl;
free(array);
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:19:25: warning: capture of variable 'std::cin' with non-automatic storage duration
19 | cin >> array[i];
| ^~~
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::istream std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:19:28: error: expected ',' before '>>' token
19 | cin >> array[i];
| ^~~
| ,
a.cc:19:29: error: expected identifier before '>>' token
19 | cin >> array[i];
| ^~
a.cc:19:40: error: expected ']' before ';' token
19 | cin >> array[i];
| ^
| ]
a.cc: In lambda function:
a.cc:19:40: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:33:9: error: expected unqualified-id before 'return'
33 | return 0;
| ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
34 | }
| ^
|
s807445703 | p00112 | C++ | import java.io.*;
import java.util.List;
import java.util.ArrayList;
public class Main{
public static void main(String args[]){
new Main();
}
public Main(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
List<Integer> nums = new ArrayList<Integer>();
try{
String line;
while((line = br.readLine()) != null){
int num = Integer.parseInt(line);
if(num == 0){
break;
}
nums.add(num);
}
}catch(IOException err){
err.printStackTrace();
}
int n = nums.get(0);
nums.remove(0);
int[] dst = new int[nums.size()];
for(int i=0; i<nums.size(); i++){
dst[i] = nums.get(i);
}
sort(dst);
int sum = 0;
for(int i=0; i<n; i++){
sum += dst[i] * (n-i-1);
}
System.out.println(sum);
}
public void sort(int[] a){
for(int i=0; i<a.length-1; i++){
for(int j=a.length-1; j>i; j--){
if(a[j] < a[j-1]){
int t = a[j];
a[j] = a[j-1];
a[j-1] = t;
}
}
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
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 java.util.List;
| ^~~~~~
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.util.ArrayList;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
6 | public class Main{
| ^~~~~~
|
s196135362 | p00112 | C++ | import java.io.*;
import java.util.List;
import java.util.ArrayList;
public class Main{
public static void main(String args[]){
new Main();
}
public Main(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
List<int[]> nums = new ArrayList<int[]>();
List<Integer> ans = new ArrayList<Integer>();
try{
String line;
while((line = br.readLine()) != null){
int data_size = Integer.parseInt(line);
if(data_size == 0) break;
int[] num_set = new int[data_size];
for(int i=0; i<data_size; i++){
num_set[i] = Integer.parseInt(br.readLine());
}
nums.add(num_set);
}
}catch(IOException err){
err.printStackTrace();
}
for(int i=0; i<nums.size(); i++){
int[] dst = nums.get(i);
sort(dst);
int sum = 0;
for(int j=0; j<dst.length; j++){
sum += dst[j] * (dst.length-j-1);
}
ans.add(sum);
}
for(int i=0; i<ans.size(); i++){
System.out.println(ans.get(i));
}
}
public void sort(int[] a){
for(int i=0; i<a.length-1; i++){
for(int j=a.length-1; j>i; j--){
if(a[j] < a[j-1]){
int t = a[j];
a[j] = a[j-1];
a[j-1] = t;
}
}
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
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 java.util.List;
| ^~~~~~
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.util.ArrayList;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
6 | public class Main{
| ^~~~~~
|
s212638994 | p00112 | C++ | /*
AizuOnline A0121
A Milk Shop
*/
#include <stdio.h>
#include <stdlib.h>
int int_lessp(int *a,int *b)
{
return(*a - *b);
}
main()
{
int i,c,n[10001];
long int sum;
while(EOF!=scanf("%d",&c) && c > 0)
{ sum = 0;
for(i=0;i<c;i++)
scanf("%d",n+i);
qsort(n,c,sizeof(int),int_lessp);
for(i=0;i<c;i++)
sum += (c-i-1)*n[i];
printf("%lld\n",sum);
}
return(0);
} | a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
13 | main()
| ^~~~
a.cc: In function 'int main()':
a.cc:23:29: error: invalid conversion from 'int (*)(int*, int*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
23 | qsort(n,c,sizeof(int),int_lessp);
| ^~~~~~~~~
| |
| int (*)(int*, int*)
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/stdlib.h:36,
from a.cc:6:
/usr/include/stdlib.h:971:34: note: initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
|
s549260574 | p00112 | C++ | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);} | a.cc:1:3: warning: multi-character character constant [-Wmultichar]
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^~~~
a.cc:1:1: error: 't' does not name a type
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^
a.cc:1:9: error: 'n' does not name a type
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^
a.cc:1:13: error: ISO C++ forbids declaration of 'c' with no type [-fpermissive]
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^
a.cc: In function 'int c(int*)':
a.cc:1:22: error: 'z' was not declared in this scope
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^
a.cc:1:34: warning: no return statement in function returning non-void [-Wreturn-type]
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^
a.cc: At global scope:
a.cc:1:39: error: expected constructor, destructor, or type conversion before '(' token
1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
| ^
|
s870842128 | p00112 | C++ | #include <iostream>
#include <stdlib.h>
using namespace std;
int int_cmp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int main(){
int i,j,n,t[10010];
while(cin>>n,n){
__int64 s=0;
for(i=0;i<n;i++)cin>>t[i];
qsort(t,n,sizeof(int),int_cmp);
for(i=0;i<n;i++)s+=t[i]*(n-i-1);
cout<<s<<endl;
}
} | a.cc: In function 'int main()':
a.cc:8:1: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
8 | __int64 s=0;
| ^~~~~~~
| __int64_t
a.cc:11:17: error: 's' was not declared in this scope
11 | for(i=0;i<n;i++)s+=t[i]*(n-i-1);
| ^
a.cc:12:7: error: 's' was not declared in this scope
12 | cout<<s<<endl;
| ^
|
s584958571 | p00112 | C++ | #include <iostream>
using namespace std;
int main() {
for (;;) {
int n, p[10000];
cin >> n;
if (!n) return 0;
for (int i = 0; i < n; i++)
cin >> p[i];
sort(p, p+n);
int s = 0;
for (int i = 1; i < n; i++)
s += p[i-1]*(n-i);
cout << s << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(p, p+n);
| ^~~~
| short
|
s412894476 | p00112 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n;
while( cin >> n && n ){
vector< int > line;
for( int i = 0; i < n; ++i ){
int d;
cin >> d;
line.push_back( d );
}
sort( line.begin(), line.end() );
long long output = 0;
for( int i = 0; i < n - 1; ++i ){
output += ( line[ i ] * ( n - i - 1 ) );
if( output < 0 ) __debugbreak();
}
cout << output << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:42: error: '__debugbreak' was not declared in this scope
21 | if( output < 0 ) __debugbreak();
| ^~~~~~~~~~~~
|
s774824743 | p00112 | C++ | /*****include*****/
#include <iostream>
#include <fstream>
/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/
#define INF 30000
/*****名前空間*****/
using namespace std;
/*****グローバル変数置き場*****/
int *time;
int mini;
bool *visited;
int num;
/*****その他関数置き場*****/
void dfs(int node,int wait,int total){
int i;
visited[node] = true;
/*for(int i=0;i<num;i++)
cout << visited[i] << " ";
cout << endl;*/
total += wait;
wait += time[node];
//cout << wait <<" " << total << endl;
for(i=0;i<num;i++)
if(!visited[i]) break;
if(i==num){
if(mini > total){
mini = total;
//cout << "*" << mini << endl;
//cout << mini << endl;
}
//cout << "b" << endl;
return;
}
for(i=0;i<num;i++){
if(!(i==node || visited[i])){
//cout << "c" << endl;
dfs(i,wait,total);
//cout << "d" << endl;
visited[i] = false;
}
}
}
/*****main関数*****/
int main(){
/*****ファイルオープン*****/
#ifdef DEBUG
ofstream fout("output.txt");
ifstream fin("input.txt");
if(!fout || !fin){
cout << "Can't open the file.\n";
return 0;
}
#endif
/*****変数置き場*****/
/*****処理部*****/
while(1){
mini = INF;
cin >> num;
if(num == 0) break;
time = new int [num];
visited = new bool [num];
for(int i=0;i<num;i++){
time[i] = 0;
visited[i] = false;
}
for(int i=0;i<num;i++)
cin >> time[i];
for(int i=0;i<num;i++){
dfs(i,0,0);
//cout << "d" << endl;
visited[i] = false;
}
cout << mini << endl;
}
/*****処理終了後*****/
#ifdef DEBUG
fout.close();
fin.close();
#endif
return 0;
} | a.cc:13:6: error: 'int* time' redeclared as different kind of entity
13 | int *time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:26:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
26 | wait += time[node];
| ^
a.cc:26:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
26 | wait += time[node];
| ~~~~~^~~~~~~~~~~~~
a.cc:26:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
26 | wait += time[node];
| ~~~~~^~~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc: In function 'int main()':
a.cc:65:22: error: assignment of function 'time_t time(time_t*)'
65 | time = new int [num];
| ~~~~~^~~~~~~~~~~~~~~
a.cc:68:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
68 | time[i] = 0;
| ^
a.cc:68:33: error: assignment of read-only location '*(time + ((sizetype)i))'
68 | time[i] = 0;
| ~~~~~~~~^~~
a.cc:72:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
72 | cin >> time[i];
| ^
a.cc:72:29: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
72 | cin >> time[i];
| ~~~ ^~ ~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
72 | cin >> time[i];
| ~~~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:72:38: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
72 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:72:38: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.c |
s456098475 | p00112 | C++ | #include <cstdio>
#include <queue>
using namespace std;
int num[10005];
int main(){
int n;
while(scanf("%d",&n) && n){
for(int i=0;i<n;i++){
int r;
scanf("%d",&num[i]);
}
sort(num,num+n);
int ans=0;
for(int i=0;i<n;i++){
ans+=num[i]*(n-1-i);
}
printf("%d\n",ans);
}
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(num,num+n);
| ^~~~
| short
|
s782496040 | p00112 | C++ | #include<stdio.h>
int main()
{
while(scanf("%d",&n)!=EOF)
{
int x[10000],fake,sum=0;
for(int t=0;;t++)
{
scanf("%d",&x[t]);
if(x[t]==0)
{
break;
}
if(t!=0||t<n)
{
for(int r=0;r<=t;r++)
{
if(x[t]<x[r])
{
fake=x[t];
x[t]=x[r];
x[r]=fake;
}
}
}
}
for(int t=0;t<n;t++)
{
sum+=x[t]*(n-t-1);
}
printf("%d\n",sum);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:27: error: 'n' was not declared in this scope
6 | while(scanf("%d",&n)!=EOF)
| ^
|
s460342641 | p00112 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){int n,i,t;for(long int ans;cin>>n,n;cout<<ans<<endl){vector<int> m;for(ans=i=0;i++<n;m.push_back(t))cin>>t;sort(m.begin(),m.end());for(i=1;i<n;i++)ans+=m[i-1]*(n-i);}} | a.cc: In function 'int main()':
a.cc:4:119: error: 'sort' was not declared in this scope; did you mean 'short'?
4 | int main(){int n,i,t;for(long int ans;cin>>n,n;cout<<ans<<endl){vector<int> m;for(ans=i=0;i++<n;m.push_back(t))cin>>t;sort(m.begin(),m.end());for(i=1;i<n;i++)ans+=m[i-1]*(n-i);}}
| ^~~~
| short
|
s945140206 | p00112 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int TIME[11111],sum[11111],ret;
int n;
while(1){
cin >> n;
if(!n)break;
memset( TIME , 0 , sizeof(TIME) );
memset( sum , 0 , sizeof(sum) );
for(int i=0;i<n;i++){
cin >> TIME[i];
}
sort( TIME , TIME + n );
ret = 0;
sum[0] = 0;
for(int i=1;i<n;i++){
sum[i] = TIME[i-1] + sum[i-1];
ret += sum[i];
}
cout << ret << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:5: error: 'memset' was not declared in this scope
11 | memset( TIME , 0 , sizeof(TIME) );
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 | using namespace std;
|
s546203331 | p00112 | C++ | )
{
ans += (n-(i+1))*T[i];
}
cout << ans << endl;
}
} | a.cc:1:1: error: expected unqualified-id before ')' token
1 | )
| ^
a.cc:6:17: error: 'cout' does not name a type
6 | cout << ans << endl;
| ^~~~
a.cc:7:9: error: expected declaration before '}' token
7 | }
| ^
a.cc:8:1: error: expected declaration before '}' token
8 | }
| ^
|
s993250908 | p00112 | C++ | #include <iostream>
int a[10010];
int main()
{
while(1)
{
memset(a,0,sizeof(0));
int n;
cin >> n;
if(n==0)break;
for(int i=0;i<n;i++)cin >> a[i];
ll ans=0ll;
sort(a,a+n);
for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:21: error: 'memset' was not declared in this scope
7 | memset(a,0,sizeof(0));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | int a[10010];
a.cc:9:21: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
9 | cin >> n;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:12:21: error: 'll' was not declared in this scope
12 | ll ans=0ll;
| ^~
a.cc:13:21: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(a,a+n);
| ^~~~
| short
a.cc:14:43: error: 'ans' was not declared in this scope; did you mean 'abs'?
14 | for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
| ^~~
| abs
a.cc:15:21: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
15 | cout << ans << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:15:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
15 | cout << ans << endl;
| ^~~
| abs
a.cc:15:36: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
15 | cout << ans << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s704383968 | p00112 | C++ | #include <iostream>
#include <cstring>
using namespace std;
int a[10010];
int main()
{
while(1)
{
memset(a,0,sizeof(0));
int n;
cin >> n;
if(n==0)break;
for(int i=0;i<n;i++)cin >> a[i];
ll ans=0ll;
sort(a,a+n);
for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:21: error: 'll' was not declared in this scope
14 | ll ans=0ll;
| ^~
a.cc:15:21: error: 'sort' was not declared in this scope; did you mean 'short'?
15 | sort(a,a+n);
| ^~~~
| short
a.cc:16:43: error: 'ans' was not declared in this scope; did you mean 'abs'?
16 | for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
| ^~~
| abs
a.cc:17:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | cout << ans << endl;
| ^~~
| abs
|
s067706405 | p00113 | Java | import java.util.ArrayList;
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int p = sc.nextInt();
int q = sc.nextInt();
new B(p, q);
}
}
int p, q;
int aaaa = 2;
String shousuu = "";
ArrayList<Integer> amari = new ArrayList<Integer>();
B(int p, int q) {
this.p = p;
this.q = q;
solve();
}
private void solve() {
System.out.print("0.");
solve2((p % q) * 10);
}
private void solve2(int warareru) {
aaaa++;
if (warareru == 0) {
System.out.println();
} else if (!amari.contains(warareru)) {
amari.add(warareru);
System.out.print(warareru / q);
solve2((warareru - q * (warareru / q)) * 10);
} else {
System.out.println();
int basho = amari.indexOf(warareru);
for (int i = 0; i < aaaa - 1; i++) {
if (i < basho + 2)
System.out.print(" ");
else
System.out.print("^");
}
System.out.println();
}
}
} | Main.java:4: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s966582177 | p00113 | C | #include<stdio.h>
#include<list>
#include<algorithm>
class s{
public:
int num;
int i;
s(int n,int j){
num=n;
i=j;
}
};
int main(){
using namespace std;
int p,q,pn,i,pr,j;
char ans[1000];
list<s> memo;
list<s>::iterator it;
pn=1;
while(scanf("%d %d",&p,&q)!=EOF){
for(pr=0,p*=10,i=0;p%q;i++,p*=10){
it=memo.begin();
while(it!=memo.end()){
if(it->num==p) break;
it++;
}
if(memo.end()==it){
memo.push_back(*(new s(p,i+1)));
}else{
pr=it->i;
ans[i]='\0';
goto find;
}
if(p>q){
ans[i]=(int)(p/q)+(int)'0';
p=p%q;
}else{
ans[i]='0';
}
}
ans[i]=(int)'0'+(int)(p/q);
ans[i+1]='\0';
find:;
printf("%s\n",ans);
if(pr){
for(j=0;j<pr-1;j++){
printf(" ");
}
while(j++<i) printf("^");
printf("\n");
}
pn++;
memo.clear();
}
return 0;
} | main.c:2:9: fatal error: list: No such file or directory
2 | #include<list>
| ^~~~~~
compilation terminated.
|
s043256594 | p00113 | C | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
| ^~~~
main.c: In function 'main':
main.c:1:1: error: type of 'p' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'q' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'l' defaults to 'int' [-Wimplicit-int]
main.c:1:19: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
main.c:1:19: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
| ^~~~~
main.c:1:19: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:50: error: variable-sized object may not be initialized except with an empty initializer
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
| ^
main.c:1:70: error: implicit declaration of function 'putchar' [-Wimplicit-function-declaration]
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
| ^~~~~~~
main.c:1:70: note: include '<stdio.h>' or provide a declaration of 'putchar'
main.c:1:105: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
1 | main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[q]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts(" ");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}
| ^~~~
main.c:1:105: note: include '<stdio.h>' or provide a declaration of 'puts'
|
s420436192 | p00113 | C++ | import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
string[] calc(int p, int q, RedBlackTree!int s) {
auto r = p%q;
if(r == 0){
s.clear();
return [to!string(p/q), ""];
}
if(r in s) {
s.clear();
s.insert(r);
return [to!string(p/q), "^"];
}
s.insert(r);
auto ret = calc(r*10, q, s);
ret[0] = to!string(p/q) ~ ret[0];
if(r in s)
s.clear();
if(s.empty())
ret[1] = " " ~ ret[1];
else
ret[1] = "^" ~ ret[1];
return ret;
}
void main() {
auto s = readln().strip().split();
while(!stdin.eof()) {
int p = to!int(s[0]);
int q = to!int(s[1]);
auto ans = calc(p*10, q, redBlackTree!int());
writeln(ans[0]);
if(ans[1].back == '^')
writeln(ans[1]);
s = readln().strip().split();
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import std.stdio;
| ^~~~~~
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 std.algorithm;
| ^~~~~~
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 std.string;
| ^~~~~~
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 std.range;
| ^~~~~~
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 std.array;
| ^~~~~~
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 std.conv;
| ^~~~~~
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 std.complex;
| ^~~~~~
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 std.math;
| ^~~~~~
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 std.ascii;
| ^~~~~~
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 std.bigint;
| ^~~~~~
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 std.container;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:14:1: error: 'string' does not name a type
14 | string[] calc(int p, int q, RedBlackTree!int s) {
| ^~~~~~
a.cc:38:1: error: '::main' must return 'int'
38 | void main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:39:18: error: 'readln' was not declared in this scope
39 | auto s = readln().strip().split();
| ^~~~~~
a.cc:40:16: error: 'stdin' was not declared in this scope
40 | while(!stdin.eof()) {
| ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | import std.stdio;
a.cc:41:25: error: 'to' was not declared in this scope
41 | int p = to!int(s[0]);
| ^~
a.cc:43:42: error: 'redBlackTree' was not declared in this scope
43 | auto ans = calc(p*10, q, redBlackTree!int());
| ^~~~~~~~~~~~
a.cc:43:28: error: 'calc' was not declared in this scope
43 | auto ans = calc(p*10, q, redBlackTree!int());
| ^~~~
a.cc:44:17: error: 'writeln' was not declared in this scope
44 | writeln(ans[0]);
| ^~~~~~~
|
s737500893 | p00113 | C++ | #include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long LL;
static const double EPS = 1e-9;
#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int main(void){
int p,q;
while(cin>>p>>q){
vector<int> mod;
mod.push_back(p);
int count=0;
while(true){
p*=10;
cout << p/q;
p=p%q;
if(!p){
cout<<endl;
break;
}
if(find(mod.begin(),mod.end(),p)!=mod.end()){
int div = distance(mod.begin(),find(mod.begin(),mod.end(),p));
cout<<endl;
REP(i,div) cout<<' ';
REP(i,count-div+1) cout<<'^';
cout<<endl;
break;
}
mod.push_back(p);
count++;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:14: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
25 | if(find(mod.begin(),mod.end(),p)!=mod.end()){
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:25:14: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
25 | if(find(mod.begin(),mod.end(),p)!=mod.end()){
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:26:44: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
26 | int div = distance(mod.begin(),find(mod.begin(),mod.end(),p));
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:26:44: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
26 | int div = distance(mod.begin(),find(mod.begin(),mod.end(),p));
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
|
s066153070 | p00113 | C++ | /*
AizuOnline A0113
Maximum Sum Sequence
*/
#include <stdio.h>
long long hijosuu;
long long josuu;
int quo[100];
long long rem[100];
int js; // junkansetu start
int je; // junkansetu end
init()
{
hijosuu = 100LL;
josuu = 32768LL;
}
// write junkansetu
write_yamagata()
{ int i;
printf("\n");
for(i=1;i<=js-1;i++)
printf(" ");
for(i=0;i<je-js;i++)
printf("^");
printf("\n");
}
main()
{
int i,j;
long long q,r;
int flag; // seisuubu 0 shousuubu 1
init();
while (EOF != scanf ("%lld %lld",&hijosuu,&josuu))
{
flag=0;
i=0;
while(1)
{
q = hijosuu / josuu;
r= (hijosuu % josuu);
hijosuu = 10 * r;
//if(flag==1)
// printf("%lld",q);
if(r==0)
{
printf("%lld\n",q);
break;
}
if(flag==0) //print seisuubu
{ // printf("."); //print comma :iranai
flag = 1;
i=0;
continue;
}
i++;
if(flag)
{
quo[i]=q;
rem[i]=r;
}
if(i>1)
for(j=i-1;j>=1;j--)
if(quo[i]==quo[j] && rem[i]==rem[j])
{
js=j;
je=i;
write_yamagata();
goto END_JUNKAN;
}
PRINT:
if(flag)
printf("%lld",q);
}
END_JUNKAN: ;
// printf("\njs je=%d %d\n",js,je);
}
printf("\n");
return(0);
} | a.cc:12:1: error: ISO C++ forbids declaration of 'init' with no type [-fpermissive]
12 | init()
| ^~~~
a.cc: In function 'int init()':
a.cc:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
16 | }
| ^
a.cc: At global scope:
a.cc:18:1: error: ISO C++ forbids declaration of 'write_yamagata' with no type [-fpermissive]
18 | write_yamagata()
| ^~~~~~~~~~~~~~
a.cc: In function 'int write_yamagata()':
a.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
26 | }
| ^
a.cc: At global scope:
a.cc:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
27 | main()
| ^~~~
|
s139011499 | p00113 | C++ | #include<iostream>
#include<vector>
void drawdown(int a,int size){
int i = 0;
for (; i < a; i++)std::cout << " ";
for (; i < size; i++)std::cout << "^";
std::cout << std::endl;
}
int main(){
int p, q;
while (std::cin >> p >> q){
std::vector<int>r;
r.push_back(0);
while (true){
if (p / q == 0)p *= 10;
std::cout << p / q;
p %= q;
auto it = std::find(r.begin(), r.end(), p);
if (it != r.end()){
std::cout << std::endl;
if (p == 0)break;
else {
drawdown(it - r.begin(), r.size());
break;
}
}
r.push_back(p);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:44: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
23 | auto it = std::find(r.begin(), r.end(), p);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
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,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:23:44: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
23 | auto it = std::find(r.begin(), r.end(), p);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
|
s622254933 | p00113 | C++ | #include<iostream>
#include<vector>
void drawdown(int a,int size){
int i = 0;
for (; i < a; i++)std::cout << " ";
for (; i < size; i++)std::cout << "^";
std::cout << std::endl;
}
int main(){
int p, q;
while (std::cin >> p >> q){
std::vector<int>r;
r.push_back(0);
while (true){
if (p / q == 0)p *= 10;
std::cout << p / q;
p %= q;
auto it = std::find(r.begin(), r.end(), p);
if (it != r.end()){
std::cout << std::endl;
if (p == 0)break;
else {
drawdown(it - r.begin(), r.size());
break;
}
}
r.push_back(p);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:44: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
23 | auto it = std::find(r.begin(), r.end(), p);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
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,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:23:44: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
23 | auto it = std::find(r.begin(), r.end(), p);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
|
s868065811 | p00113 | C++ | #include<iostream>
#include<vector>
void drawdown(int a,int size){
int i = 0;
for (; i < a; i++)std::cout << " ";
for (; i < size; i++)std::cout << "^";
std::cout << std::endl;
}
int main(){
int p, q;
while (std::cin >> p >> q){
std::vector<int>r;
r.push_back(0);
while (true){
if (p / q == 0)p *= 10;
std::cout << p / q;
p %= q;
std::vector<int>::iterator it = std::find(r.begin(), r.end(), p);
if (it != r.end()){
std::cout << std::endl;
if (p == 0)break;
else {
drawdown(it - r.begin(), r.size());
break;
}
}
r.push_back(p);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:66: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
23 | std::vector<int>::iterator it = std::find(r.begin(), r.end(), p);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
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,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:23:66: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
23 | std::vector<int>::iterator it = std::find(r.begin(), r.end(), p);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
|
s694497104 | p00114 | Java | import java.util.Scanner;
public class AOJ0114 {
public static void main(String[] argv) {
Scanner sc = new Scanner(System.in);
int[] num = new int[6];
while (true) {
for (int i=0;i<num.length;++i) {
num[i] = Integer.parseInt(sc.next());
}
if (max(num)!=0) {
System.out.println(""+lcm(calc(num)));
}
}
}
private static int[] calc (int... num) {
int[] no = new int[(int)num.length/2];
for (int i=0;i<num.length;i+=2) {
int val = 1, a = i, m = i+1, count=0;
do {
val = (num[a]*val)%num[m];
++count;
} while (val != 1);
no[i/2] = count;
}
return no;
}
private static int lcm (int... num) {
int max = max(num);
for (int i=2;i<=max;++i) {
int[] no = mod0(i, num.clone());
if (no!=null) {
return i*lcm(no);
}
}
int sum = 1;
for (int n : num) {
sum *= n;
}
return sum;
}
private static int[] mod0 (int n, int... num) {
boolean flag = true;
for (int i=0;i<num.length;++i) {
if (num[i]%n!=0) {
if (flag) {
flag = false;
} else {
return null;
}
} else {
num[i]/=n;
}
}
return num;
}
private static int max (int... num) {
int max = 0;
for (int n : num) {
if (max < n) {
max = n;
}
}
return max;
}
} | Main.java:4: error: class AOJ0114 is public, should be declared in a file named AOJ0114.java
public class AOJ0114 {
^
1 error
|
s588386504 | p00114 | C | #include <stdio.h>
long long cal_lcm(long long a, long long b)
{
long long t;
long long gcd;
long long a_bak;
a_bak = a;
gcd = b;
if (a < gcd){
t = a;
a = gcd;
gcd = t;
}
while (a % gcd != 0){
t = gcd;
gcd = a % gcd;
a = t;
}
return (a_ bak * b / gcd);
}
int round(int a, int m)
{
int x, n;
x = 1;
n = 0;
do {
x = (a * x) % m;
n++;
} while (x != 1);
return (n);
}
int main(void)
{
int a1, a2, a3;
int m1, m2, m3;
int n1, n2, n3;
long long lcm;
while (1){
scanf("%d%d%d%d%d%d", &a1, &m1, &a2, &m2, &a3, &m3);
if (a1 == 0 && m1 == 0 &&
a2 == 0 && m2 == 0 &&
a3 == 0 && m3 == 0){
break;
}
n1 = round(a1, m1);
n2 = round(a2, m2);
n3 = round(a3, m3);
lcm = cal_lcm(n1, n2);
lcm = cal_lcm(lcm, n3);
printf("%lld\n", lcm);
}
return (0);
} | main.c: In function 'cal_lcm':
main.c:24:17: error: 'a_' undeclared (first use in this function); did you mean 'a'?
24 | return (a_ bak * b / gcd);
| ^~
| a
main.c:24:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:19: error: expected ')' before 'bak'
24 | return (a_ bak * b / gcd);
| ~ ^~~~
| )
main.c: At top level:
main.c:28:5: warning: conflicting types for built-in function 'round'; expected 'double(double)' [-Wbuiltin-declaration-mismatch]
28 | int round(int a, int m)
| ^~~~~
main.c:2:1: note: 'round' is declared in header '<math.h>'
1 | #include <stdio.h>
+++ |+#include <math.h>
2 |
|
s451010961 | p00114 | C | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;} | main.c:1:1: warning: data definition has no type or storage class
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^
main.c:1:7: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^
main.c:1:23: error: return type defaults to 'int' [-Wimplicit-int]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^
main.c: In function 'L':
main.c:1:23: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:1:23: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:1:36: error: 'n' undeclared (first use in this function)
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^
main.c:1:36: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:1:50: error: return type defaults to 'int' [-Wimplicit-int]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^~~~
main.c: In function 'main':
main.c:1:50: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:63: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
main.c:1:63: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^~~~~
main.c:1:63: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:102: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a,b,i,t;long long k=1;L(x,y){!y?k*=n/x:L(y,x%y);}main(n){for(;scanf("%d%d",&a,&b)*a;L(n,k),n=++i%3<1?printf("%lld\n",k),k=1:1)for(t=a;t-1;t=t*a%b)++n;}
| ^~~~~~
main.c:1:102: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:102: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:102: note: include '<stdio.h>' or provide a declaration of 'printf'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.