submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s294887536 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
// sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ
// sst ツづ按づァツ return 2
int f(string s)
{
unsigned int count;
for(count = 1; count < s.size(); count++){
if(s.at(count-1) != s.at(count)) break;
}
return count;
}
int main()
{
int n;
string str;
while(1){
cin>>n; if(n == 0) break;
cin>>str;
for(int i = 0; i < n; i++){
string ans;
for(unsigned int j = 0; j < str.size();){
char buf[1024];
int len = f(str.substr(j));
sprintf_s(buf, 1024, "%d%c", len, str.at(j));
ans += buf;
j += len;
}
str = ans;
}
cout<<str<<endl;
}
} | a.cc: In function 'int main()':
a.cc:28:33: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'?
28 | sprintf_s(buf, 1024, "%d%c", len, str.at(j));
| ^~~~~~~~~
| sprintf
|
s453008644 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
// sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ
// sst ツづ按づァツ return 2
int f(string s)
{
unsigned int count;
for(count = 1; count < s.size(); count++){
if(s.at(count-1) != s.at(count)) break;
}
return count;
}
int main()
{
int n;
string str;
while(1){
cin>>n; if(n == 0) break;
cin>>str;
for(int i = 0; i < n; i++){
string ans;
for(unsigned int j = 0; j < str.size();){
char buf[1024];
int len = f(str.substr(j));
sprintf_s(buf, 1024, "%d%c", len, str.at(j));
//ans += buf;
j += len;
}
str = ans;
}
cout<<str<<endl;
}
} | a.cc: In function 'int main()':
a.cc:28:33: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'?
28 | sprintf_s(buf, 1024, "%d%c", len, str.at(j));
| ^~~~~~~~~
| sprintf
|
s316915858 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n,r;
string in,ou;
char a,b,ra;
while(1){
cin >> n;
if(n != 0){
cin >> ou;
for(int i = 0; i < n; i++){
r = 1;
in = ou;
ou = "";
a = in.at(0);
for(int j = 1; j < in.length(); j++){
b = in.at(j);
if(a == b){
r++;
}else{
ou += itoa(r, &ra, 10);
ou += a;
r = 1;
}
if(j == in.length()-1){
ou += itoa(r, &ra, 10);
ou += b;
r = 1;
}
a = b;
}
}
cout << ou << endl;
}else{
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:55: error: 'itoa' was not declared in this scope
28 | ou += itoa(r, &ra, 10);
| ^~~~
a.cc:34:55: error: 'itoa' was not declared in this scope
34 | ou += itoa(r, &ra, 10);
| ^~~~
|
s550563315 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n,r;
string in,ou;
char a,b,*ra;
ra = new char;
while(1){
cin >> n;
if(n != 0){
cin >> ou;
for(int i = 0; i < n; i++){
r = 1;
in = ou;
ou = "";
a = in.at(0);
for(int j = 1; j < in.length(); j++){
b = in.at(j);
if(a == b){
r++;
}else{
ou += itoa(r, ra, 10);
ou += a;
r = 1;
}
if(j == in.length()-1){
ou += itoa(r, ra, 10);
ou += b;
r = 1;
}
a = b;
}
}
cout << ou << endl;
}else{
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:30:55: error: 'itoa' was not declared in this scope
30 | ou += itoa(r, ra, 10);
| ^~~~
a.cc:36:55: error: 'itoa' was not declared in this scope
36 | ou += itoa(r, ra, 10);
| ^~~~
|
s505734340 | p00429 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
using namespace std;
int solve()
{
int n, l, r;
char c;
char buf[1000];
string s;
queue<char> q;
cin >> n;
while (n > 0) {
cin >> s;
for (int i = 0; i < s.size(); i++) q.push(s[i]);
for (int i = 0; i < n; i++) {
int j = 0;
l = q.size();
while (j < l) {
r = 0;
c = q.front();
while (q.front() == c && j < l) {
q.pop();
r++;
j++;
}
sprintf(buf, "%d", r);
for (int k = 0; k < strlen(buf); k++) q.push(buf[k]);
q.push(c);
}
}
while (q.size() > 0) {
cout << q.front();
q.pop();
}
cout << endl;
cin >> n;
}
}
int main()
{
solve();
return 0;
} | a.cc: In function 'int solve()':
a.cc:33:29: error: 'strlen' was not declared in this scope
33 | for (int k = 0; k < strlen(buf); k++) q.push(buf[k]);
| ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <queue>
+++ |+#include <cstring>
5 |
a.cc:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
44 | }
| ^
|
s918287894 | p00429 | C++ | #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;
static const double eps = 1e-8;
int main(){
int n;
while(~scanf("%d",&n)){
if(n==0) break;
string num;
cin >> num;
for(int i=0;i<n;i++){
string next;
for(int j=0;j<num.size();){
int c = 0;
char alph;
for(int k=0;k<=9;k++){
for(int len=1;j+len-1<num.size();len++){
string tmp = num.substr(j,len);
if(count(tmp.begin(),tmp.end(),'0'+k) == len){
c++;
alph = '0' + k;
}
}
}
j+=c;
char buf[32];
itoa(c,buf,10);
string tmp = buf;
next.append(tmp);
next.push_back(alph);
}
num = next;
}
cout << num << endl;
}
} | a.cc: In function 'int main()':
a.cc:49:33: error: 'itoa' was not declared in this scope
49 | itoa(c,buf,10);
| ^~~~
|
s613307613 | p00429 | C++ | #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;
static const double eps = 1e-8;
int main(){
int n;
while(~scanf("%d",&n)){
if(n==0) break;
string num;
cin >> num;
for(int i=0;i<n;i++){
string next;
for(int j=0;j<num.size();){
int c = 0;
char alph;
for(int k=0;k<=9;k++){
for(int len=1;j+len-1<num.size();len++){
string tmp = num.substr(j,len);
if(count(tmp.begin(),tmp.end(),'0'+k) == len){
c++;
alph = '0' + k;
}
}
}
j+=c;
char buf[32];
itoa(c,buf,10);
string tmp = buf;
next.append(tmp);
next.push_back(alph);
}
num = next;
}
cout << num << endl;
}
} | a.cc: In function 'int main()':
a.cc:50:33: error: 'itoa' was not declared in this scope
50 | itoa(c,buf,10);
| ^~~~
|
s250229397 | p00429 | C++ | #include <iostream>
#include <sstream>
#include <cstdlib>
using namespace std;
void addstr(string s,int a,int b) {
stringstream ss;
ss << a << b;
s += ss.str();
}
int main() {
int n,count = 1,p = 0;
string str;
int r[10000],a[10000],x[10000];
int size;
while(cin >> n) {
if(n == 0) break;
cin >> str;
for(int i=0;i<n;i++) {
size = str.size();
x[0] = atoi(str.substr(0,1).c_str());
for(int k=1;k<size;k++) {
x[k] = atoi(str.substr(k,1).c_str());
if(x[k] == x[k-1]) {
count++;
if(k == size-1) {
r = count;
a = x[k-1];
addstr(newstr,r,a);
str = newstr;
}
}
else {
// cout << count << x[k-1];
r = count;
a = x[k-1];
addstr(newstr,r,a);
if(k == size-1) {
r = 1;
a = x[k];
addstr(newstr,r,a);
str = newstr;
}
count = 1;
}
}
count = 1;
}
cout << str << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:15: error: incompatible types in assignment of 'int' to 'int [10000]'
29 | r = count;
| ~~^~~~~~~
a.cc:30:15: error: incompatible types in assignment of 'int' to 'int [10000]'
30 | a = x[k-1];
| ~~^~~~~~~~
a.cc:32:20: error: 'newstr' was not declared in this scope
32 | addstr(newstr,r,a);
| ^~~~~~
a.cc:38:13: error: incompatible types in assignment of 'int' to 'int [10000]'
38 | r = count;
| ~~^~~~~~~
a.cc:39:13: error: incompatible types in assignment of 'int' to 'int [10000]'
39 | a = x[k-1];
| ~~^~~~~~~~
a.cc:40:18: error: 'newstr' was not declared in this scope
40 | addstr(newstr,r,a);
| ^~~~~~
a.cc:42:15: error: incompatible types in assignment of 'int' to 'int [10000]'
42 | r = 1;
| ~~^~~
a.cc:43:15: error: incompatible types in assignment of 'int' to 'int [10000]'
43 | a = x[k];
| ~~^~~~~~
|
s490436734 | p00429 | C++ | #include <iostream>
#include <iterator>
#include <fstream>
#include <sstream>
#include <strstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
using namespace std;
int main(void){
string str;
string str2;
string str3;
int a,b,c,n,nn;
char sum[10];
while(1){
cin >> n;
if(n==0)break;
cin >> str;
for(a=0;a<n;a++){
nn=1;
for(b=1;b<str.size();b++){
if(b==str.size()-1){
if(str[b-1]==str[b]){
nn++;
itoa(nn,sum,10);
str2+=sum;
back_inserter(str2)=str[b-1];
for(c=0;c<10;c++)sum[c]='\0';
}else{
itoa(nn,sum,10);
str2+=sum;
back_inserter(str2)=str[b-1];
back_inserter(str2)='1';
back_inserter(str2)=str[b];
for(c=0;c<10;c++)sum[c]='\0';
}
}else{
if(str[b-1]==str[b]){
nn++;
}else{
itoa(nn,sum,10);
str2+=sum;
back_inserter(str2)=str[b-1];
nn=1;
for(c=0;c<10;c++)sum[c]='\0';
}
}
}
str=str2;
str2="";
}
cout << str << endl;
}
return 0;
} | In file included from /usr/include/c++/14/backward/strstream:50,
from a.cc:5:
/usr/include/c++/14/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
32 | #warning \
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:47:49: error: 'itoa' was not declared in this scope
47 | itoa(nn,sum,10);
| ^~~~
a.cc:52:49: error: 'itoa' was not declared in this scope
52 | itoa(nn,sum,10);
| ^~~~
a.cc:63:49: error: 'itoa' was not declared in this scope
63 | itoa(nn,sum,10);
| ^~~~
|
s738873040 | p00429 | C++ | #include <iostream>
#include <iterator>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <stdlib.h>
using namespace std;
int main(void){
string str;
string str2;
string str3;
int a,b,c,n,nn;
char sum[10];
while(1){
cin >> n;
if(n==0)break;
cin >> str;
for(a=0;a<n;a++){
nn=1;
for(b=1;b<str.size();b++){
if(b==str.size()-1){
if(str[b-1]==str[b]){
nn++;
itoa(nn,sum,10);
str2+=sum;
back_inserter(str2)=str[b-1];
for(c=0;c<10;c++)sum[c]='\0';
}else{
itoa(nn,sum,10);
str2+=sum;
back_inserter(str2)=str[b-1];
back_inserter(str2)='1';
back_inserter(str2)=str[b];
for(c=0;c<10;c++)sum[c]='\0';
}
}else{
if(str[b-1]==str[b]){
nn++;
}else{
itoa(nn,sum,10);
str2+=sum;
back_inserter(str2)=str[b-1];
nn=1;
for(c=0;c<10;c++)sum[c]='\0';
}
}
}
str=str2;
str2="";
}
cout << str << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:47:49: error: 'itoa' was not declared in this scope
47 | itoa(nn,sum,10);
| ^~~~
a.cc:52:49: error: 'itoa' was not declared in this scope
52 | itoa(nn,sum,10);
| ^~~~
a.cc:63:49: error: 'itoa' was not declared in this scope
63 | itoa(nn,sum,10);
| ^~~~
|
s764698004 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
string T,F;
void fuego() {string ans;int i,j,k=1;T+='-';F="";for (i=1,j=T.size();i<j;i++) if (T[i]!=T[i-1]) {while (k) ans.insert(0,(k%10+'0')),k/=10;F+=ans+T[i-1];k=1,ans="";} else k++;T=F;}
int main() {int N;while (1) {cin>>N;if (!N) return 0;cin>>T;while (N--) fuego();cout<<T<<endl;}} | a.cc: In function 'void fuego()':
a.cc:5:118: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(int, int)'
5 | void fuego() {string ans;int i,j,k=1;T+='-';F="";for (i=1,j=T.size();i<j;i++) if (T[i]!=T[i-1]) {while (k) ans.insert(0,(k%10+'0')),k/=10;F+=ans+T[i-1];k=1,ans="";} else k++;T=F;}
| ~~~~~~~~~~^~~~~~~~~~~~~~
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:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (near match)
2007 | insert(size_type __pos, const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: conversion of argument 2 would be ill-formed:
a.cc:5:126: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
5 | void fuego() {string ans;int i,j,k=1;T+='-';F="";for (i=1,j=T.size();i<j;i++) if (T[i]!=T[i-1]) {while (k) ans.insert(0,(k%10+'0')),k/=10;F+=ans+T[i-1];k=1,ans="";} else k++;T=F;}
| ~~~~~^~~~~
| |
| int
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1876 | insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2069:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = int; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::insert(size_type, const _Tp&) [with _Tp = int]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
a.cc:5:118: required from here
5 | void fuego() {string ans;int i,j,k=1;T+='-';F="";for (i=1,j=T.size();i<j;i++) if (T[i]!=T[i-1]) {while (k) ans.insert(0,(k%10+'0')),k/=10;F+=ans+T[i-1];k=1,ans="";} else k++;T=F;}
| ~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2086 | insert(size_type __pos1, const _Tp& __svt,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator; size_type = long unsigned int]'
1831 | insert(const_iterator __p, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1911:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1911:29: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::const_iterator'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1939:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1939 | insert(size_type __pos1, const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1939:52: note: no known conversion for argument 2 from 'int' to 'const std::__cxx11::basic_string<char>&'
1939 | insert(size_type __pos1, const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1963 | insert(size_type __pos1, const basic_string& __str,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1987 | insert(size_type __pos, const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2032 | insert(size_type __pos, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2051:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(__const_iterator, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
2051 | insert(__const_iterator __p, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string |
s347654427 | p00429 | C++ | #include<stdio.h>
int main(){
int i
printf("%d%n",2,&i);
return 0;
} | a.cc: In function 'int main()':
a.cc:5:1: error: expected initializer before 'printf'
5 | printf("%d%n",2,&i);
| ^~~~~~
|
s211723588 | p00429 | C++ | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int N;
while(cin >> N,N){
string str;
cin >> str;
char c;
int co;
while(N > 0){
N--;
string t;
co = 1;
c = str[0];
for(int i = 1; i < str.size(); i++){
if(str[i] == c)
co++;
else{
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
c = str[i];
co = 1;
}
}
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
str = t;
}
cout << str.c_str() << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:33: error: 'itoa' was not declared in this scope
29 | itoa(co, s, 10);
| ^~~~
a.cc:38:33: error: 'itoa' was not declared in this scope
38 | itoa(co, s, 10);
| ^~~~
|
s611294711 | p00429 | C++ | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int N;
while(cin >> N,N){
string str;
cin >> str;
char c;
int co;
while(N > 0){
N--;
string t;
co = 1;
c = str[0];
for(int i = 1; i < str.size(); i++){
if(str[i] == c)
co++;
else{
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
c = str[i];
co = 1;
}
}
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
str = t;
}
cout << str.c_str() << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:30:33: error: 'itoa' was not declared in this scope
30 | itoa(co, s, 10);
| ^~~~
a.cc:39:33: error: 'itoa' was not declared in this scope
39 | itoa(co, s, 10);
| ^~~~
|
s189637918 | p00429 | C++ | #include <cstdio>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int N;
while(cin >> N,N){
string str;
cin >> str;
char c;
int co;
while(N > 0){
N--;
string t;
co = 1;
c = str[0];
for(int i = 1; i < str.size(); i++){
if(str[i] == c)
co++;
else{
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
c = str[i];
co = 1;
}
}
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
str = t;
}
cout << str.c_str() << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:30:33: error: 'itoa' was not declared in this scope
30 | itoa(co, s, 10);
| ^~~~
a.cc:39:33: error: 'itoa' was not declared in this scope
39 | itoa(co, s, 10);
| ^~~~
|
s062093410 | p00429 | C++ | #include <cstdio>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int N;
while(cin >> N,N){
string str;
cin >> str;
char c;
int co;
while(N > 0){
N--;
string t;
co = 1;
c = str[0];
for(int i = 1; i < str.size(); i++){
if(str[i] == c)
co++;
else{
char s[10];
sprintf(s, "%d", co);
t += s;
t.push_back(c);
c = str[i];
co = 1;
}
}
char s[10];
itoa(co, s, 10);
t += s;
t.push_back(c);
str = t;
}
cout << str.c_str() << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:33: error: 'itoa' was not declared in this scope
39 | itoa(co, s, 10);
| ^~~~
|
s406641556 | p00429 | C++ | char a[999999],b[999999],*p;
main(i,n,c,s,d,l){
for(;scanf("%d",&n),n;printf("%s\n",a)){
scanf("%s",a);
for(;n;n--){
for(p=b,i=d=s=0,l=strlen(a);i<=l;i++){
c=a[i];
if(!s)s=c;
if(s!=c){
p+=sprintf(p,"%d",d);
*(p++)=s;
d=0;s=c;
}
d++;
}
*p=0;
strcpy(a,b);
}
}
return 0;
} | a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
2 | main(i,n,c,s,d,l){
| ^
|
s515549477 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
string ToString ( int x )
{
string s = "";
while ( x )
{
s += ((x % 10) + '0');
x /= 10;
}
reverse(s.begin(), s.end());
return s;
}
int main ( void )
{
int n;
while ( cin >> n, n )
{
string s1, s2;
cin >> s1;
for (int i = 0; i < n; ++i)
{
char c = s1[0];
int counter = 0;
s1 += 'x';
s2 = "";
for (int j = 0; j < s1.size(); ++j)
{
if ( c != s1[j] )
{
// cout << ToString(counter) << ' ' << c << endl;
s2 += ToString(counter) + c;
c = s1[j];
counter = 1;
}
else
++counter;
}
s1 = s2;
}
cout << s1 << endl;
}
return 0;
} | a.cc: In function 'std::string ToString(int)':
a.cc:16:9: error: 'reverse' was not declared in this scope
16 | reverse(s.begin(), s.end());
| ^~~~~~~
|
s057671522 | p00429 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
while(1){
int a,i,j,b,sum=0,num=0;
string x[21];
cin<<a;
if(a==0) break;
cin<<x[0];
for(i=0;i<a;i++){
for(j=0;j<x.size();j++){
if(x[i][j]==x[i][j+1]){
sum++;
}else{
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2;
}}
}
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2;
}
}
printf("%s\n",x[a]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin<<a;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:6: note: candidate: 'operator<<(int, int)' (built-in)
8 | cin<<a;
| ~~~^~~
a.cc:8:6: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
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:8:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
8 | cin<<a;
| ^~~
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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 = int]':
a.cc:8:8: required from here
8 | cin<<a;
| ^
/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:10:8: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
10 | cin<<x[0];
| ~~~^~~~~~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::istream {aka std::basic_istream<char>}
/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:10:13: note: 'std::istream' {aka |
s670779050 | p00429 | C++ | #include <iostream>
#include <cstring>
using namespace std;
int main(){
while(1){
int a,i,j,b,sum=0,num=0;
char x[21][101];
cin<<a;
if(a==0) break;
cin<<x[0];
for(i=0;i<a;i++){
for(j=0;j<strlen(x);j++){
if(x[i][j]==x[i][j+1]){
sum++;
}else{
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2;
}}
}
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2;
}
}
printf("%s\n",x[a]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin<<a;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:6: note: candidate: 'operator<<(int, int)' (built-in)
8 | cin<<a;
| ~~~^~~
a.cc:8:6: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
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:8:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
8 | cin<<a;
| ^~~
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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:8:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin<<a;
| ^
/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 = int]':
a.cc:8:8: required from here
8 | cin<<a;
| ^
/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:10:8: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'char [101]')
10 | cin<<x[0];
| ~~~^~~~~~
| | |
| | char [101]
| std::istream {aka std::basic_istream<char>}
/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:10:13: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Trait |
s193830130 | p00429 | C++ | #include <cstdio>
#include <cstring>
using namespace std;
int main(){
int a,i,j,b,sum=1,num=0;
char x[21][101];
scanf("%d",&a);
if(a==0) break;
scanf("%s",&x[0]);
for(i=0;i<a;i++){
for(j=0;j<strlen(x[i]);j++){
if(x[i][j]==x[i][j+1]){
sum++;
}else{
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3; sum=1;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2; sum=1;
}}
}
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3;sum=1;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2; sum=1;
}
}
printf("%s\n",x[a]);
return 0;
} | a.cc: In function 'int main()':
a.cc:8:12: error: break statement not within loop or switch
8 | if(a==0) break;
| ^~~~~
|
s033638490 | p00429 | C++ |
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
while(1){
int a,i,j,b,sum=1,num=0;
char x[21][101];
scanf("%d",&a);
if(a==0) break;
scanf("%s",&x[0]);
for(i=0;i<a;i++){
for(j=0;j<strlen(x[i]);j++){
if(x[i][j]==x[i][j+1]){
sum++;
}else{
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3; sum=1;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2; sum=1;
}}
}
if(sum>=10){
x[i+1][num]=sum/10+'0';
x[i+1][num+1]=sum%10+'0';
x[i+1][num+2]=x[i][j];
num+=3;sum=1;
}else{
x[i+1][num]=sum+'0';
x[i+1][num+1]=x[i][j];
num+=2; sum=1;
}
}
for(i=0;i<num;i++){
printf("%c",x[a][i]);
}
print("\n");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:42:1: error: 'print' was not declared in this scope; did you mean 'printf'?
42 | print("\n");
| ^~~~~
| printf
|
s249901150 | p00429 | C++ | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main()
{
char in[2][101],key,temp[101];
int n,now,cnt,wrt;
bool turn;
while(cin >> n && n){
cin >> in[0];
turn = 1;
for(int i = 0; i < n; i++){
turn = !turn;
now = 0;
wrt = 0;
while(now < strlen(in[turn])){
key = in[turn][now];
cnt = 0;
while(now < strlen(in[turn]) && key == in[turn][now]){
now++;
cnt++;
}
sprintf(temp,"%d",cnt);
for(int j = 0; j < strlen(temp); j++){
in[!turn][wrt] = temp[j];
wrt++;
}
in[!turn][wrt] = key;
wrt++;
}
in[!turn][wrt] = '\0';
}
cout << in[!turn] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:37: error: 'strlen' was not declared in this scope
20 | while(now < strlen(in[turn])){
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <iostream>
+++ |+#include <cstring>
3 | #include <string>
|
s808117218 | p00429 | C++ | #include<cstdio>
#include<string>;
using namespace std;
int n;
int str_n;
char str[10000];
char str_[10000];
void solve()
{
char c=str[0];
int n=1;
int k=0;
str_n=strlen(str);
for(int i=1;i<str_n+1;i++)
{
if(c==str[i]&&i!=str_n)
{
n++;
}
else
{
if(n>=10)
{
str_[k+1]=n%10+'0';
str_[k]=(n-n%10)/10+'0';
k+=2;
}
else
{
str_[k]=n+'0';
k++;
}
str_[k]=c;
k++;
c=str[i];
n=1;
}
}
strcpy(str,str_);
fill(str_,str_+100,0);
}
int main()
{
while(scanf("%d",&n)!=EOF)
{
fill(str_,str_+100,0);
fill(str,str+100,0);
if(n==0)break;
getchar();
gets(str);
for(int i=0;i<n;i++)
{
solve();
}
printf("%s\n",str);
}
return true;
} | a.cc:2:17: warning: extra tokens at end of #include directive
2 | #include<string>;
| ^
a.cc: In function 'void solve()':
a.cc:16:23: error: 'strlen' was not declared in this scope
16 | str_n=strlen(str);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<string>;
+++ |+#include <cstring>
3 |
a.cc:42:17: error: 'strcpy' was not declared in this scope
42 | strcpy(str,str_);
| ^~~~~~
a.cc:42:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int main()':
a.cc:54:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
54 | gets(str);
| ^~~~
| getw
|
s199388093 | p00429 | C++ | #include<cstdio>
#include<string>
using namespace std;
int n;
int str_n;
char str[10000];
char str_[10000];
void solve()
{
char c=str[0];
int n=1;
int k=0;
str_n=strlen(str);
for(int i=1;i<str_n+1;i++)
{
if(c==str[i]&&i!=str_n)
{
n++;
}
else
{
if(n>=10)
{
str_[k+1]=n%10+'0';
str_[k]=(n-n%10)/10+'0';
k+=2;
}
else
{
str_[k]=n+'0';
k++;
}
str_[k]=c;
k++;
c=str[i];
n=1;
}
}
strcpy(str,str_);
fill(str_,str_+100,0);
}
int main()
{
while(scanf("%d",&n)!=EOF)
{
fill(str_,str_+100,0);
fill(str,str+100,0);
if(n==0)break;
getchar();
gets(str);
for(int i=0;i<n;i++)
{
solve();
}
printf("%s\n",str);
}
return true;
} | a.cc: In function 'void solve()':
a.cc:16:23: error: 'strlen' was not declared in this scope
16 | str_n=strlen(str);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<string>
+++ |+#include <cstring>
3 |
a.cc:42:17: error: 'strcpy' was not declared in this scope
42 | strcpy(str,str_);
| ^~~~~~
a.cc:42:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int main()':
a.cc:54:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
54 | gets(str);
| ^~~~
| getw
|
s554668165 | p00429 | C++ | #include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
int main(){
int n;
while(scanf("%d",&n) && n){
string a;
cin >> a;
for(int i=0;i<n;i++){
string b;
int ro=1;
for(int i=1;i<a.size();i++){
if(a[i-1]==a[i]){
ro++;
}else{
string ru;
while(ro){
int r=ro%10;
ru.push_back(r+'0');
ro/=10;
}
ro=1;
reverse(ru.begin(),ru.end());
b+=ru;
b.push_back(a[i-1]);
}
}
string ru;
while(ro){
int r=ro%10;
ru.push_back(r+'0');
ro/=10;
}
ro=1;
reverse(ru.begin(),ru.end());
b+=ru;
b.push_back(a[a.size()-1]);
a=b;
}
cout << a << endl;
}
} | a.cc: In function 'int main()':
a.cc:25:41: error: 'reverse' was not declared in this scope
25 | reverse(ru.begin(),ru.end());
| ^~~~~~~
a.cc:37:41: error: 'reverse' was not declared in this scope
37 | reverse(ru.begin(),ru.end());
| ^~~~~~~
|
s651381765 | p00429 | C++ | #include <iostream>
using namespace std;
int main(void){
int n;
char str[100],tmp[100];
cin >> n >> str;
for(int i=0;str[i];i++)
str[i]-=0x30;
for(int i=0;i<n;i++){
int p=0;
for(int j=0;str[j];j++){
int c = 1;
while(str[j]==str[j+1]){
j++;
c++;
}
tmp[p++]=c;
tmp[p++]=str[j];
}
tmp[p]='\0';
strcpy(str,tmp);
}
for(int i=0;str[i];i++)
str[i]+=0x30;
cout << str << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:17: error: 'strcpy' was not declared in this scope
26 | strcpy(str,tmp);
| ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s952739722 | p00429 | C++ | def foo(n):
ret = ""
cnt = 1
for i in range(1, len(n)):
if n[i - 1] == n[i]:
cnt += 1
continue
else:
ret += str(cnt) + n[i - 1]
cnt = 1
ret += str(cnt) + n[-1]
return ret
while 1:
n = input()
if n == 0:
break
m = raw_input().strip()
for i in range(n):
m = foo(m)
print m | a.cc:1:1: error: 'def' does not name a type
1 | def foo(n):
| ^~~
|
s244909356 | p00429 | C++ | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int N;
string S;
string::iterator CountSeqStr(string::iterator start, string *s, int *n){
*s = *start;
*n = 0;
string tmp;
for(;tmp = *start, tmp == *s && start != S.end(); ++start){
(*n)++;
}
return --start;
}
string F(){
string retS;
string s;
string::iterator it;
int n;
for(it= S.begin(); it != S.end(); ++it){
it = CountSeqStr(it, &s, &n);
char *strn;
retS.append(string(itoa(n, strn, 10)));
retS.append(s);
}
return retS;
}
int main(){
while(cin >> N && N){
cin >> S;
for(int i=0; i<N; i++){
string tmp;
S = F();
}
cout << S << endl;
}
return 0;
} | a.cc: In function 'std::string F()':
a.cc:29:24: error: 'itoa' was not declared in this scope; did you mean 'it'?
29 | retS.append(string(itoa(n, strn, 10)));
| ^~~~
| it
|
s513989300 | p00429 | C++ | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int N;
string S;
string::iterator CountSeqStr(string::iterator start, string *s, int *n){
*s = *start;
*n = 0;
string tmp;
for(;tmp = *start, tmp == *s && start != S.end(); ++start){
(*n)++;
}
return --start;
}
string F(){
string retS;
string s;
string::iterator it;
int n;
for(it= S.begin(); it != S.end(); ++it){
it = CountSeqStr(it, &s, &n);
char *strn;
retS.append(string(itoa(n, strn, 10)));
retS.append(s);
}
return retS;
}
int main(){
while(cin >> N && N){
cin >> S;
for(int i=0; i<N; i++){
string tmp;
S = F();
}
cout << S << endl;
}
return 0;
} | a.cc: In function 'std::string F()':
a.cc:30:24: error: 'itoa' was not declared in this scope; did you mean 'it'?
30 | retS.append(string(itoa(n, strn, 10)));
| ^~~~
| it
|
s791336879 | p00430 | Java | public class Main {
static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int n = scan.nextInt();
while(n!=0){
int[] l = new int[n];
routine(n,-1, 0, l);
n = scan.nextInt();
}
}
private static void routine(int n, int m, int depth, int[] l){
if(n==0){
for(int j=0; j<depth; j++)
System.out.print(l[j]+" ");
System.out.println();
return;
}else{
for(int i=n; i>0; i--){
if(i>m && m!=-1) continue;
l[depth] = i;
routine(n-i, i, depth+1, l);
}
}
}
} | Main.java:2: error: cannot find symbol
static final Scanner scan = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:2: error: cannot find symbol
static final Scanner scan = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s956612665 | p00430 | Java | public class Main {
int[] a;
public static void main(String []args){
try{
FileWriter fw = new FileWriter("output.txt");
BufferedWriter bw = new BufferedWriter(fw);
while (true) {
Scanner in = new Scanner(System.in);
int num = in.nextInt();
if(num==0)
break;
int[] a=new int[num];
int p=0;
int t=0;
int pre=0;
a[0]=num;
for(;;){
for (int i=0;i<num-1;i++) {
//------出力------------
if(a[0]==pre){
int h=lch(a,0,1);
int q=h;
for(int j=0;j<h;j++){
a[j]--;
if(a[q]==a[0])
q++;
a[q]++;
}
p=0;
t=0;
}
if(p==0 && pre!=a[0]){
for(int j=0;j<num;j++){
p=1;
if(a[j]!=0)
bw.write(""+a[j]+" ");
else{
bw.write("\n");
if(a[num-a[0]]==1){
pre=a[0];
int h=1;
for(int k=2;k<num;k++){
a[h]=a[h]+a[k];
a[k]=0;
if(a[h]==a[0])
h++;
}
t=1;
}
break;
}
}
}
//----------------------
if(((a[i+1]+1)<=(a[i]-1) && a[i+1]<=1) || (t==1 && (a[i+1]+1)<=(a[i]-1))){
a[i]--;
a[i+1]++;
i=-1;
t=0;
p=0;
}else if(t==1){
}else if(a[i+1]<=1 && a[i]>=2){
a[rch(a,i,i+1)]++;
a[i]--;
i=-1;
p=0;
}else if(a[i+1]<=1){
break;
}
}
if(a[num-1]==1)
bw.write("\n");
break;
}
for (int i = 0; i < a.length; i++) {
a[i]=0;
}
}
bw.close();
}catch(IOException e){
System.out.println(e);
}
}
public static int rch(int[] a,int x,int y){
if((a[x]-1)==a[y])
return rch(a,x,y+1);
else
return y;
}
public static int lch(int[] a,int x,int y){
if(a[x]==a[y])
return lch(a,x,y+1);
else
return y;
}
} | Main.java:6: error: cannot find symbol
FileWriter fw = new FileWriter("output.txt");
^
symbol: class FileWriter
location: class Main
Main.java:6: error: cannot find symbol
FileWriter fw = new FileWriter("output.txt");
^
symbol: class FileWriter
location: class Main
Main.java:7: error: cannot find symbol
BufferedWriter bw = new BufferedWriter(fw);
^
symbol: class BufferedWriter
location: class Main
Main.java:7: error: cannot find symbol
BufferedWriter bw = new BufferedWriter(fw);
^
symbol: class BufferedWriter
location: class Main
Main.java:10: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:10: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:83: error: cannot find symbol
}catch(IOException e){
^
symbol: class IOException
location: class Main
7 errors
|
s299157734 | p00430 | C | #include <stdio.h>
#include <memory.h>
void f(int now,int rest,int list[],int p){
int i;
list[p]=now;
if(rest==0){
for(i=0;i<=p;i++){
if(i>0){
printf(" ");
}
printf("%d",list[i]);
}
for(i=rest;i>0;i--){
f(i,rest-i,list,p+1);
}
}
int main(void){
int n,i,list[301];
while(1){
scanf("%d",&n);
if(n==0){
break;
}
memset(list,0,sizeof(list));
for(i=n;i>0;i--){
f(i,n-i,list,0);
}
}
return 0;
} | main.c: In function 'f':
main.c:30:1: error: expected declaration or statement at end of input
30 | }
| ^
|
s931625499 | p00430 | C | int main()
{
int n;
while (scanf("%d", &n), n)
{
int b[31];
memset(b, 0, sizeof(b));
b[0] = n;
while (true)
{
int t = find(b, b+n, 0) - b;
for (int i = 0; i < t-1; ++i)
printf("%d ", b[i]);
printf("%d\n", b[t-1]);
if (t == n)
break;
int u;
u = t-1;
while (b[u] == 1)
--u;
--b[u];
++u;
fill(b+u, b+n, 0);
int s = t - u + 1;
while (s--)
{
if (b[u] == b[u-1])
++u;
++b[u];
}
}
}
} | main.c: In function 'main':
main.c:4:16: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
4 | while (scanf("%d", &n), n)
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main()
main.c:4:16: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
4 | while (scanf("%d", &n), n)
| ^~~~~
main.c:4:16: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:17: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
7 | memset(b, 0, sizeof(b));
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
+++ |+#include <string.h>
1 | int main()
main.c:7:17: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
7 | memset(b, 0, sizeof(b));
| ^~~~~~
main.c:7:17: note: include '<string.h>' or provide a declaration of 'memset'
main.c:9:24: error: 'true' undeclared (first use in this function)
9 | while (true)
| ^~~~
main.c:1:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
+++ |+#include <stdbool.h>
1 | int main()
main.c:9:24: note: each undeclared identifier is reported only once for each function it appears in
9 | while (true)
| ^~~~
main.c:11:33: error: implicit declaration of function 'find' [-Wimplicit-function-declaration]
11 | int t = find(b, b+n, 0) - b;
| ^~~~
main.c:11:49: error: invalid operands to binary - (have 'int' and 'int *')
11 | int t = find(b, b+n, 0) - b;
| ~~~~~~~~~~~~~~~ ^
| | |
| int int *
main.c:13:33: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
13 | printf("%d ", b[i]);
| ^~~~~~
main.c:13:33: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:33: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:13:33: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
14 | printf("%d\n", b[t-1]);
| ^~~~~~
main.c:14:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:25:25: error: implicit declaration of function 'fill' [-Wimplicit-function-declaration]
25 | fill(b+u, b+n, 0);
| ^~~~
|
s697076920 | p00430 | C | int block[31];
void recur(int t, int b)
{
if (b == 0)
{
int i;
for (i = 0; block[i + 1]; ++i)
printf("%d ", block[i]);
printf("%d\n", block[i]);
return;
}
for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
{
block[t] = i;
recur(t + 1, b - i);
block[t] = 0;
}
}
int main()
{
int n;
while (scanf("%d", &n), n)
{
recur(0, n);
}
} | main.c: In function 'recur':
main.c:8:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
8 | printf("%d ", block[i]);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | int block[31];
main.c:8:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
8 | printf("%d ", block[i]);
| ^~~~~~
main.c:8:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:9:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
9 | printf("%d\n", block[i]);
| ^~~~~~
main.c:9:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:22: error: implicit declaration of function 'min' [-Wimplicit-function-declaration]
13 | for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
| ^~~
main.c: In function 'main':
main.c:23:16: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
23 | while (scanf("%d", &n), n)
| ^~~~~
main.c:23:16: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:16: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:23:16: note: include '<stdio.h>' or provide a declaration of 'scanf'
|
s219624812 | p00430 | C | int block[31], i;
void recur(int t, int b)
{
if (b == 0)
{
int i;
for (i = 0; block[i + 1]; ++i)
printf("%d ", block[i]);
printf("%d\n", block[i]);
return;
}
for (i = min(b, t ? block[t - 1] : 99); i > 0; --i)
{
block[t] = i;
recur(t + 1, b - i);
block[t] = 0;
}
}
int main()
{
int n;
while (scanf("%d", &n), n)
{
recur(0, n);
}
} | main.c: In function 'recur':
main.c:8:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
8 | printf("%d ", block[i]);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | int block[31], i;
main.c:8:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
8 | printf("%d ", block[i]);
| ^~~~~~
main.c:8:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:9:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
9 | printf("%d\n", block[i]);
| ^~~~~~
main.c:9:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:18: error: implicit declaration of function 'min' [-Wimplicit-function-declaration]
13 | for (i = min(b, t ? block[t - 1] : 99); i > 0; --i)
| ^~~
main.c: In function 'main':
main.c:23:16: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
23 | while (scanf("%d", &n), n)
| ^~~~~
main.c:23:16: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:16: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:23:16: note: include '<stdio.h>' or provide a declaration of 'scanf'
|
s933082404 | p00430 | C | #include <cstdio>
#include <algorithm>
int block[31];
void recur(int t, int b)
{
if (b == 0)
{
int i;
for (i = 0; block[i + 1]; ++i)
printf("%d ", block[i]);
printf("%d\n", block[i]);
return;
}
for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
{
block[t] = i;
recur(t + 1, b - i);
block[t] = 0;
}
}
int main()
{
int n;
while (scanf("%d", &n), n)
{
recur(0, n);
}
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s624700704 | p00430 | C | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);} | main.c:1:1: warning: data definition has no type or storage class
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:1:5: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
main.c: In function 'f':
main.c:1:7: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:7: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:7: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:59: error: implicit declaration of function 'elsefor' [-Wimplicit-function-declaration]
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~~~
main.c:1:70: error: expected ')' before ';' token
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ~ ^
| )
main.c:1:76: error: expected ';' before 'printf'
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~~
| ;
main.c: At top level:
main.c:1:109: error: return type defaults to 'int' [-Wimplicit-int]
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~
main.c: In function 'main':
main.c:1:109: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:122: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
main.c:1:122: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~
main.c:1:122: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c: At top level:
main.c:1:1: warning: array 't' assumed to have one element
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
|
s946378164 | p00430 | C | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);} | main.c:1:1: warning: data definition has no type or storage class
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:1:7: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
main.c:1:9: error: return type defaults to 'int' [-Wimplicit-int]
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
main.c: In function 'f':
main.c:1:9: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:9: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:9: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:61: error: implicit declaration of function 'elsefor' [-Wimplicit-function-declaration]
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~~~
main.c:1:72: error: expected ')' before ';' token
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ~ ^
| )
main.c:1:78: error: expected ';' before 'printf'
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~~
| ;
main.c: At top level:
main.c:1:111: error: return type defaults to 'int' [-Wimplicit-int]
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~
main.c: In function 'main':
main.c:1:111: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:124: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
main.c:1:124: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | t[99],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);elsefor(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^~~~~
main.c:1:124: note: include '<stdio.h>' or provide a declaration of 'scanf'
|
s056617120 | p00430 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
using namespace std;
void reset(int a[]){
rep(i,50){
a[i]=0;
}
}
void show(FILE *fp,int array[]){
int temp=0;
while(array[temp+1]!=0){
fprintf(outf,"%d ",array[temp]);
temp++;
}
fprintf(outf,"%d\n",array[temp]);
}
void dfs(FILE *fp,int *a){
show(fp,a);
if(a[1]==0||a[1]==1)
return;
int last = 0;
for(last = 0;a[last+1]!=0;last++);
if(a[last]!=1){
a[last]--;
a[++last]++;
dfs(fp,a);
}else{
for(int temp = last-1;temp >= 1;temp--){
if(a[temp]==2){
a[temp]=1;
a[++last]++;
dfs(fp,a);
break;
}else if(a[temp]>=3){
a[temp]--;
a[temp+1]++;
dfs(fp,a);
break;
}
}
}
return;
}
int main() {
FILE *inf;
FILE *outf;
if((inf=fopen("input.txt","r"))==NULL){
printf("error");return 0;}
if((outf=fopen("output.txt","w"))==NULL){
printf("oui");fclose(inf);return 0;}
int n;
int array[50];
while(fscanf(inf,"%d",&n),n!=0){
for(int now = n;now > 0;now--){
reset(array);
int temp = n;
int last = 0;
while(temp > now){
array[last]=now;
last++;
temp -= now;
}
array[last]=temp;
dfs(outf,array);
}}
fclose(inf);
fclose(outf);
return 2;
} | a.cc: In function 'void show(FILE*, int*)':
a.cc:15:17: error: 'outf' was not declared in this scope
15 | fprintf(outf,"%d ",array[temp]);
| ^~~~
a.cc:18:13: error: 'outf' was not declared in this scope
18 | fprintf(outf,"%d\n",array[temp]);
| ^~~~
|
s265264376 | p00430 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
using namespace std;
void reset(int a[]){
rep(i,50){
a[i]=0;
}
}
void show(FILE *fp,int array[]){
int temp=0;
while(array[temp+1]!=0){
fprintf(outf,"%d ",array[temp]);
temp++;
}
fprintf(outf,"%d\n",array[temp]);
}
void dfs(FILE *fp,int *a){
show(fp,a);
if(a[1]==0||a[1]==1)
return;
int last = 0;
for(last = 0;a[last+1]!=0;last++);
if(a[last]!=1){
a[last]--;
a[++last]++;
dfs(fp,a);
}else{
for(int temp = last-1;temp >= 1;temp--){
if(a[temp]==2){
a[temp]=1;
a[++last]++;
dfs(fp,a);
break;
}else if(a[temp]>=3){
a[temp]--;
a[temp+1]++;
dfs(fp,a);
break;
}
}
}
return;
}
int main() {
FILE *inf;
FILE *outf;
if((inf=fopen("input.txt","r"))==NULL){
printf("error");return 0;}
if((outf=fopen("output.txt","w"))==NULL){
printf("oui");fclose(inf);return 0;}
int n;
int array[50];
while(fscanf(inf,"%d",&n),n!=0){
for(int now = n;now > 0;now--){
reset(array);
int temp = n;
int last = 0;
while(temp > now){
array[last]=now;
last++;
temp -= now;
}
array[last]=temp;
dfs(outf,array);
}}
fclose(inf);
fclose(outf);
return 2;
} | a.cc: In function 'void show(FILE*, int*)':
a.cc:15:17: error: 'outf' was not declared in this scope
15 | fprintf(outf,"%d ",array[temp]);
| ^~~~
a.cc:18:13: error: 'outf' was not declared in this scope
18 | fprintf(outf,"%d\n",array[temp]);
| ^~~~
|
s498839508 | p00430 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
using namespace std;
void reset(int a[]){
rep(i,100){
a[i]=0;
}
}
void show(int array[]){
int temp=0;
while(array[temp+1]!=0||last<50){
printf("%d ",array[temp]);
temp++;
}
printf("%d\n",array[temp]);
}
void dfs(int *a){
show(a);
if(a[1]==0||a[1]==1)
return;
int last = 0;
for(last = 0;a[last+1]!=0||last<50;last++);
if(a[last]!=1){
a[last]--;
a[++last]++;
dfs(a);
}else{
for(int temp = last-1;temp >= 1;temp--){
if(a[temp]==2){
a[temp]=1;
a[++last]++;
dfs(a);
break;
}else if(a[temp]>=3){
a[temp]--;
a[temp+1]++;
dfs(a);
break;
}
}
}
return;
}
int main() {
int n;
int array[100];
while(scanf("%d",&n),n!=0){
for(int now = n;now > 0;now--){
reset(array);
int temp = n;
int last = 0;
while(temp > now){
array[last]=now;
last++;
temp -= now;
}
array[last]=temp;
dfs(array);
}}
return 2;
} | a.cc: In function 'void show(int*)':
a.cc:14:29: error: 'last' was not declared in this scope
14 | while(array[temp+1]!=0||last<50){
| ^~~~
|
s845035093 | p00430 | C++ | #include <iostream>
#include <vector>
using namespace std;
void saiki(vector<int> z,int ma,int nk){
if(nk==0) {
for(int i=0;i<z.size();i++) cout<<z[i]<<" ";
cout<<endl;
}
else if(ma*nk!=0){
for(int i=min(ma,nk);i>0;i--){
z.push_back(i);
saiki(z,i,nk-i);
z.pop_back();
}
}
}
int main() {
int n;
while(cin>>n)
if n==0 break;
vector<int> z;
cin>>n;
for(int i=n;i>0;i--){
z.push_back(i);
saiki(z,i,n-i);
z.pop_back();
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:4: error: expected '(' before 'n'
28 | if n==0 break;
| ^
| (
a.cc: At global scope:
a.cc:40:9: error: expected unqualified-id before 'return'
40 | return 0;
| ^~~~~~
a.cc:41:1: error: expected declaration before '}' token
41 | }
| ^
|
s471004816 | p00430 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
int num_data;
int *data;
int search_num;
int i;
int range_min, range_max, comp_num_array;
int num_of_comp=0;
while(1){
scanf("%d", &num_data);
if(num_data == 0)
return 0;
data = malloc(sizeof(int) * num_data);
for(i=0 ; i < num_data ; i++){
data[i] = 0;
}
for(i=0 ; i < num_data ; i++){
scanf("%d", &data[i]);
}
scanf("%d", &search_num);
range_min = 0;
range_max = num_data - 1;
while(1){
comp_num_array = (range_min + range_max) / 2;
num_of_comp++;
//??????????????¨????????????????????´
if(data[comp_num_array] == search_num){
printf("%d\n", num_of_comp);
break;
}
//????????????????????????1
else if(range_min == range_max){
printf("%d\n", num_of_comp);
break;
}
else if(data[comp_num_array] > search_num){
range_max = comp_num_array - 1;
}
else if(data[comp_num_array] < search_num){
range_min = comp_num_array + 1;
}
}
num_of_comp = 0;
free(data);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:30: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
18 | data = malloc(sizeof(int) * num_data);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
| |
| void*
|
s440612548 | p00430 | C++ | g#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;
#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
void pr(vector<int> output,int n, int sum,int m){
if(sum==n){
bool f = false;
REP(i,output.size()){
if(f) cout<<" ";
f = true;
cout<<output[i];
}
cout<<endl;
}
for(int i=min(n-sum,m); i>0; i--){
vector<int> tmp;
tmp = output;
tmp.push_back(i);
pr(tmp,n,sum+i,i);
}
}
int main(void){
int n;
while(cin>>n){
if(n==0) break;
vector<int> emp;
pr(emp,n,0,n);
}
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | g#include <cstdio>
| ^
a.cc:1:1: error: 'g' does not name a type
1 | g#include <cstdio>
| ^
In file included from /usr/include/c++/14/cmath:45,
from a.cc:3:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/stdlib.h:32,
from /usr/include/c++/14/cstdlib:79,
from a.cc:2:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
from /usr/include/c++/14/bits/stl_alg |
s116555371 | p00430 | C++ | #include <stdio.h>
#include <windows.h>
int box[30] = { 0 };
void print(){
int j=0;
while(box[j]>=1 && box[j]<=100){
printf("%d ",box[j]);
j++;
}
puts("");
}
void func(int m){
int now,i,j;
bool flg=1;
while(flg){
flg=0;
for(i=1;i<30;i++){
if(box[i-1]<box[i]){
box[i+1]++;
box[i]--;
}
}
print();
for(i=29;i>=1;i--){
if(box[i]>=2){
flg=1;
box[i]--;
box[i+1]++;
break;
}
}
j=0;
if(box[0]==0)return;
}
}
int main(void)
{
int n,kazu,i,j,count;
while(scanf("%d",&n),n){
box[0]=n;
for(i=2;i<n;i++){
box[0]--;
kazu=30/box[0];
for(j=1;j<kazu+1;j++){
box[j]=box[0];
}
count = 0;
for(j=0;j<30;j++){
count += box[j];
}
count-=n;
for(j=29;j>=0;j--){
while(box[j]!=0){
box[j]--;
count--;
if(count==0)break;
}
if(count==0)break;
}
func(box[0]);
if(i!=n-1){
for(j=2;j<30;j++){
box[j]=0;
}
}
}
j=0;
while(j<n){
printf("1 ");
j++;
}
puts("");
}
return 0;
} | a.cc:2:10: fatal error: windows.h: No such file or directory
2 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s302250823 | p00430 | C++ | #include<cstdio>
#include<vector>
using namespace std;
int main(void){
vector<vector<int> > kek[31];
vector<int> hn;
vector<int> u;
while(1){
int n;
scanf("%d",&n);
if(n==0){break;}
for(int i=0;i<31;i++){
kik[i].clear();
}
for(int i=1;i<=n;i++){
hn.clear();
hn.push_back(i);
kek[i].push_back(hn);
for(int j=i-1;j>0;j--){
for(int k=0;k<kek[i-j].size();k++){
int flg=0;
for(int p=0;p<kek[i-j][k].size();p++){
if(kek[i-j][k][p]>j){
flg=1;
break;
}
}
if(flg==1){
continue;
}
u.clear();
u.push_back(j);
for(int p=0;p<kek[i-j][k].size();p++){
u.push_back(kek[i-j][k][p]);
}
kek[i].push_back(u);
}
}
}
for(int j=0;j<kek[n].size();j++){
printf("%d",kek[n][j][0]);
for(int k=1;k<kek[n][j].size();k++){
printf(" %d",kek[n][j][k]);
}
puts("");
}
}
} | a.cc: In function 'int main()':
a.cc:16:25: error: 'kik' was not declared in this scope; did you mean 'kek'?
16 | kik[i].clear();
| ^~~
| kek
|
s790008814 | p00430 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <list>
using namespace std;
list<string> ans;
int main(void)
{
list<string> pat[31];
list<string>::iterator it;
int n;
char str[100];
pat[0].push_back("");
pat[1].push_back("1");
for (int i = 2; i <= 30; i++){
for (int j = 0; j < i; j++){
sprintf(str, "%d ", i - j);
for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
for (; it != pat[j].end(); ++it){
pat[i].push_back(str + *it);
}
}
}
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
printf("%s\n", it->c_str());
}
}
return (0);
} | a.cc:7:6: error: 'string' was not declared in this scope
7 | list<string> ans;
| ^~~~~~
a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
3 | #include <list>
+++ |+#include <string>
4 |
a.cc:7:12: error: template argument 1 is invalid
7 | list<string> ans;
| ^
a.cc:7:12: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:11:14: error: 'string' was not declared in this scope
11 | list<string> pat[31];
| ^~~~~~
a.cc:11:14: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:11:20: error: template argument 1 is invalid
11 | list<string> pat[31];
| ^
a.cc:11:20: error: template argument 2 is invalid
a.cc:12:20: error: template argument 2 is invalid
12 | list<string>::iterator it;
| ^
a.cc:12:32: error: expected initializer before 'it'
12 | list<string>::iterator it;
| ^~
a.cc:16:16: error: request for member 'push_back' in 'pat[0]', which is of non-class type 'int'
16 | pat[0].push_back("");
| ^~~~~~~~~
a.cc:17:24: error: request for member 'push_back' in 'pat[1]', which is of non-class type 'int'
17 | pat[1].push_back("1");
| ^~~~~~~~~
a.cc:22:30: error: 'it' was not declared in this scope; did you mean 'i'?
22 | for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
| ^~
| i
a.cc:22:42: error: request for member 'begin' in 'pat[j]', which is of non-class type 'int'
22 | for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
| ^~~~~
a.cc:22:64: error: request for member 'end' in 'pat[j]', which is of non-class type 'int'
22 | for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
| ^~~
a.cc:23:32: error: 'it' was not declared in this scope; did you mean 'i'?
23 | for (; it != pat[j].end(); ++it){
| ^~
| i
a.cc:23:45: error: request for member 'end' in 'pat[j]', which is of non-class type 'int'
23 | for (; it != pat[j].end(); ++it){
| ^~~
a.cc:24:40: error: request for member 'push_back' in 'pat[i]', which is of non-class type 'int'
24 | pat[i].push_back(str + *it);
| ^~~~~~~~~
a.cc:37:33: error: template argument 2 is invalid
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^
a.cc:37:44: error: expected ';' before 'it'
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~~
| ;
a.cc:37:45: error: 'it' was not declared in this scope; did you mean 'int'?
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~
| int
a.cc:37:57: error: request for member 'begin' in 'pat[n]', which is of non-class type 'int'
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~~~~
a.cc:37:79: error: request for member 'end' in 'pat[n]', which is of non-class type 'int'
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~~
a.cc:37:84: error: expected ')' before ';' token
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ~ ^
| )
a.cc:37:88: error: 'it' was not declared in this scope; did you mean 'int'?
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~
| int
|
s658259318 | p00430 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <list>
using namespace std;
list<string> ans;
int main(void)
{
list<string> pat[31];
list<string>::iterator it;
int n;
char str[100];
pat[0].push_back("");
pat[1].push_back("1");
for (int i = 2; i <= 30; i++){
for (int j = 0; j < i; j++){
sprintf(str, "%d ", i - j);
for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
for (; it != pat[j].end(); ++it){
pat[i].push_back(str + *it);
}
}
}
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
printf("%s\n", it->c_str());
}
}
return (0);
} | a.cc:7:6: error: 'string' was not declared in this scope
7 | list<string> ans;
| ^~~~~~
a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
3 | #include <list>
+++ |+#include <string>
4 |
a.cc:7:12: error: template argument 1 is invalid
7 | list<string> ans;
| ^
a.cc:7:12: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:11:14: error: 'string' was not declared in this scope
11 | list<string> pat[31];
| ^~~~~~
a.cc:11:14: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:11:20: error: template argument 1 is invalid
11 | list<string> pat[31];
| ^
a.cc:11:20: error: template argument 2 is invalid
a.cc:12:20: error: template argument 2 is invalid
12 | list<string>::iterator it;
| ^
a.cc:12:32: error: expected initializer before 'it'
12 | list<string>::iterator it;
| ^~
a.cc:16:16: error: request for member 'push_back' in 'pat[0]', which is of non-class type 'int'
16 | pat[0].push_back("");
| ^~~~~~~~~
a.cc:17:16: error: request for member 'push_back' in 'pat[1]', which is of non-class type 'int'
17 | pat[1].push_back("1");
| ^~~~~~~~~
a.cc:22:30: error: 'it' was not declared in this scope; did you mean 'i'?
22 | for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
| ^~
| i
a.cc:22:42: error: request for member 'begin' in 'pat[j]', which is of non-class type 'int'
22 | for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
| ^~~~~
a.cc:22:64: error: request for member 'end' in 'pat[j]', which is of non-class type 'int'
22 | for (it = pat[j].begin(); it != pat[j].end() && atoi(it->c_str()) > i - j; ++it);
| ^~~
a.cc:23:32: error: 'it' was not declared in this scope; did you mean 'i'?
23 | for (; it != pat[j].end(); ++it){
| ^~
| i
a.cc:23:45: error: request for member 'end' in 'pat[j]', which is of non-class type 'int'
23 | for (; it != pat[j].end(); ++it){
| ^~~
a.cc:24:40: error: request for member 'push_back' in 'pat[i]', which is of non-class type 'int'
24 | pat[i].push_back(str + *it);
| ^~~~~~~~~
a.cc:37:33: error: template argument 2 is invalid
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^
a.cc:37:44: error: expected ';' before 'it'
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~~
| ;
a.cc:37:45: error: 'it' was not declared in this scope; did you mean 'int'?
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~
| int
a.cc:37:57: error: request for member 'begin' in 'pat[n]', which is of non-class type 'int'
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~~~~
a.cc:37:79: error: request for member 'end' in 'pat[n]', which is of non-class type 'int'
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~~
a.cc:37:84: error: expected ')' before ';' token
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ~ ^
| )
a.cc:37:88: error: 'it' was not declared in this scope; did you mean 'int'?
37 | for (list<string>::iterator it = pat[n].begin(); it != pat[n].end(); ++it){
| ^~
| int
|
s115951752 | p00430 | C++ | #include <cstdio>
#include <string>
#include <algorithm>
int main()
{
int n;
while (scanf("%d", &n), n)
{
int b[31];
memset(b, 0, sizeof(b));
b[0] = n;
while (true)
{
int t = find(b, b+n, 0) - b;
for (int i = 0; i < t-1; ++i)
printf("%d ", b[i]);
printf("%d\n", b[t-1]);
if (t == n)
break;
int u;
u = t-1;
while (b[u] == 1)
--u;
--b[u];
++u;
fill(b+u, b+n, 0);
int s = t - u + 1;
while (s--)
{
if (b[u] == b[u-1])
++u;
++b[u];
}
}
}
} | a.cc: In function 'int main()':
a.cc:10:17: error: 'memset' was not declared in this scope
10 | memset(b, 0, sizeof(b));
| ^~~~~~
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 | int main()
a.cc:14:33: error: 'find' was not declared in this scope; did you mean 'std::find'?
14 | int t = find(b, b+n, 0) - b;
| ^~~~
| std::find
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: 'std::find' declared here
60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
a.cc:28:25: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
28 | fill(b+u, b+n, 0);
| ^~~~
| std::fill
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
|
s402964029 | p00430 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
int main()
{
int n;
while (scanf("%d", &n), n)
{
int b[31];
memset(b, 0, sizeof(b));
b[0] = n;
while (true)
{
int t = find(b, b+n, 0) - b;
for (int i = 0; i < t-1; ++i)
printf("%d ", b[i]);
printf("%d\n", b[t-1]);
if (t == n)
break;
int u;
u = t-1;
while (b[u] == 1)
--u;
--b[u];
++u;
fill(b+u, b+n, 0);
int s = t - u + 1;
while (s--)
{
if (b[u] == b[u-1])
++u;
++b[u];
}
}
}
} | a.cc: In function 'int main()':
a.cc:14:33: error: 'find' was not declared in this scope; did you mean 'std::find'?
14 | int t = find(b, b+n, 0) - b;
| ^~~~
| std::find
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: 'std::find' declared here
60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
a.cc:28:25: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
28 | fill(b+u, b+n, 0);
| ^~~~
| std::fill
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
|
s138183565 | p00430 | C++ | #include <cstdio>
#include <algorithm>
int block[31];
void recur(int t, int b)
{
if (b == 0)
{
int i;
for (i = 0; block[i + 1]; ++i)
printf("%d ", block[i]);
printf("%d\n", block[i]);
return;
}
for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
{
block[t] = i;
recur(t + 1, b - i);
block[t] = 0;
}
}
int main()
{
int n;
while (scanf("%d", &n), n)
{
recur(0, n);
}
} | a.cc: In function 'void recur(int, int)':
a.cc:15:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
15 | for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
| ^~~
| std::min
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s367837833 | p00430 | C++ | #include <iostream>
#include <vector>
#include <vector>
using namespace std;
int main(void)
{
int n;
while (cin >> n, n){
vector <int> v(30);
fill(v.begin(), v.end(), 0);
v[0] = n;
cout << v[0] << endl;
while ((count(v.begin(), v.end(), 1)) != n){
int s = 0;
for (int i = 0; i < v.size() && 0 < v[i]; i++){
s++;
}
int i = s - 1;
for (; 0 <= i; i--){
if (v[i] != 1){
break;
}
}
if (v[i] == 2){
v[i]--;
v[s] = 1;
}
else {
v[i]--;
v[i + 1]++;
}
if (v[i + 1] == 1) s++;
for (int i = 0; i < s; i++){
cout << v[i];
if (i + 1 == s) puts("");
else cout << " ";
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:25: error: 'count' was not declared in this scope
14 | while ((count(v.begin(), v.end(), 1)) != n){
| ^~~~~
|
s778022813 | p00430 | C++ | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);} | a.cc:1:1: error: 't' does not name a type
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
a.cc:1:8: error: expected constructor, destructor, or type conversion before '(' token
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
a.cc:1:114: error: expected constructor, destructor, or type conversion before '(' token
1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
| ^
|
s790789838 | p00430 | C++ | #include<iostream>
#include<string>
#include<boost/lexical_cast.hpp>
using namespace std;
int main(){
while(1){
int n;
cin >> n;
if(n == 0) break;
string s;
cin >> s;
for(int i = 0;i < n;i++){
string ans;
for(int j = 0;j < s.length();j++){
size_t k = j;
while(s[k] == s[j] && k < s.length()) k++;
ans += boost::lexical_cast<string>(k - j) + s[j];
j += (k - j) - 1;
}
s = ans;
}
cout << s << endl;
}
return 0;
} | a.cc:3:9: fatal error: boost/lexical_cast.hpp: No such file or directory
3 | #include<boost/lexical_cast.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s353059734 | p00430 | C++ | #include <cstdio>
int saikii(int *zi,int zisu,int zan);
int main(void){
int n=0;
//while(1){
scanf("%d",&n);
if(n==0)break;
int wat[20]={0};
saikii(wat,0,n);
//}
return 0;
}
int saikii(int *zi,int zisu,int zan){
int i=0;
printf("%d\x0020",zan);
for(i=zisu-1;i>-1;i--){
printf("%d\x0020",zi[i]);
}
printf("\n");
if(zan!=1){
for(i=1;i<zan;i++){
zi[zisu]=i;
saikii(zi,zisu+1,zan-i);
zi[zisu]=0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:13: error: break statement not within loop or switch
9 | if(n==0)break;
| ^~~~~
|
s072980835 | p00430 | C++ | #include <cstdio>
int saikii(int *zi,int zisu,int zan);
int main(void){
int n=0;
/*while(1){*/
scanf("%d",&n);
if(n==0)break;
int wat[20]={0};
saikii(wat,0,n);
/*}*/
return 0;
}
int saikii(int *zi,int zisu,int zan){
int i=0;
printf("%d\x0020",zan);
for(i=zisu-1;i>-1;i--){
printf("%d\x0020",zi[i]);
}
printf("\n");
if(zan!=1){
for(i=1;i<zan;i++){
zi[zisu]=i;
saikii(zi,zisu+1,zan-i);
zi[zisu]=0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:13: error: break statement not within loop or switch
9 | if(n==0)break;
| ^~~~~
|
s418638834 | p00430 | C++ | #include <cstdio>
int saikii(int *zi,int zisu,int zan);
int main(void){
int n=0;
scanf("%d",&n);
if(n==0)break;
int wat[20]={0};
saikii(wat,0,n);
return 0;
}
int saikii(int *zi,int zisu,int zan){
int i=0;
printf("%d\x0020",zan);
for(i=zisu-1;i>-1;i--){
printf("%d\x0020",zi[i]);
}
printf("\n");
if(zan!=1){
for(i=1;i<zan;i++){
zi[zisu]=i;
saikii(zi,zisu+1,zan-i);
zi[zisu]=0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:13: error: break statement not within loop or switch
9 | if(n==0)break;
| ^~~~~
|
s212523282 | p00430 | C++ | #include<iostream>
int res[50];
void calc(int a, int b){
if (a == 0){
for (int i = 1; i < b; i++)std::cout << res[i] << " ";
std::cout << std::endl;
return;
}
for (int i = a; i >= 1; i--){
if (res[b - 1] >= i){
res[b] = i;
calc(a - i, b + 1);
}
}
return;
}
int main(){
int n;
while (std::cin >> n, n){
memset(res, 0, sizeof(res));
res[0] = 10000000;
calc(n, 1);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:17: error: 'memset' was not declared in this scope
25 | memset(res, 0, sizeof(res));
| ^~~~~~
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 |
|
s952342186 | p00431 | Java | import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args){
ArrayList<Integer> result=new ArrayList<Integer>();
try{
BufferedReader fin=new BufferedReader(new FileReader("input.txt"));
while(true){
String sc=fin.readLine();
int n=Integer.parseInt(sc);
if(n==0)break;
//System.out.println(n);
int sub=0;
int[][] data=new int[n][2];
Reflexive r=new Reflexive();
r.getmax(1);
for(int i=0;i<n;i++){
sub=Integer.parseInt(fin.readLine());
// System.out.println(sub);
data[i][0]=(sub-(sub%10))/10;
data[i][1]=sub%10;
//System.out.println(""+data[i][0]+""+data[i][1]);
}
for(int i=0;i<n;i++){
ArrayList<Integer> l=new ArrayList<Integer>();
l.add(i);
r.ref(n,l,data[i][0],data[i][1],data,i);
r.ref(n,l,data[i][1],data[i][0],data,i);
}
result.add(r.getmax());
//System.out.println(" "+r.getmax());
}
fin.close();
}catch(Exception e){
System.out.println(e);
}
try{
PrintWriter fout=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
for(int i=0;i<result.size();i++){
fout.println(result.get(i));
}
fout.close();
}catch(Exception e){
System.exit(1);
}
}}
public class Reflexive{
private int max=0;
public int ref(int num,ArrayList<Integer> flll,int front,int rear,int[][] data,int now){
if(num==max||front==rear)return 0;
for(int i=0;i<num;i++){
if(now==i||flll.indexOf(i)!=-1)continue;
if(front==data[i][1]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,rear,data[i][0],data,now);
flll.remove(flll.indexOf(i));
}
if(rear==data[i][1]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,front,data[i][0],data,now);
flll.remove(flll.indexOf(i));
}
if(front==data[i][0]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,rear,data[i][1],data,now);
flll.remove(flll.indexOf(i));
}
if(rear==data[i][0]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,front,data[i][1],data,now);
flll.remove(flll.indexOf(i));
}
}
return 0;
}
public int maxjd(ArrayList<Integer> flll,int[][] data,int front,int rear){
ArrayList<Integer> l=new ArrayList<Integer>();
for(int i=0;i<flll.size();i++){
l.add(data[flll.get(i)][0]);
l.add(data[flll.get(i)][1]);
}
for(int i=0;i<l.size();i++){
int count=0;
for(int j=0;j<l.size();j++){
if(i!=j&&l.get(i)==l.get(j))count++;
}
if(count>=2&&front==l.get(i))return 0;
if(count>=2&&rear==l.get(i))return 0;
}
if(flll.size()>max){
max=flll.size();
/* for(int i=0;i<l.size();i++){
System.out.print(""+l.get(i)+" ");
}
System.out.println("");*/
}
return 0;
}
public void getmax(int x){
max=x;
}
public int getmax(){
return max;
}
} | Main.java:52: error: class Reflexive is public, should be declared in a file named Reflexive.java
public class Reflexive{
^
1 error
|
s447043137 | p00431 | Java | import java.util.*;
import java.io.*;
class StringwithRing{
public static void main(String[] args){
ArrayList<Integer> result=new ArrayList<Integer>();
try{
BufferedReader fin=new BufferedReader(new FileReader("input.txt"));
while(true){
String sc=fin.readLine();
int n=Integer.parseInt(sc);
if(n==0)break;
//System.out.println(n);
int sub=0;
int[][] data=new int[n][2];
Reflexive r=new Reflexive();
r.getmax(1);
for(int i=0;i<n;i++){
sub=Integer.parseInt(fin.readLine());
// System.out.println(sub);
data[i][0]=(sub-(sub%10))/10;
data[i][1]=sub%10;
//System.out.println(""+data[i][0]+""+data[i][1]);
}
for(int i=0;i<n;i++){
ArrayList<Integer> l=new ArrayList<Integer>();
l.add(i);
r.ref(n,l,data[i][0],data[i][1],data,i);
r.ref(n,l,data[i][1],data[i][0],data,i);
}
result.add(r.getmax());
//System.out.println(" "+r.getmax());
}
fin.close();
}catch(Exception e){
System.out.println(e);
}
try{
PrintWriter fout=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
for(int i=0;i<result.size();i++){
fout.println(result.get(i));
}
fout.close();
}catch(Exception e){
System.exit(1);
}
}
class Reflexive{
private int max=0;
public int ref(int num,ArrayList<Integer> flll,int front,int rear,int[][] data,int now){
if(num==max||front==rear)return 0;
for(int i=0;i<num;i++){
if(now==i||flll.indexOf(i)!=-1)continue;
if(front==data[i][1]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,rear,data[i][0],data,now);
flll.remove(flll.indexOf(i));
}
if(rear==data[i][1]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,front,data[i][0],data,now);
flll.remove(flll.indexOf(i));
}
if(front==data[i][0]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,rear,data[i][1],data,now);
flll.remove(flll.indexOf(i));
}
if(rear==data[i][0]){
flll.add(i);
maxjd(flll,data,front,rear);
ref(num,flll,front,data[i][1],data,now);
flll.remove(flll.indexOf(i));
}
}
return 0;
}
public int maxjd(ArrayList<Integer> flll,int[][] data,int front,int rear){
ArrayList<Integer> l=new ArrayList<Integer>();
for(int i=0;i<flll.size();i++){
l.add(data[flll.get(i)][0]);
l.add(data[flll.get(i)][1]);
}
for(int i=0;i<l.size();i++){
int count=0;
for(int j=0;j<l.size();j++){
if(i!=j&&l.get(i)==l.get(j))count++;
}
if(count>=2&&front==l.get(i))return 0;
if(count>=2&&rear==l.get(i))return 0;
}
if(flll.size()>max){
max=flll.size();
/* for(int i=0;i<l.size();i++){
System.out.print(""+l.get(i)+" ");
}
System.out.println("");*/
}
return 0;
}
public void getmax(int x){
max=x;
}
public int getmax(){
return max;
}
} | Main.java:121: error: reached end of file while parsing
}
^
1 error
|
s479350328 | p00431 | Java | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
public static void main (String[] args) throws java.lang.Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
while(true){
Ring.ringList = new HashMap<Integer,Ring>();
int n = Integer.parseInt(line);
if(n==0){
break;
}
for(int i=0;i<n;i++){
String[] lines = br.readLine().split(" ");
Ring a = Ring.getRing(Integer.parseInt(lines[0]));
Ring b = Ring.getRing(Integer.parseInt(lines[1]));
a.addNext(b);
b.addNext(a);
}
int ans = 0;
for(int key:Ring.getSeachRing()){
ans = Math.max(ans,calc(Ring.ringList.get(key)));
}
System.out.println(ans);
line = br.readLine();
}
}
private static int calc(Ring start){
int max = 0;
Route route = new Route();
route.use(start);
Stack<Route> stack = new Stack<Route>();
stack.push(route);
while(!stack.isEmpty()){
route = stack.pop();
max = Math.max(max,route.cnt);
ArrayList<Ring> next = route.lastLing.getNext();
for(Ring ring:next){
if(route.isUsable(ring)){
Route n_route = route.clone();
n_route.use(ring);
stack.push(n_route);
}
}
}
return max;
}
private static class Route{
int cnt = 0;
HashMap<Integer,Boolean> used = new HashMap<Integer,Boolean>();
public Ring lastLing;
public boolean isUsable(Ring ring){
return !used.containsKey(ring.idx);
}
public void use(Ring ring){
used.put(ring.idx,true);
lastLing = ring;
cnt++;
}
public Route clone(){
Route route = new Route();
route.cnt = this.cnt;
route.lastLing = this.lastLing;
for(int idx:this.used.keySet()){
route.used.put(idx,true);
}
return route;
}
}
private static class Ring{
static HashMap<Integer,Ring> ringList = new HashMap<Integer,Ring>();
public int idx;
public ArrayList<Ring> next = new ArrayList<Ring>();
public Ring(int idx){
this.idx = idx;
}
public void addNext(Ring n){
next.add(n);
}
public ArrayList<Ring> getNext(){
return next;
}
public static Ring getRing(int idx){
Ring ret;
if(ringList.containsKey(idx)){
ret = ringList.get(idx);
}else{
ret = new Ring(idx);
ringList.put(idx,ret);
}
return ret;
}
public static ArrayList<Ring> getSeachRing(){
ArrayList<Ring> ret = new ArrayList<Ring>();
for(Ring ring:ringList){
if(ring.next.size()<=2){
ret.add(ring);
}
}
return ret;
}
}
} | Main.java:25: error: incompatible types: Ring cannot be converted to int
for(int key:Ring.getSeachRing()){
^
Main.java:106: error: for-each not applicable to expression type
for(Ring ring:ringList){
^
required: array or java.lang.Iterable
found: HashMap<Integer,Ring>
2 errors
|
s596666923 | p00431 | C | #include<stdio.h>
int n;
int c[100][2];
int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
int i;
int prol,nowl;
prol = nowl = l;
for(i=0;i<n;i++){
if(c[i][0]==e && done[c[i][1]-1]==0){
prol = chain(c[i][1],nowl+1);
done[c[i][1]-1] = 1;
}
if(c[i][1]==e && done[c[i][0]-1]==0){
prol = chain(c[i][0],nowl+1);
done[c[i][0]-1] = 1;
}
if(prol>l){
l = prol;
}
}
return l;
}
main(){
int i;
int done;
int ans,preans;
while(scanf("%d",&n)!=0){
for(i=0;i<n;i++){
scanf("%d %d",&c[i][0],&c[i][1]);
}
for(i=0;i<100;i++){
done[i]=0;
}
ans = 0;
for(i=1;i<=100;i++){
preans = chain(i,0,done);
if(preans>ans){
ans = preans;
}
}
printf("%d\n",ans);
}
} | main.c: In function 'chain':
main.c:11:14: error: too few arguments to function 'chain'
11 | prol = chain(c[i][1],nowl+1);
| ^~~~~
main.c:5:5: note: declared here
5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
| ^~~~~
main.c:15:14: error: too few arguments to function 'chain'
15 | prol = chain(c[i][0],nowl+1);
| ^~~~~
main.c:5:5: note: declared here
5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
| ^~~~~
main.c: At top level:
main.c:25:1: error: return type defaults to 'int' [-Wimplicit-int]
25 | main(){
| ^~~~
main.c: In function 'main':
main.c:34:11: error: subscripted value is neither array nor pointer nor vector
34 | done[i]=0;
| ^
main.c:38:26: error: passing argument 3 of 'chain' makes pointer from integer without a cast [-Wint-conversion]
38 | preans = chain(i,0,done);
| ^~~~
| |
| int
main.c:5:27: note: expected 'int *' but argument is of type 'int'
5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
| ~~~~^~~~~~
|
s004313537 | p00431 | C | #include<stdio.h>
int n;
int c[100][2];
int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
int i;
int prol,nowl;
prol = nowl = l;
for(i=0;i<n;i++){
if(c[i][0]==e && done[c[i][1]-1]==0){
prol = chain(c[i][1],nowl+1);
done[c[i][1]-1] = 1;
}
if(c[i][1]==e && done[c[i][0]-1]==0){
prol = chain(c[i][0],nowl+1);
done[c[i][0]-1] = 1;
}
if(prol>l){
l = prol;
}
}
return l;
}
main(){
int i;
int done[100];
int ans,preans;
while(scanf("%d",&n)!=0){
for(i=0;i<n;i++){
scanf("%d %d",&c[i][0],&c[i][1]);
}
for(i=0;i<100;i++){
done[i]=0;
}
ans = 0;
for(i=1;i<=100;i++){
preans = chain(i,0,done);
if(preans>ans){
ans = preans;
}
}
printf("%d\n",ans);
}
} | main.c: In function 'chain':
main.c:11:14: error: too few arguments to function 'chain'
11 | prol = chain(c[i][1],nowl+1);
| ^~~~~
main.c:5:5: note: declared here
5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
| ^~~~~
main.c:15:14: error: too few arguments to function 'chain'
15 | prol = chain(c[i][0],nowl+1);
| ^~~~~
main.c:5:5: note: declared here
5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
| ^~~~~
main.c: At top level:
main.c:25:1: error: return type defaults to 'int' [-Wimplicit-int]
25 | main(){
| ^~~~
|
s277687707 | p00431 | C | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,G[100][100];
int D[100];
int size(int m)
{
int r=1;
for(int i=0;i<100;i++){
if(G[m][i]&&!D[i]){
D[i]=1;
r=max(r,1+size(i));
D[i]=0;
}
}
return r;
}
int main()
{
while(scanf("%d",&n),n){
int r=0;
memset(G,0,sizeof(G));
while(n--){
int a,b;
scanf("%d%d",&a,&b);
G[a-1][b-1]=G[b-1][a-1]=1;
}
for(int i=0;i<100;i++){
memset(D,0,sizeof(D));
D[i]=1;
r=max(r,size(i));
D[i]=0;
}
printf("%d\n",r);
}
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s216137292 | p00431 | C | #include<stdio.h>
#include<string.h>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
int neib[101][200];
int used[101];
int onceused[101];
int dfs(int x){
int i;
used[x] = 1;
onceused[x] = 1;
int res = 1;
for(i = 1;i <= neib[x][0];i++){
if(used[neib[x][i]] == 0){
int tmp = dfs(neib[x][i]);
res = max(res, 1 + tmp);
}
}
used[x] = 0;
return res;
}
int main(){
int i, j;
while(1){
int n, ans = 0;
rings[0] = 0;
for(i = 0;i < 101;i++)neib[i][0] = 0;
scanf("%d", &n);
if(n == 0)return 0;
for(i = 0;i < n;i++){
int a, b;
scanf("%d%d", &a, &b);
rings[++rings[0]] = a;
rings[++rings[0]] = b;
neib[a][++neib[a][0]] = b;
neib[b][++neib[b][0]] = a;
}
memset(onceused, 0, sizeof(onceused));
memset(used, 0, sizeof(used));
for(i = 1;i < 101;i++){
for(j = 1;j <= rings[0];j++){
if(neib[rings[j]][0] == i){
int tmp = dfs(rings[j]);
ans = max(ans,tmp);
}
}
int fin = 1;
for(j = 1;j <= rings[0];j++){
if(onceused[rings[j]] == 0){
fin = 0;
break;
}
}
if(fin)break;
}
printf("%d\n",ans);
}
} | main.c: In function 'main':
main.c:30:5: error: 'rings' undeclared (first use in this function)
30 | rings[0] = 0;
| ^~~~~
main.c:30:5: note: each undeclared identifier is reported only once for each function it appears in
|
s171002810 | p00431 | C++ |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
#define MAX 110
using namespace std;
vector<int> G[MAX];
bool flag[MAX];
int dfs(int now){
flag[now]=1;
int ret = 1;
rep(i,G[now].size()){
if(flag[G[now][i]]==0)
ret = max(ret,dfs(G[now][i])+1);
}
flag[now]=0;
return ret;
}
int main() {
int n;
while(scanf("%d",&n),n!=0){
rep(i,MAX){
G[i].clear();
flag[i]=0;
}
int x,y;
rep(i,n){
scanf("%d %d",&x,&y);
x--;
y--;
G[x].push_back(y);
G[y].push_back(x);
}
rep(i,MAX){
if(G[i].empty())
break;
sort(G[i].begin(),G[i].end());
G[i].erase(unique(G[i].begin(),G[i].end()),G[i].end());
}
int ret = 0;
rep(i,MAX){
ret = max(ret,dfs(i));
}
printf("%d\n",ret);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:41:13: error: 'sort' was not declared in this scope; did you mean 'short'?
41 | sort(G[i].begin(),G[i].end());
| ^~~~
| short
a.cc:42:24: error: 'unique' was not declared in this scope
42 | G[i].erase(unique(G[i].begin(),G[i].end()),G[i].end());
| ^~~~~~
|
s498128236 | p00431 | C++ | import Control.Monad (replicateM)
import Data.Array (Array,array,(!),bounds)
main = do
n <- readLn
if n == 0 then return () else do
ps <- replicateM n (getLine >>= return . (\[a,b]->(a,b)) . map read . words)
print $ maxLength $ strings ps
main
type Strings = Array Int [Int]
strings :: [(Int,Int)] -> Strings
strings ps = array (b0,b1) [(i,otherside i)|i<-[b0..b1]]
where
otherside a = [b|(a',b)<-ps,a'==a] ++ [b|(b,a')<-ps,a'==a]
b0 = min (minimum (map fst ps)) (minimum (map snd ps))
b1 = max (maximum (map fst ps)) (maximum (map snd ps))
maxLength strings = maxLength' initChain 1
where
(b0,b1) = bounds strings
initChain = [[i]|i<-[b0..b1], length (strings!i) > 0]
maxLength' [] n = n-1
maxLength' chains n = maxLength' (chains >>= augment strings) (n+1)
augment strings chain = map (:chain) newRings
where
newRings = filter (not . (`elem` chain)) (strings ! (head chain)) | a.cc:7:51: error: stray '\' in program
7 | ps <- replicateM n (getLine >>= return . (\[a,b]->(a,b)) . map read . words)
| ^
a.cc:16:24: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
16 | otherside a = [b|(a',b)<-ps,a'==a] ++ [b|(b,a')<-ps,a'==a]
| ^~~~~~~~~~~
a.cc:16:50: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
16 | otherside a = [b|(a',b)<-ps,a'==a] ++ [b|(b,a')<-ps,a'==a]
| ^~~~~~~~~
a.cc:20:30: warning: missing terminating ' character
20 | maxLength strings = maxLength' initChain 1
| ^
a.cc:20:30: error: missing terminating ' character
20 | maxLength strings = maxLength' initChain 1
| ^~~~~~~~~~~~~
a.cc:25:14: warning: missing terminating ' character
25 | maxLength' [] n = n-1
| ^
a.cc:25:14: error: missing terminating ' character
25 | maxLength' [] n = n-1
| ^~~~~~~~~~~~~~~~
a.cc:26:14: warning: multi-character literal with 21 characters exceeds 'int' size of 4 bytes
26 | maxLength' chains n = maxLength' (chains >>= augment strings) (n+1)
| ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:35: error: stray '`' in program
30 | newRings = filter (not . (`elem` chain)) (strings ! (head chain))
| ^
a.cc:30:40: error: stray '`' in program
30 | newRings = filter (not . (`elem` chain)) (strings ! (head chain))
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import Control.Monad (replicateM)
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s051898877 | p00431 | C++ | #include <stdio.h>
#define N 101
int find_length(int a, int cur_length);
int conn[N][N];
int used[N];
int main()
{
int i, j;
int a, b;
int n;
int max_length, length;
while(1)
{
for(j = 0; j < N; j++)
{
for(i = 0; i < N; i++)
{
conn[j][i] = 0;
}
}
scanf("%d", &n);
if (n == 0)
{
break;
}
for(int i = 0; i < n; i++)
{
scanf("%d %d", &a, &b);
conn[a][b] = 1;
conn[b][a] = 1;
}
for(a = 0; a < N; a++)
{
used[a] = 0;
}
max_length = 0;
for(a = 0; a < N; a++)
{
length = find_length(a, 1);
if (length > max_length)
{
max_length = length;
}
}
printf("%d\n", max_length);
}
} | /usr/bin/ld: /tmp/ccNi3rcs.o: in function `main':
a.cc:(.text+0x1a2): undefined reference to `find_length(int, int)'
collect2: error: ld returned 1 exit status
|
s399385765 | p00431 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<vector<int> > G;
vector<bool> used;
int rec(int pos)
{
used[pos] = true; int ret = 1;
for(int i = 0; i < G[pos].size(); i++)
{
if(!used[G[pos][i]])
{
ret = max(ret, rec(G[pos][i], used) + 1);
}
}
used[pos] = false;
return ret;
}
int main()
{
int N, A, B;
while(true)
{
scanf("%d", &N);
if(N == 0) { break; }
G = vector<vector<int> >(100, vector<int>());
for(int i = 0; i < N; i++)
{
scanf("%d", &A); A--;
scanf("%d", &B); B--;
G[A].push_back(B);
G[B].push_back(A);
}
int ret = 0;
for(int i = 0; i < 100; i++)
{
if(G[i].size())
{
ret = max(ret));
}
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int rec(int)':
a.cc:19:31: error: too many arguments to function 'int rec(int)'
19 | ret = max(ret, rec(G[pos][i], used) + 1);
| ~~~^~~~~~~~~~~~~~~~~
a.cc:11:5: note: declared here
11 | int rec(int pos)
| ^~~
a.cc: In function 'int main()':
a.cc:55:26: error: no matching function for call to 'max(int&)'
55 | ret = max(ret));
| ~~~^~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
a.cc:55:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
55 | ret = max(ret));
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
|
s465486624 | p00431 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<vector<int> > G;
vector<bool> used;
int rec(int pos)
{
used[pos] = true; int ret = 1;
for(int i = 0; i < G[pos].size(); i++)
{
if(!used[G[pos][i]])
{
ret = max(ret, rec(G[pos][i]) + 1);
}
}
used[pos] = false;
return ret;
}
int main()
{
int N, A, B;
while(true)
{
scanf("%d", &N);
if(N == 0) { break; }
G = vector<vector<int> >(100, vector<int>());
for(int i = 0; i < N; i++)
{
scanf("%d", &A); A--;
scanf("%d", &B); B--;
G[A].push_back(B);
G[B].push_back(A);
}
int ret = 0;
for(int i = 0; i < 100; i++)
{
if(G[i].size())
{
ret = max(ret));
}
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:55:26: error: no matching function for call to 'max(int&)'
55 | ret = max(ret));
| ~~~^~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
a.cc:55:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
55 | ret = max(ret));
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
|
s161600259 | p00431 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<vector<int> > G;
vector<bool> used;
vector<int> rings;
char rec(char pos)
{
used[pos] = true; char ret = 1;
for(char i = 0; i < rings[pos]; i++)
{
if(!used[G[pos][i]])
{
ret = max(ret, rec(G[pos][i]) + 1);
}
}
used[pos] = false;
return ret;
}
int main()
{
int N, A, B;
while(true)
{
scanf("%d", &N);
if(N == 0) { break; }
G = vector<vector<int> >(100, vector<int>());
used = vector<bool>(100);
rings = vector<int>(100);
for(int i = 0; i < N; i++)
{
scanf("%d", &A); A--;
scanf("%d", &B); B--;
G[A].push_back(B);
G[B].push_back(A);
}
for(int i = 0; i < 100; i++)
{
rings[i] = G[i].size();
}
int nodes = 0;
for(int i = 0; i < 100; i++)
{
if(rings[i])
{
nodes++;
}
}
int ret = 0;
for(int i = 0; i < 100; i++)
{
ret = max(ret, rec(i));
if(ret == nodes) { break; }
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'char rec(char)':
a.cc:21:22: error: no matching function for call to 'max(char&, int)'
21 | ret = max(ret, rec(G[pos][i]) + 1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:21:22: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'int')
21 | ret = max(ret, rec(G[pos][i]) + 1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:21:22: note: mismatched types 'std::initializer_list<_Tp>' and 'char'
21 | ret = max(ret, rec(G[pos][i]) + 1);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:74:22: error: no matching function for call to 'max(int&, char)'
74 | ret = max(ret, rec(i));
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:74:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'char')
74 | ret = max(ret, rec(i));
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:74:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
74 | ret = max(ret, rec(i));
| ~~~^~~~~~~~~~~~~
|
s898836794 | p00431 | C++ | #include <stdio.h>
#include <algorithm>
using namespace std;
int N, A, B, v[100], r[100], G[100][199];
int rec(int pos) {
u[pos] = 1; int ret = 0;
for(int i = 0; i < rings[pos]; i++) {
if(!u[G[pos][i]]) ret = max(ret, rec(G[pos][i]));
}
u[pos] = 0;
return ret + 1;
}
int main() {
while(scanf("%d%d", &N), N) {
for(int i = 0; i < 100; i++) r[i] = 0;
for(int i = 0; i < N; i++) {
scanf("%d%d", &A, &B), A--, B--;
G[A][r[A]++] = B;
G[B][r[B]++] = A;
}
int ret = 0;
for(int i = 0; i < 100; i++) {
if(r[i]) ret = max(ret, rec(i));
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int rec(int)':
a.cc:6:9: error: 'u' was not declared in this scope
6 | u[pos] = 1; int ret = 0;
| ^
a.cc:7:28: error: 'rings' was not declared in this scope
7 | for(int i = 0; i < rings[pos]; i++) {
| ^~~~~
|
s980248078 | p00431 | C++ | #include <stdio.h>
#include <algorithm>
using namespace std;
int N, A, B, v[100], r[100], G[100][199];
int rec(int pos) {
v[pos] = 1; int ret = 0;
for(int i = 0; i < rings[pos]; i++) {
if(!v[G[pos][i]]) ret = max(ret, rec(G[pos][i]));
}
v[pos] = 0;
return ret + 1;
}
int main() {
while(scanf("%d%d", &N), N) {
for(int i = 0; i < 100; i++) r[i] = 0;
for(int i = 0; i < N; i++) {
scanf("%d%d", &A, &B), A--, B--;
G[A][r[A]++] = B;
G[B][r[B]++] = A;
}
int ret = 0;
for(int i = 0; i < 100; i++) {
if(r[i]) ret = max(ret, rec(i));
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int rec(int)':
a.cc:7:28: error: 'rings' was not declared in this scope
7 | for(int i = 0; i < rings[pos]; i++) {
| ^~~~~
|
s948955424 | p00431 | C++ | #include <stdio.h>
int N, A, B, v[111], r[111], G[111][222];
int rec(int pos) {
int ret = 0; v[pos] = 1;
for (int i = 0; i < r[pos]; i++) {
if (!v[G[pos][i]]) {
int w = rec(G[pos][i]);
ret = ret > w ? ret : w;
}
}
v[pos] = 0;
return ret + 1;
}
int main() {
while (scanf("%d", &N), N) {
for (int i = 0; i < 100; i++) r[i] = 0;
for (int i = 0; i < N; i++) {
scanf("%d%d", &A, &B), A--, B--;
G[A][r[A]++] = B, G[B][r[B]++] = A;
}
int ret = 0;
for (int i = 0; i < 100; i++) ret = max(ret, rec(i));
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:53: error: 'max' was not declared in this scope
22 | for (int i = 0; i < 100; i++) ret = max(ret, rec(i));
| ^~~
|
s150734900 | p00431 | C++ | #include <stdio.h>
int N, A, B, v[111], r[111], G[111][222];
int rec(int pos) {
int ret = 0; v[pos] = 1;
for (int i = 0; i < r[pos]; i++) {
if (!v[G[pos][i]]) {
int w = rec(G[pos][i]);
ret = ret > w ? ret : w;
}
}
v[pos] = 0;
return ret + 1;
}
int main() {
while (scanf("%d", &N), N) {
for (int i = 0; i < 100; i++) r[i] = 0;
for (int i = 0; i < N; i++) {
scanf("%d%d", &A, &B), A--, B--;
G[A][r[A]++] = B, G[B][r[B]++] = A;
}
int ret = 0;
for (int i = 0; i < 100; i++) {
int w = rec(i);
ret = ret > w ? ret : w);
}
printf("%d\n", ret);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:48: error: expected ';' before ')' token
24 | ret = ret > w ? ret : w);
| ^
| ;
|
s601293013 | p00431 | C++ | 7
1 3
3 4
1 4
2 7
5 7
6 7
1 7
6
1 2
2 3
3 4
4 5
1 5
2 6
7
1 3
2 4
3 5
4 6
6 7
2 6
4 7
0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 7
| ^
|
s847582812 | p00431 | C++ | #include<stdio.h>
int n;
int done[100];
int c[100][2];
main(){
int i;
int ans,preans;
while(scanf("%d",&n)!=0){
for(i=0;i<n;i++){
scanf("%d %d",&c[i][0],&c[i][1]);
}
for(i=0;i<100;i++){
done[i]=0;
}
ans = 0
for(i=1;i<=100;i++){
preans = chain(i,0);
if(preans>ans){
ans = preans;
}
}
printf("%d\n",ans);
}
}
int chain(int e,int l){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
int i;
int prol,nowl;
prol = nowl = l;
for(i=0;i<n;i++){
if(c[i][0]==e && done[c[i][1]-1]==0){
prol = chain(c[i][1],nowl+1);
done[c[i][1]-1] = 1;
}
if(c[i][1]==e && done[c[i][0]-1]==0){
prol = chain(c[i][0],nowl+1);
done[c[i][0]-1] = 1;
}
if(prol>l){
l = prol;
}
}
return l;
} | a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:16:12: error: expected ';' before 'for'
16 | ans = 0
| ^
| ;
17 | for(i=1;i<=100;i++){
| ~~~
a.cc:17:23: error: expected ';' before ')' token
17 | for(i=1;i<=100;i++){
| ^
| ;
|
s295920033 | p00431 | C++ | #include<stdio.h>
int n;
int done[100];
int c[100][2];
main(){
int i;
int ans,preans;
while(scanf("%d",&n)!=0){
for(i=0;i<n;i++){
scanf("%d %d",&c[i][0],&c[i][1]);
}
for(i=0;i<100;i++){
done[i]=0;
}
ans = 0;
for(i=1;i<=100;i++){
preans = chain(i,0);
if(preans>ans){
ans = preans;
}
}
printf("%d\n",ans);
}
}
int chain(int e,int l){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
int i;
int prol,nowl;
prol = nowl = l;
for(i=0;i<n;i++){
if(c[i][0]==e && done[c[i][1]-1]==0){
prol = chain(c[i][1],nowl+1);
done[c[i][1]-1] = 1;
}
if(c[i][1]==e && done[c[i][0]-1]==0){
prol = chain(c[i][0],nowl+1);
done[c[i][0]-1] = 1;
}
if(prol>l){
l = prol;
}
}
return l;
} | a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:18:16: error: 'chain' was not declared in this scope
18 | preans = chain(i,0);
| ^~~~~
|
s300874053 | p00431 | C++ | #include<cstdio>
#include<stack>
#include<vector>
using namespace std;
vector<int> vec[1001];
bool ch[101]={};
stack<int> st;
void DFS(int i,int val){
if(val > maxx)maxx = val;
//printf("%d ",i);
for (int k=0; k<vec[i].size(); k++) {
if(!ch[vec[i][k]]){
ch[vec[i][k]] = true;
DFS(vec[i][k],val+1);
ch[vec[i][k]] = false;
}
}
}
int main(){
int maxx = -1;
int n,a,b;
scanf("%d",&n);
if(n == 0)return 0;
for (int i=0; i<n; i++) {
scanf("%d %d",&a,&b);
vec[a].push_back(b);
vec[b].push_back(a);
}
for (int i=1; i<=n; i++) {
ch[i] = true;
DFS(i,0);
ch[i] = false;
}
printf("%d\n",maxx+1);
vec.clear();
main();
} | a.cc: In function 'void DFS(int, int)':
a.cc:14:14: error: 'maxx' was not declared in this scope
14 | if(val > maxx)maxx = val;
| ^~~~
a.cc: In function 'int main()':
a.cc:41:9: error: request for member 'clear' in 'vec', which is of non-class type 'std::vector<int> [1001]'
41 | vec.clear();
| ^~~~~
|
s709594824 | p00431 | C++ | from collections import defaultdict
class GraphChain():
def __init__(self):
self.graph = defaultdict(set)
self.passed = defaultdict(bool)
self.route = defaultdict(bool)
self.ans = 0
def dfs(self, left, count):
'''
depth first search
'''
for i in range(len(self.graph[left])):
if self.passed[self.graph[left][i]] == False:
# mark passed point
self.passed[self.graph[left][i]] = True
# if next route is more than two, this node is never become start point.
if len(self.graph[left]) > 2:
self.route[self.graph[left][i]] = True
temp = self.dfs(self.graph[left][i], count + 1)
self.ans = self.ans if self.ans > temp else temp
# delete mark of point.
self.passed[self.graph[left][i]] = False
return count
def get_string_pair(self, num):
'''
get string and make dictionary.
'''
self.graph = defaultdict(list)
for i in range(num):
left, righ = [int(j) for j in input().strip().split()]
self.graph[left].append(righ)
self.graph[righ].append(left)
return self.graph
def count_chain(self, num):
'''
main function of this problem.
'''
self.get_string_pair(num)
print(self.graph)
for key in sorted(self.graph.keys()):
if self.route[key] == False:
self.dfs(key, 1)
return self.ans - 1
while 1:
gc = GraphChain()
x = int(input())
if x == 0:
break
print(gc.count_chain(x))
del gc | a.cc:12:5: error: empty character constant
12 | '''
| ^~
a.cc:12:7: warning: missing terminating ' character
12 | '''
| ^
a.cc:12:7: error: missing terminating ' character
a.cc:14:5: error: empty character constant
14 | '''
| ^~
a.cc:14:7: warning: missing terminating ' character
14 | '''
| ^
a.cc:14:7: error: missing terminating ' character
a.cc:17:11: error: invalid preprocessing directive #mark
17 | # mark passed point
| ^~~~
a.cc:20:19: error: missing binary operator before token "route"
20 | # if next route is more than two, this node is never become start point.
| ^~~~~
a.cc:32:7: warning: missing terminating ' character
32 | '''
| ^
a.cc:34:7: warning: missing terminating ' character
34 | '''
| ^
a.cc:44:7: warning: missing terminating ' character
44 | '''
| ^
a.cc:46:7: warning: missing terminating ' character
46 | '''
| ^
a.cc:20: error: unterminated #if
20 | # if next route is more than two, this node is never become start point.
a.cc:1:1: error: 'from' does not name a type
1 | from collections import defaultdict
| ^~~~
|
s720311399 | p00431 | C++ | wad
| a.cc:1:1: error: 'wad' does not name a type
1 | wad
| ^~~
|
s770630959 | p00431 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int solve(int idx, const vector<vector<int> >& path, vector<int>& visited, int cnt)
{
if (visited[idx])
return cnt;
int ans = cnt;
visited[idx] = 1;
for (int i = 0; i < 100; ++i) {
if (!visited[i] && path[idx][i])
ans = max(ans, solve(i, path, visited, cnt+1));
}
return ans;
}
int main()
{
freopen("0508.txt", "r", stdin);
int n;
while (scanf("%d", &n) != EOF) {
if (n == 0)
break;
vector<vector<int> > path(100, vector<int>(100, 0));
for (int i = 0; i < n; ++i) {
int a, b;
scanf("%d %d", &a, &b);
--a;
--b;
path[a][b] = path[b][a] = 1;
}
int ans = 0;
for (int i = 0; i < 100; ++i)
ans = max(ans, solve(i, path, vector<int>(100, 0), 1));
printf("%d\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:40:55: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
40 | ans = max(ans, solve(i, path, vector<int>(100, 0), 1));
| ^~~~~~~~~~~~~~~~~~~
a.cc:6:67: note: initializing argument 3 of 'int solve(int, const std::vector<std::vector<int> >&, std::vector<int>&, int)'
6 | int solve(int idx, const vector<vector<int> >& path, vector<int>& visited, int cnt)
| ~~~~~~~~~~~~~^~~~~~~
|
s537253142 | p00431 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> G[101];
bool passed[101];
int maxPath=0;
void dfs(int s,int depth){
maxPath=max(maxPath,depth);
if(maxPath==100)
return;
for(int i = 0; i<G[s].size(); i++){
if(!passed[G[s][i]]){
passed[G[s][i]]=true;
dfs(G[s][i],depth+1);
passed[G[s][i]]=false;
if(maxPath==100)
return;
}
}
}
int main(){
int n;n
while(cin>>n&&n!=0){
maxPath=0;
filnll(passed,passed+101,false);
for(int i = 0; i < 101; i++)
G[i].clear();
for(int i = 0; i < n; i++){
int a,b;
cin>>a>>b;
a--;
b--;
G[a].push_back(b);
G[b].push_back(a);
}
for(int i = 0; i < 100; i++){
passed[i]=true;
dfs(i,1);
if(maxPath==100)
break;
passed[i]=false;
}
cout<<maxPath<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:16: error: expected ';' before 'while'
28 | int n;n
| ^
| ;
29 | while(cin>>n&&n!=0){
| ~~~~~
|
s766269973 | p00431 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
vector<int> G[101];
bool passed[101];
int maxPath=0;
int maxNode;
bool isAppeared[101];
void dfs(int s,int depth){
maxPath=max(maxPath,depth);
if(maxPath==maxNode)
return;
for(int i = 0; i<G[s].size(); i++){
if(!passed[G[s][i]]){
passed[G[s][i]]=true;
dfs(G[s][i],depth+1);
passed[G[s][i]]=false;
if(maxPath==maxNode)
return;
}
}
}
int main(){
int n;
while(cin>>n&&n!=0){
maxPath=0;
fill(passed,passed+101,false);
fill(isAppeared,isAppeared+101,false);
for(int i = 0; i < 101; i++)
G[i].clear();
//set<int> s;
for(int i = 0; i < n; i++){
int a,b;
cin>>a>>b;
a--;
b--;
//s.insert(a);
//s.insert(b);
isAppeared[a]=true;
isAppeared[b]=true;
G[a].push_back(b);
G[b].push_back(a);
}
maxNode=s.size();
for(int i = 0; i < 101; i++){
if(!isAppeared[i])
continue;
passed[i]=true;
dfs(i,1);
if(maxPath==maxNode)
break;
passed[i]=false;
}
cout<<maxPath<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:49:25: error: 's' was not declared in this scope
49 | maxNode=s.size();
| ^
|
s742156780 | p00431 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdio>
using namespace std;
vector<int> G[101];
bool passed[101];
int maxPath=0;
int maxNode;
void dfs(int s,int depth){
maxPath=max(maxPath,depth);
if(maxPath==maxNode)
return;
for(int i = 0; i<G[s].size(); i++){
int to=G[s][i];
if(!passed[to]){
passed[to]=true;
dfs(to,depth+1);
passed[to]=false;
if(maxPath==maxNode)
return;
}
}
}
int main(){
int n;
while(scanf("%d",&n)&&n!=0){
maxPath=0;
memset(passed,0,sizeof(passed));
for(int i = 0; i < 101; i++)
G[i].clear();
set<int> s;
for(int i = 0; i < n; i++){
int a,b;
//cin>>a>>b;
scanf("%d %d",&a,&b);
a--;
b--;
s.insert(a);
s.insert(b);
G[a].push_back(b);
G[b].push_back(a);
}
maxNode=s.size();
for(set<int>::iterator it = s.begin(); it!=s.end(); it++){
passed[*it]=true;
dfs(*it,1);
passed[*it]=false;
if(maxPath==maxNode)
break;
}
printf("%d\n",maxPath);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:17: error: 'memset' was not declared in this scope
33 | memset(passed,0,sizeof(passed));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <cstdio>
+++ |+#include <cstring>
6 | using namespace std;
|
s254983683 | p00431 | C++ | #include<iostream>
#include<list>
using namespace std;
class Chain
{
public:
int tail;
int length;
Chain(int b)
{
tail = b;
length = 2;
};
}
int main(){
while(1)
{
int num;
cin>>num;
if(num==0)
{
break;
}
int chainB;
int length;
list< Chain > clist;
for(int i=0;i<num;++i)
{
int a, b;
cin>>a;
cin>>b;
if(clist.empty())
{
clist.push_back(Chain(b));
continue;
}
list< Chain >::iterator it = clist.begin();
bool added = false;
while(it != clist.end())
{
if((*it).tail == a)
{
(*it).length += 1;
(*it).tail = b;
added = true;
}
++it;
}
if(!added)
{
clist.push_back(Chain(b));
}
}
int maxLength = 0;
list< Chain >::iterator it = clist.begin();
while(it != clist.end())
{
if((*it).length>maxLength)
{
macLength = (*it).length;
}
}
cout<<macLength<<endl;
}
return 0;
} | a.cc:16:2: error: expected ';' after class definition
16 | }
| ^
| ;
a.cc: In function 'int main()':
a.cc:70:17: error: 'macLength' was not declared in this scope; did you mean 'maxLength'?
70 | macLength = (*it).length;
| ^~~~~~~~~
| maxLength
a.cc:73:15: error: 'macLength' was not declared in this scope; did you mean 'maxLength'?
73 | cout<<macLength<<endl;
| ^~~~~~~~~
| maxLength
|
s193871305 | p00431 | C++ | #include<iostream>
#include<list>
using namespace std;
class Chain
{
public:
int tail;
int length;
Chain(int b)
{
tail = b;
length = 2;
};
};
int main(){
while(1)
{
int num;
cin>>num;
if(num==0)
{
break;
}
int chainB;
int length;
list< Chain > clist;
for(int i=0;i<num;++i)
{
int a, b;
cin>>a;
cin>>b;
if(clist.empty())
{
clist.push_back(Chain(b));
continue;
}
list< Chain >::iterator it = clist.begin();
bool added = false;
while(it != clist.end())
{
if((*it).tail == a)
{
(*it).length += 1;
(*it).tail = b;
added = true;
}
++it;
}
if(!added)
{
clist.push_back(Chain(b));
}
}
int maxLength = 0;
list< Chain >::iterator it = clist.begin();
while(it != clist.end())
{
if((*it).length>maxLength)
{
macLength = (*it).length;
}
}
cout<<macLength<<endl;
}
return 0;
}; | a.cc: In function 'int main()':
a.cc:70:17: error: 'macLength' was not declared in this scope; did you mean 'maxLength'?
70 | macLength = (*it).length;
| ^~~~~~~~~
| maxLength
a.cc:73:15: error: 'macLength' was not declared in this scope; did you mean 'maxLength'?
73 | cout<<macLength<<endl;
| ^~~~~~~~~
| maxLength
|
s668291646 | p00431 | C++ | #include<iostream>
#include<list>
using namespace std;
class Chain
{
public:
int tail;
int length;
Chain(int b)
{
tail = b;
length = 2;
};
};
int main(){
ifstream ifs("input.txt");
ofstream ofs("output.txt");
while(1)
{
int num;
ifs>>num;
if(num==0)
{
break;
}
int chainB;
int length;
list< Chain > clist;
for(int i=0;i<num;++i)
{
int a, b;
ifs>>a;
ifs>>b;
if(clist.empty())
{
clist.push_back(Chain(b));
continue;
}
list< Chain >::iterator it = clist.begin();
bool added = false;
while(it != clist.end())
{
if((*it).tail == a)
{
(*it).length += 1;
(*it).tail = b;
added = true;
}
++it;
}
if(!added)
{
clist.push_back(Chain(b));
}
}
int maxLength = 0;
list< Chain >::iterator it = clist.begin();
while(it != clist.end())
{
if((*it).length>maxLength)
{
maxLength = (*it).length;
}
++it;
}
ofs<<maxLength<<endl;
}
ofs<<endl;
return 0;
}; | a.cc: In function 'int main()':
a.cc:20:17: error: variable 'std::ifstream ifs' has initializer but incomplete type
20 | ifstream ifs("input.txt");
| ^
a.cc:3:1: note: 'std::ifstream' is defined in header '<fstream>'; this is probably fixable by adding '#include <fstream>'
2 | #include<list>
+++ |+#include <fstream>
3 | using namespace std;
a.cc:21:17: error: variable 'std::ofstream ofs' has initializer but incomplete type
21 | ofstream ofs("output.txt");
| ^
a.cc:21:17: note: 'std::ofstream' is defined in header '<fstream>'; this is probably fixable by adding '#include <fstream>'
|
s570790914 | p00431 | C++ | #include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int n,G[100][100],L[100],D[100];
int solve(int m)
{
int r=0;
D[m]=1;
for(int i=0;i<L[m];i++){
int k=G[m][i];
if(!D[k]){
r=max(r,solve(k));
}
}
D[m]=0
return r+1;
}
int main()
{
while(scanf("%d",&n),n){
int r=0;
memset(L,0,sizeof(L));
while(n--){
int a,b;
scanf("%d%d",&a,&b);
G[a][L[a]++]=b;
G[b][L[b]++]=a;
}
for(int i=0;i<100;i++){
r=max(r,solve(i));
}
printf("%d\n",r+1);
}
} | a.cc: In function 'int solve(int)':
a.cc:18:11: error: expected ';' before 'return'
18 | D[m]=0
| ^
| ;
19 | return r+1;
| ~~~~~~
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
20 | }
| ^
|
s521820737 | p00431 | C++ | #include<vector>
#include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
vector<int> a[100];
bool b[100];
int fi(int p){
int i;
int mx=0;
for(i=0;i<(int)a[p].size();++i){
if(b[a[p][i]])
continue;
b[a[p][i]]=true;
mx=max(mx,fi(a[p][i])+1);
b[a[p][i]]=false;
}
return mx;
}
int main(){
int i;
int n;
while(scanf("%d",&n),n){
for(i=0;i<n;++i)
a[i].clear();
for(i=0;i<n;++i){
int p,q;
scanf("%d%d",&p,&q);
--p;
--q;
a[p].push_back(q);
a[q].push_back(p);
}
int mn,1<<30,mx=0;
for(i=0;i<n;++i)
mn=min(mn,a[i].size());
for(i=0;i<n;++i){
if(a[i].size()==mn)
mx=max(mx,fi(i));
}
printf("%d\n",mx);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:24: error: expected unqualified-id before numeric constant
34 | int mn,1<<30,mx=0;
| ^
a.cc:36:31: error: no matching function for call to 'min(int&, std::vector<int>::size_type)'
36 | mn=min(mn,a[i].size());
| ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
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:36:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
36 | mn=min(mn,a[i].size());
| ~~~^~~~~~~~~~~~~~~~
/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:2:
/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:36:31: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
36 | mn=min(mn,a[i].size());
| ~~~^~~~~~~~~~~~~~~~
a.cc:39:33: error: 'mx' was not declared in this scope; did you mean 'mn'?
39 | mx=max(mx,fi(i));
| ^~
| mn
a.cc:41:31: error: 'mx' was not declared in this scope; did you mean 'mn'?
41 | printf("%d\n",mx);
| ^~
| mn
|
s109703936 | p00431 | C++ | #include <stdio.h>
#include <stdbool.h>
#define MAX_VERTEX_NUM 100
typedef struct {
char linked_num;
char linked[MAX_VERTEX_NUM-1];
} vertex;
vertex vertex_list[MAX_VERTEX_NUM];
bool has_arrived[MAX_VERTEX_NUM];
char count_max;
void vertex_init() {
int i;
for (i=0;i < MAX_VERTEX_NUM;i++) {
vertex_list[i].linked_num = 0;
}
return ;
}
void link(int id1, int id2) {
vertex *obj1 = &vertex_list[id1];
vertex *obj2 = &vertex_list[id2];
int num1 = obj1->linked_num;
int num2 = obj2->linked_num;
obj1->linked[num1] = id2;
obj2->linked[num2] = id1;
obj1->linked_num += 1;
obj2->linked_num += 1;
return ;
}
void rec(int id, int now_count) {
int i;
if (has_arrived[id]) {
return ;
}
has_arrived[id] = 1;
if (count_max < now_count+1)count_max = now_count+1;
for (i=0;i < vertex_list[id].linked_num;i++) {
rec(vertex_list[id].linked[i], now_count + 1);
}
has_arrived[id] = 0;
return ;
}
int main() {
while (1) {
int i,n;
scanf("%d", &n);
if (n == 0) return;
vertex_init();
for (i=0;i<n;i++) {
int id1, id2;
scanf("%d %d", &id1, &id2);
link(id1-1, id2-1);
}
count_max = 0;
for (i=0;i<n;i++) {
rec(i, 0);
}
printf("%d\n", count_max);
}
} | a.cc: In function 'int main()':
a.cc:62:21: error: return-statement with no value, in function returning 'int' [-fpermissive]
62 | if (n == 0) return;
| ^~~~~~
|
s243428910 | p00431 | C++ | #include<iostream>
#include<set>
#include<bitset>
#include<algorithm>
using namespace std;
set<int> vertex;
vector< vector<int> > edge;
int dfs(int v, bitset<101> visited) {
int result = visited.count() + 1;
visited.set(v);
for(vector<int>::iterator i=edge[v].begin(); i!=edge[v].end(); i++) {
if(visited.test(*i)) continue;
result = max(result, dfs(*i, visited));
}
return result;
}
int solve() {
int result = 0;
for(set<int>::iterator i=vertex.begin(); i!=vertex.end(); i++) {
result = max(result, dfs(*i, bitset<101>(0)));
}
return result;
}
int main() {
int n;
while(cin>>n, n) {
edge = vector< vector<int> >(101);
for(int i=0; i<n; i++) {
int u, v;
cin>>u>>v;
vertex.insert(--u);
vertex.insert(--v);
edge[u].push_back(v);
edge[v].push_back(u);
}
cout<<solve()<<endl;
}
} | a.cc:8:1: error: 'vector' does not name a type
8 | vector< vector<int> > edge;
| ^~~~~~
a.cc: In function 'int dfs(int, std::bitset<101>)':
a.cc:13:9: error: 'vector' was not declared in this scope
13 | for(vector<int>::iterator i=edge[v].begin(); i!=edge[v].end(); i++) {
| ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
4 | #include<algorithm>
+++ |+#include <vector>
5 | using namespace std;
a.cc:13:16: error: expected primary-expression before 'int'
13 | for(vector<int>::iterator i=edge[v].begin(); i!=edge[v].end(); i++) {
| ^~~
a.cc:13:50: error: 'i' was not declared in this scope
13 | for(vector<int>::iterator i=edge[v].begin(); i!=edge[v].end(); i++) {
| ^
a.cc:13:53: error: 'edge' was not declared in this scope
13 | for(vector<int>::iterator i=edge[v].begin(); i!=edge[v].end(); i++) {
| ^~~~
a.cc: In function 'int main()':
a.cc:31:9: error: 'edge' was not declared in this scope
31 | edge = vector< vector<int> >(101);
| ^~~~
a.cc:31:16: error: 'vector' was not declared in this scope
31 | edge = vector< vector<int> >(101);
| ^~~~~~
a.cc:31:16: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:31:31: error: expected primary-expression before 'int'
31 | edge = vector< vector<int> >(101);
| ^~~
|
s139062133 | p00432 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Sheets{
public static void main(String[] args){
// TODO ?????????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int kindOfProblem = sc.nextInt();
Sheet s = new Sheet(10001);
for(int i = 0; i < n; i++) {
s.addSheet(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
}
sc.close();
switch(kindOfProblem) {
case 1:
System.out.println(s.countTrue());
break;
case 2:
System.out.println(s.countTrue());
System.out.println(s.calcLength());
}
}
}
class Sheet{
boolean[][] grid;
Sheet(int size){
this.grid = new boolean[size][size];
for(boolean[] row: grid) {
Arrays.fill(row, false);
}
}
void addSheet(int x1, int y1, int x2, int y2) {
for(int i = y1; i < y2; i++){
for(int j = x1; j < x2; j++) {
this.grid[i][j] = true;
}
}
}
int countTrue() {
int result = 0;
for(int i = 0; i < grid.length; i++) {
for(int j = 0; j < grid[i].length; j++) {
if(grid[i][j]) result++;
}
}
return result;
}
int calcLength() {
int result = 0;
for(int i = 0; i < grid.length; i++) {
for(int j = 0; j < grid[i].length; j++) {
if(grid[i][j]) {
if(!check(i, j-1)) result++;
if(!check(i-1, j)) result++;
if(!check(i+1, j)) result++;
if(!check(i, j+1)) result++;
}
}
}
return result;
}
boolean check(int x, int y) {
if(0 <= x && x < grid[0].length && 0 <= y && y < grid.length) return grid[x][y];
else return false;
}
} | Main.java:5: error: class Sheets is public, should be declared in a file named Sheets.java
public class Sheets{
^
1 error
|
s332004018 | p00432 | Java | import java.util.Scanner;
public class Sheet {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numOfSheet = in.nextInt();
int probNum = in.nextInt();
int[][] matrix;
while(!(numOfSheet==0 && probNum==0)) {
int maxX = 0, maxY = 0;
int[][] data = new int[numOfSheet][4];
for(int i=0; i<numOfSheet; i++) {
data[i][0] = in.nextInt();//x1
data[i][1] = in.nextInt();//y1
data[i][2] = in.nextInt();//x2
data[i][3] = in.nextInt();//y2
if(data[i][0]>maxX) maxX=data[i][0];
if(data[i][2]>maxX) maxX=data[i][2];
if(data[i][1]>maxY) maxY=data[i][1];
if(data[i][3]>maxY) maxY=data[i][3];
}
matrix = new int[maxX+1][maxY+1];
for(int i=0; i<data.length; i++) {
for(int j=data[i][0]; j<data[i][2]; j++) {
for(int k=data[i][1]; k<data[i][3]; k++) {
matrix[k][j] = 1;
}
}
}
if(probNum==1 || probNum==2) {
int area = 0;
for(int i=0; i<matrix.length; i++) {
for(int j=0; j<matrix[i].length; j++) {
area+= matrix[i][j];
}
}
System.out.println(area);
}
if(probNum==2) {
int length = 0;
for(int i=0; i<matrix.length; i++) {
for(int j=0; j<matrix[i].length; j++) {
if(matrix[i][j] == 1) length += getLength(i, j, matrix);
}
}
System.out.println(length);
}
numOfSheet = in.nextInt();
probNum = in.nextInt();
}
}
public static int getLength(int x, int y, int[][] matrix) {
int ret = 0;
int n = 0;
if(x==0&&y==0) n = matrix[x][y+1] + matrix[x+1][y];
else if(x==0&&y==matrix[0].length-1) n = matrix[x][y-1] + matrix[x+1][y];
else if(x==matrix.length-1&&y==0) n = matrix[x-1][y] + matrix[x][y+1];
else if(x==matrix.length-1&&y==matrix[x].length-1) n = matrix[x][y-1] + matrix[x-1][y];
else if(x==0) n = matrix[x][y+1] + matrix[x][y-1] + matrix[x+1][y];
else if(x==matrix.length-1) n = matrix[x][y+1] + matrix[x][y-1] + matrix[x-1][y];
else if(y==0) n = matrix[x-1][y] + matrix[x+1][y] + matrix[x][y+1];
else if(y==matrix[x].length-1) n = matrix[x-1][y] + matrix[x+1][y] + matrix[x][y-1];
else n = matrix[x-1][y] + matrix[x+1][y] + matrix[x][y-1] + matrix[x][y+1];
switch(n){
case 1:
ret = 3;
break;
case 2:
ret = 2;
break;
case 3:
ret = 1;
break;
default:
break;
}
return ret;
}
} | Main.java:3: error: class Sheet is public, should be declared in a file named Sheet.java
public class Sheet {
^
1 error
|
s188613325 | p00432 | Java | package d2018;
import java.io.*;
import java.util.*;
// Volume5-0509 Sheets
public class Main5_0509 {
class Rect {
int x0;
int y0;
int x1;
int y1;
}
class Range {
Range(int x, int f) {
this.x = x;
this.f = f;
}
int x;
int f; // f = 1:start f = 11:end
}
// rangeListに範囲を追加する
void addRange(List<Integer> rangeList, int start, int end) {
for(int i = 0; i < rangeList.size(); i++) {
if (rangeList.get(i) >= start) {
}
}
}
// メイン return falseでおしまい
boolean main() throws IOException {
int[] ir = readIntArray();
int n = ir[0];
int r = ir[1]; // 1面積 2 面積:周長
if (n == 0)
return false;
Rect[] rects = new Rect[n];
Rect[] rects2 = new Rect[n];
Set<Integer> ySet = new HashSet<Integer>();
for(int i = 0; i < n; i++) {
ir = readIntArray();
rects[i] = new Rect();
rects[i].x0 = ir[0];
rects[i].y0 = ir[1];
rects[i].x1 = ir[2];
rects[i].y1 = ir[3];
rects2[i] = new Rect();
rects2[i].y0 = ir[0];
rects2[i].x0 = ir[1];
rects2[i].y1 = ir[2];
rects2[i].x1 = ir[3];
}
int slen = 0; // 周長
int s = 0; // 面積
///
{
for(int i = 0; i < n; i++) {
ySet.add(rects[i].y0);
ySet.add(rects[i].y1);
}
Integer[] ya = ySet.toArray(new Integer[0]);
Arrays.sort(ya);
for(int i = 0; i < ya.length - 1; i++) {
log.printf("y=%d\n", ya[i]);
int h = ya[i + 1] - ya[i];
List<Range> rangeList = new ArrayList<Range>();
for(int k = 0; k < n; k++) {
if (rects[k].y0 <= ya[i] && ya[i] < rects[k].y1) {
Range ra0 = new Range(rects[k].x0, 1);
Range ra1 = new Range(rects[k].x1, -1);
rangeList.add(ra0);
rangeList.add(ra1);
log.printf("add %d %d\n", ra0.x, ra1.x);
}
}
Collections.sort(rangeList, new Comparator<Range>() {
@Override
public int compare(Range o1, Range o2) {
if (o1.x == o2.x) {
return o2.f - o1.f;
}
return o1.x - o2.x;
}});
int c = 0;
int cx = 0;
for(Range ra : rangeList) {
if (ra.f > 0) {
c++;
if (c == 1) {
cx = ra.x;
slen += h;
}
}
else {
c--;
if (c == 0) {
log.printf("面積=%d\n", (ra.x - cx) * h);
s += (ra.x - cx) * h;
slen += h;
}
}
}
}
}
rects = rects2;
///
{
for(int i = 0; i < n; i++) {
ySet.add(rects[i].y0);
ySet.add(rects[i].y1);
}
Integer[] ya = ySet.toArray(new Integer[0]);
Arrays.sort(ya);
for(int i = 0; i < ya.length - 1; i++) {
log.printf("y=%d\n", ya[i]);
int h = ya[i + 1] - ya[i];
List<Range> rangeList = new ArrayList<Range>();
for(int k = 0; k < n; k++) {
if (rects[k].y0 <= ya[i] && ya[i] < rects[k].y1) {
Range ra0 = new Range(rects[k].x0, 1);
Range ra1 = new Range(rects[k].x1, -1);
rangeList.add(ra0);
rangeList.add(ra1);
log.printf("add %d %d\n", ra0.x, ra1.x);
}
}
Collections.sort(rangeList, new Comparator<Range>() {
@Override
public int compare(Range o1, Range o2) {
if (o1.x == o2.x) {
return o2.f - o1.f;
}
return o1.x - o2.x;
}});
int c = 0;
int cx = 0;
for(Range ra : rangeList) {
if (ra.f > 0) {
c++;
if (c == 1) {
cx = ra.x;
slen += h;
}
}
else {
c--;
if (c == 0) {
log.printf("面積=%d\n", (ra.x - cx) * h);
s += (ra.x - cx) * h;
slen += h;
}
}
}
}
}
System.out.printf("%d\n", s/2);
if (r == 2) System.out.printf("%d\n", slen);
return true; // 正常終了 次へ
}
// private final static boolean DEBUG = true; // debug
private final static boolean DEBUG = false; // release
public static void main(String[] args) throws IOException {
if (DEBUG) {
log = System.out;
String inputStr = "5 1:0 0 3 2:1 1 2 5:0 4 6 5:3 3 5 6:5 0 7 6:";
//String inputStr = "2 2:0 0 8 9: 0 0 9 8:";
inputStr += "0 0:";
inputStr = inputStr.replace(":", "\n");
reader = new BufferedReader(new StringReader(inputStr));
}
else {
log = new PrintStream(new OutputStream() { public void write(int b) {} } ); // 書き捨て
reader = new BufferedReader(new InputStreamReader(System.in)); // コンソールから
}
int N = Integer.MAX_VALUE;
//int N = readIntArray()[0];
for(int i = 0; i < N; i++) {
boolean b = new Main5_0509().main();
if (!b)
break;
}
reader.close();
}
static PrintStream log;
static BufferedReader reader;
// 標準入力より1行分の区切り文字区切りでの整数値を読む
// EOFの場合はnullを返す
private static int[] readIntArray() throws IOException {
String s = null;
for(;;) {
s = reader.readLine();
// log.printf("%s\n", s);
if (s == null)
return null;
s = s.trim();
if (s.length() != 0) // ※※※ どうも突然空行を読むことがある。読み飛ばすとうまくいくらしい。。。。
break;
}
String[] sp = s.split("[ ,]"); // 区切り文字はスペースかカンマ
int[] a = new int[sp.length];
for(int i = 0; i < sp.length; i++) {
a[i] = Integer.parseInt(sp[i]);
}
return a;
}
}
| Main.java:9: error: class Main5_0509 is public, should be declared in a file named Main5_0509.java
public class Main5_0509 {
^
1 error
|
s444678731 | p00432 | C | #include<stdio.h>
main(){
int n,r;
int i,j,k;
int Mx,My;
int p[10000][4];
while(scanf("%d %d",&n,&r)!=EOF){
Mx = My = 100;
for(k=0,k<n,k++){
scanf("%d %d %d %d",&p[k][0],&p[k][1],&p[k][2],&p[k][3]);
if(p[k][2]>Mx){
Mx = p[k][2];
}
if(p[k][3]>My){
My = p[k][3];
}
}
sl(p,Mx,My,n,r);
}
}
void sl(int p[][4],int Mx,int My,int n,int r){
int f[Mx][My];
int i,j,k;
int s,l;
s = 0
for(i=0;i<Mx;i++){
for(j=0;j<My;j++){
f[i][j] = 0;
}
}
for(k=0;k<n;k++){
for(i=p[k][0];i<p[k][2];i++){
for(j=p[k][1];j<p[k][3];j++){
if(f[i][j]==0){
s++;
}
f[i][j] = 1;
}
}
}
printf("%d\n",s);
if(r==2){
l = 0
for(i=0;i<Mx-1;i++){
l+=(f[i][0]+f[i][Mx-1]);
for(j=0;j<My-1;j++){
l+=(f[i][j]^f[i][j+1]);
}
}
for(j=0;j<My-1;j++){
l+=(f[0][j]+f[My-1][j]);
for(i=0;<Mx-1;i++){
l+=(f[i+1][j]^f[i][j]);
}
}
printf("%d\n",l);
}
} | main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:9:20: error: expected ';' before ')' token
9 | for(k=0,k<n,k++){
| ^
| ;
main.c:9:20: error: expected expression before ')' token
main.c:18:5: error: implicit declaration of function 'sl' [-Wimplicit-function-declaration]
18 | sl(p,Mx,My,n,r);
| ^~
main.c: At top level:
main.c:22:6: warning: conflicting types for 'sl'; have 'void(int (*)[4], int, int, int, int)'
22 | void sl(int p[][4],int Mx,int My,int n,int r){
| ^~
main.c:18:5: note: previous implicit declaration of 'sl' with type 'void(int (*)[4], int, int, int, int)'
18 | sl(p,Mx,My,n,r);
| ^~
main.c: In function 'sl':
main.c:26:8: error: expected ';' before 'for'
26 | s = 0
| ^
| ;
27 | for(i=0;i<Mx;i++){
| ~~~
main.c:44:10: error: expected ';' before 'for'
44 | l = 0
| ^
| ;
45 | for(i=0;i<Mx-1;i++){
| ~~~
|
s567139295 | p00432 | C | #include<stdio.h>
main(){
int n,r;
int i,j,k;
int Mx,My;
int p[10000][4];
while(scanf("%d %d",&n,&r)!=EOF){
Mx = My = 100;
for(k=0,k<n,k++){
scanf("%d %d %d %d",&p[k][0],&p[k][1],&p[k][2],&p[k][3]);
if(p[k][2]>Mx){
Mx = p[k][2];
}
if(p[k][3]>My){
My = p[k][3];
}
}
sl(p,Mx,My,n,r);
}
}
void sl(int p[][4],int Mx,int My,int n,int r){
int f[Mx][My];
int i,j,k;
int s,l;
s = 0;
for(i=0;i<Mx;i++){
for(j=0;j<My;j++){
f[i][j] = 0;
}
}
for(k=0;k<n;k++){
for(i=p[k][0];i<p[k][2];i++){
for(j=p[k][1];j<p[k][3];j++){
if(f[i][j]==0){
s++;
}
f[i][j] = 1;
}
}
}
printf("%d\n",s);
if(r==2){
l = 0;
for(i=0;i<Mx-1;i++){
l+=(f[i][0]+f[i][Mx-1]);
for(j=0;j<My-1;j++){
l+=(f[i][j]^f[i][j+1]);
}
}
for(j=0;j<My-1;j++){
l+=(f[0][j]+f[My-1][j]);
for(i=0;<Mx-1;i++){
l+=(f[i+1][j]^f[i][j]);
}
}
printf("%d\n",l);
}
} | main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:9:20: error: expected ';' before ')' token
9 | for(k=0,k<n,k++){
| ^
| ;
main.c:9:20: error: expected expression before ')' token
main.c:18:5: error: implicit declaration of function 'sl' [-Wimplicit-function-declaration]
18 | sl(p,Mx,My,n,r);
| ^~
main.c: At top level:
main.c:22:6: warning: conflicting types for 'sl'; have 'void(int (*)[4], int, int, int, int)'
22 | void sl(int p[][4],int Mx,int My,int n,int r){
| ^~
main.c:18:5: note: previous implicit declaration of 'sl' with type 'void(int (*)[4], int, int, int, int)'
18 | sl(p,Mx,My,n,r);
| ^~
main.c: In function 'sl':
main.c:53:15: error: expected expression before '<' token
53 | for(i=0;<Mx-1;i++){
| ^
|
s595291332 | p00432 | C | #include<stdio.h>
#include<string.h>
bool m[10005][10005];
int main(){
int i,j,x1,y1,x2,y2,n,r;
int sx,sy,bx,by,a,b;
FILE *fp;
//fp=fopen("test.txt","r");
fp=stdin;
while(1){
fscanf(fp,"%d%d",&n,&r);
if(n==0 && r==0)break;
sx=sy=10000;
bx=by=0;
memset(m,0,sizeof(m));
while(n--){
fscanf(fp,"%d%d%d%d",&x1,&y1,&x2,&y2);
if(x1<sx)sx=x1;
if(y1<sy)sy=y1;
if(x2+1>bx)bx=x2+1;
if(y2+1>by)by=y2+1;
for(i=y1+1;i<=y2;i++){
for(j=x1+1;j<=x2;j++){
m[i][j]=true;
}
}
}
a=b=0;
for(i=sy;i<=by;i++){
for(j=sx;j<=bx;j++){
if(m[i][j])a++;
else{
if(m[i+1][j])b++;
if(m[i][j+1])b++;
if(i-1>=sy && m[i-1][j])b++;
if(j-1>=sx && m[i][j-1])b++;
}
//printf("%d",m[i][j]);
}
//printf("\n");
}
printf("%d\n",a);
if(r==2)printf("%d\n",b);
}
fclose(fp);
return 0;
} | main.c:3:1: error: unknown type name 'bool'
3 | bool m[10005][10005];
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<string.h>
+++ |+#include <stdbool.h>
3 | bool m[10005][10005];
main.c: In function 'main':
main.c:24:49: error: 'true' undeclared (first use in this function)
24 | m[i][j]=true;
| ^~~~
main.c:24:49: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:24:49: note: each undeclared identifier is reported only once for each function it appears in
|
s477655951 | p00432 | C | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef struct {
int sx, sy;
int ex, ey;
} RECT;
int area;
int length;
RECT calc[10000];
RECT before[10000];
RECT grid[10000];
int bsize;
bool comp(const RECT& rLeft, const RECT& rRight){
return (rLeft.sx < rRight.sx);
}
void mergeArea(int n, int *sq)
{
int i, j;
int num;
int start, end;
if (n == 0){
return;
}
sort(grid, grid + n, comp);
num = 0;
start = grid[0].sx;
end = grid[0].ex;
for (i = 1; i < n; i++){
if (grid[i].sx <= end){
end = max(end, grid[i].ex);
}
else {
calc[num].sx = start;
calc[num++].ex = end;
start = grid[i].sx;
end = grid[i].ex;
}
}
calc[num].sx = start;
calc[num++].ex = end;
for (i = 0; i < num; i++){
area += calc[i].ex - calc[i].sx;
}
*sq = num;
}
void mergeLength(int n)
{
vector<int> total;
int i;
int res;
for (i = 0; i < n; i++){
total.push_back(calc[i].sx);
total.push_back(calc[i].ex);
}
for (i = 0; i < bsize; i++){
total.push_back(before[i].sx);
total.push_back(before[i].ex);
}
sort(total.begin(), total.end());
res = 0;
for (i = 0; i < total.size(); i += 2){
res += total[i + 1] - total[i];
}
length += res + 2 * n;
}
int main(void)
{
int n, query;
static RECT p[10000];
int num;
int i, j;
int sq;
int miny, maxy;
while (1){
scanf("%d%d", &n, &query);
if (n + query == 0){
break;
}
area = length = 0;
miny = 1000000;
maxy = -100000;
for (i = 0; i < n; i++){
scanf("%d%d%d%d", &p[i].sx, &p[i].sy, &p[i].ex, &p[i].ey);
miny = min(miny, p[i].sy);
maxy = max(maxy, p[i].ey);
}
if (query == 1){
continue;
}
bsize = 0;
memset(before, 0, sizeof(before));
area = length = 0;
for (i = miny; i <= maxy; i++){
memset(grid, 0, sizeof(grid));
num = sq = 0;
for (j = 0; j < n; j++){
if (p[j].sy <= i && i < p[j].ey){
grid[num++] = p[j];
}
}
mergeArea(num, &sq);
if (query == 2 && (bsize != 0 || num != 0)){
mergeLength(sq);
}
memcpy(before, calc, sizeof(calc));
bsize = sq;
}
printf("%d\n", area);
if (query == 1){
continue;
}
printf("%d\n", length);
}
return (0);
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.