submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s133794007 | p00103 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef long long ll;
int n;
int count_HIT=0, count_OUT=0;
int Point=0;
string S;
void solve()
{
while (count_OUT <3)
{
cin >> S;
if (S == "HIT")
{
count_HIT++;
if (count_HIT == 4)
{
Point[++;
count_HIT -- ;
}
}
else if (S == "HOMERUN")
{
Point += count_HIT + 1;
count_HIT = 0;
}
else count_OUT++;
}
cout << Point << endl;
count_OUT = 0; count_HIT = 0;
Point = 0;
return;
}
int main()
{
cin >> n;
REP(j, n)
{
solve();
}
return 0;
} | a.cc: In function 'void solve()':
a.cc:28:41: error: expected primary-expression before ';' token
28 | Point[++;
| ^
a.cc:28:41: error: expected ']' before ';' token
28 | Point[++;
| ^
| ]
|
s710612822 | p00103 | C++ | #include <cstdio>
#include <iostream>
#include <string>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
int main() {
int n;
int base = 0, out = 0, score = 0;
cin >> n;
while(1) {
char str[10];
if(EOF == scanf("%s", str)) break;
if(!strcmp(str, "OUT")) {
out++;
if(out >= 3) {
cout << score <<endl;
score = out = base = 0;
n--;
}
} else if(!strcmp(str, "HOMERUN")) {
score += base + 1;
base = 0;
} else {
base++;
if(base >= 4) {
score++;
base--;
}
}
}
if(n) {
cout << score << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:13: error: 'strcmp' was not declared in this scope
17 | if(!strcmp(str, "OUT")) {
| ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <iostream>
+++ |+#include <cstring>
3 | #include <string>
|
s743625125 | p00103 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int n,cou=0;
string str;
cin >> n;
while(n>cou){
int cou_out=0,ans=0,ining=0;
while(cou_out < 3){
cin >> str;
if(str == "HIT"){
ining++;
if(ining == 4){
ans++;
ining--;
}
}
else if(str == "OUT"){
cou_out++;
}
else if(str == "HOMERUN"){
ans += ining+1;
ining = 0;
}
}
cou++;
cout << ans << endl;
}
}#include<iostream>
#include<string>
using namespace std;
int main(){
int n,cou=0;
string str;
cin >> n;
while(n>cou){
int cou_out=0,ans=0,ining=0;
while(cou_out < 3){
cin >> str;
if(str == "HIT"){
ining++;
if(ining == 4){
ans++;
ining--;
}
}
else if(str == "OUT"){
cou_out++;
}
else if(str == "HOMERUN"){
ans += ining+1;
ining = 0;
}
}
cou++;
cout << ans << endl;
}
} | a.cc:31:2: error: stray '#' in program
31 | }#include<iostream>
| ^
a.cc:31:3: error: 'include' does not name a type
31 | }#include<iostream>
| ^~~~~~~
a.cc:35:5: error: redefinition of 'int main()'
35 | int main(){
| ^~~~
a.cc:5:5: note: 'int main()' previously defined here
5 | int main(){
| ^~~~
|
s478076293 | p00103 | C++ | #include <iostream>
#include <array>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int point(){
return point;
}
int out(){
return out;
}
int hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
int home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
int get_out(){
out += 1;
}
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball();
while(baseball.out() != 3){
std::string str;
cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.get_out();
}
std::cout >> baseball.point() >> endl;
}
return 0;
{
| a.cc:21:9: error: 'int Baseball::point()' conflicts with a previous declaration
21 | }
| ^
a.cc:6:13: note: previous declaration 'int Baseball::point'
6 | int point;
| ^~~~~
a.cc:25:9: error: 'int Baseball::out()' conflicts with a previous declaration
25 | }
| ^
a.cc:7:13: note: previous declaration 'int Baseball::out'
7 | int out;
| ^~~
a.cc:76:2: error: expected '}' at end of input
76 | {
| ^
a.cc:4:15: note: to match this '{'
4 | class Baseball{
| ^
a.cc: In member function 'int Baseball::hit()':
a.cc:34:9: warning: no return statement in function returning non-void [-Wreturn-type]
34 | }
| ^
a.cc: In member function 'int Baseball::home_run()':
a.cc:42:9: warning: no return statement in function returning non-void [-Wreturn-type]
42 | }
| ^
a.cc: In member function 'int Baseball::get_out()':
a.cc:46:9: warning: no return statement in function returning non-void [-Wreturn-type]
46 | }
| ^
a.cc: In member function 'int Baseball::main()':
a.cc:55:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
55 | Baseball baseball();
| ^~
a.cc:55:34: note: remove parentheses to default-initialize a variable
55 | Baseball baseball();
| ^~
| --
a.cc:55:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:57:32: error: request for member 'out' in 'baseball', which is of non-class type 'Baseball()'
57 | while(baseball.out() != 3){
| ^~~
a.cc:59:25: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
59 | cin >> str;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:62:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
62 | baseball.hit();
| ^~~
a.cc:65:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
65 | baseball.home_run();
| ^~~~~~~~
a.cc:68:42: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
68 | baseball.get_out();
| ^~~~~~~
a.cc:72:39: error: request for member 'point' in 'baseball', which is of non-class type 'Baseball()'
72 | std::cout >> baseball.point() >> endl;
| ^~~~~
a.cc:72:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
72 | std::cout >> baseball.point() >> endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:76:2: error: expected '}' at end of input
76 | {
| ^
a.cc:76:1: note: to match this '{'
76 | {
| ^
a.cc:76:2: error: expected '}' at end of input
76 | {
| ^
a.cc:49:11: note: to match this '{'
49 | int main(){
| ^
a.cc: At global scope:
a.cc:76:2: error: expected unqualified-id at end of input
76 | {
| ^
|
s759926053 | p00103 | C++ | #include <iostream>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int point(){
return point;
}
int out(){
return out;
}
int hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
int home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
int get_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball();
while(baseball.out() != 3){
std::string str;
cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.get_out();
}
std::cout >> baseball.point() >> endl;
}
return 0;
{
| a.cc:20:9: error: 'int Baseball::point()' conflicts with a previous declaration
20 | }
| ^
a.cc:5:13: note: previous declaration 'int Baseball::point'
5 | int point;
| ^~~~~
a.cc:24:9: error: 'int Baseball::out()' conflicts with a previous declaration
24 | }
| ^
a.cc:6:13: note: previous declaration 'int Baseball::out'
6 | int out;
| ^~~
a.cc: In member function 'int Baseball::hit()':
a.cc:33:9: warning: no return statement in function returning non-void [-Wreturn-type]
33 | }
| ^
a.cc: In member function 'int Baseball::home_run()':
a.cc:41:9: warning: no return statement in function returning non-void [-Wreturn-type]
41 | }
| ^
a.cc: In member function 'int Baseball::get_out()':
a.cc:45:9: warning: no return statement in function returning non-void [-Wreturn-type]
45 | }
| ^
a.cc: In function 'int main()':
a.cc:54:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
54 | Baseball baseball();
| ^~
a.cc:54:34: note: remove parentheses to default-initialize a variable
54 | Baseball baseball();
| ^~
| --
a.cc:54:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:56:32: error: request for member 'out' in 'baseball', which is of non-class type 'Baseball()'
56 | while(baseball.out() != 3){
| ^~~
a.cc:58:25: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
58 | cin >> str;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:61:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
61 | baseball.hit();
| ^~~
a.cc:64:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
64 | baseball.home_run();
| ^~~~~~~~
a.cc:67:42: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
67 | baseball.get_out();
| ^~~~~~~
a.cc:71:39: error: request for member 'point' in 'baseball', which is of non-class type 'Baseball()'
71 | std::cout >> baseball.point() >> endl;
| ^~~~~
a.cc:71:50: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
71 | std::cout >> baseball.point() >> endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:75:2: error: expected '}' at end of input
75 | {
| ~^
a.cc:75:2: error: expected '}' at end of input
a.cc:48:11: note: to match this '{'
48 | int main(){
| ^
|
s128886665 | p00103 | C++ | #include <iostream>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int point(){
return point;
}
int out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void get_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball();
while(baseball.out() != 3){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.get_out();
}
std::cout >> baseball.point() >> std::endl;
}
return 0;
{
| a.cc:21:9: error: 'int Baseball::point()' conflicts with a previous declaration
21 | }
| ^
a.cc:6:13: note: previous declaration 'int Baseball::point'
6 | int point;
| ^~~~~
a.cc:25:9: error: 'int Baseball::out()' conflicts with a previous declaration
25 | }
| ^
a.cc:7:13: note: previous declaration 'int Baseball::out'
7 | int out;
| ^~~
a.cc: In function 'int main()':
a.cc:55:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
55 | Baseball baseball();
| ^~
a.cc:55:34: note: remove parentheses to default-initialize a variable
55 | Baseball baseball();
| ^~
| --
a.cc:55:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:57:32: error: request for member 'out' in 'baseball', which is of non-class type 'Baseball()'
57 | while(baseball.out() != 3){
| ^~~
a.cc:62:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
62 | baseball.hit();
| ^~~
a.cc:65:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
65 | baseball.home_run();
| ^~~~~~~~
a.cc:68:42: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
68 | baseball.get_out();
| ^~~~~~~
a.cc:72:39: error: request for member 'point' in 'baseball', which is of non-class type 'Baseball()'
72 | std::cout >> baseball.point() >> std::endl;
| ^~~~~
a.cc:76:2: error: expected '}' at end of input
76 | {
| ~^
a.cc:76:2: error: expected '}' at end of input
a.cc:49:11: note: to match this '{'
49 | int main(){
| ^
|
s851497138 | p00103 | C++ | #include <iostream>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball();
while(baseball.get_out() != 3){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
}
std::cout >> baseball.get_point() >> std::endl;
}
return 0;
{
| a.cc: In function 'int main()':
a.cc:55:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
55 | Baseball baseball();
| ^~
a.cc:55:34: note: remove parentheses to default-initialize a variable
55 | Baseball baseball();
| ^~
| --
a.cc:55:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:57:32: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
57 | while(baseball.get_out() != 3){
| ^~~~~~~
a.cc:62:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
62 | baseball.hit();
| ^~~
a.cc:65:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
65 | baseball.home_run();
| ^~~~~~~~
a.cc:68:42: error: request for member 'add_out' in 'baseball', which is of non-class type 'Baseball()'
68 | baseball.add_out();
| ^~~~~~~
a.cc:72:39: error: request for member 'get_point' in 'baseball', which is of non-class type 'Baseball()'
72 | std::cout >> baseball.get_point() >> std::endl;
| ^~~~~~~~~
a.cc:76:2: error: expected '}' at end of input
76 | {
| ~^
a.cc:76:2: error: expected '}' at end of input
a.cc:49:11: note: to match this '{'
49 | int main(){
| ^
|
s441713854 | p00103 | C++ | #include <iostream>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball();
while(baseball.get_out() != 3){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
}
std::cout >> baseball.get_point() >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
55 | Baseball baseball();
| ^~
a.cc:55:34: note: remove parentheses to default-initialize a variable
55 | Baseball baseball();
| ^~
| --
a.cc:55:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:57:32: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
57 | while(baseball.get_out() != 3){
| ^~~~~~~
a.cc:62:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
62 | baseball.hit();
| ^~~
a.cc:65:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
65 | baseball.home_run();
| ^~~~~~~~
a.cc:68:42: error: request for member 'add_out' in 'baseball', which is of non-class type 'Baseball()'
68 | baseball.add_out();
| ^~~~~~~
a.cc:72:39: error: request for member 'get_point' in 'baseball', which is of non-class type 'Baseball()'
72 | std::cout >> baseball.get_point() >> std::endl;
| ^~~~~~~~~
|
s690247212 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball();
while(baseball.get_out() != 3){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
}
std::cout >> baseball.get_point() >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:57:34: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
57 | Baseball baseball();
| ^~
a.cc:57:34: note: remove parentheses to default-initialize a variable
57 | Baseball baseball();
| ^~
| --
a.cc:57:34: note: or replace parentheses with braces to value-initialize a variable
a.cc:59:32: error: request for member 'get_out' in 'baseball', which is of non-class type 'Baseball()'
59 | while(baseball.get_out() != 3){
| ^~~~~~~
a.cc:64:42: error: request for member 'hit' in 'baseball', which is of non-class type 'Baseball()'
64 | baseball.hit();
| ^~~
a.cc:67:42: error: request for member 'home_run' in 'baseball', which is of non-class type 'Baseball()'
67 | baseball.home_run();
| ^~~~~~~~
a.cc:70:42: error: request for member 'add_out' in 'baseball', which is of non-class type 'Baseball()'
70 | baseball.add_out();
| ^~~~~~~
a.cc:74:39: error: request for member 'get_point' in 'baseball', which is of non-class type 'Baseball()'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^~~~~~~~~
|
s262574621 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(){
point = 0;
out = 0;
base = 0;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball;
while(baseball.get_out() != 3){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
}
std::cout >> baseball.get_point() >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:27: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
74 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:74:27: note: candidate: 'operator>>(int, int)' (built-in)
74 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:27: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:74:22: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
74 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:74:35: required from here
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s519754628 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(baseball.get_out() != 3){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
}
std::cout >> baseball.get_point() >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:27: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
74 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:74:27: note: candidate: 'operator>>(int, int)' (built-in)
74 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:27: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:74:22: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
74 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:74:49: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:74:35: required from here
74 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s453390588 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
if(baseball.get_out() == 3){
std::cout >> baseball.get_point() >> std::endl;
break;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:73:43: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
73 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:73:43: note: candidate: 'operator>>(int, int)' (built-in)
73 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:73:43: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:73:38: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
73 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:73:65: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:73:37: required from here
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s958420083 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
if(baseball.get_out() == 3){
int P = baseball.get_point();
std::cout >> P >> std::endl;
break;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:43: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
74 | std::cout >> P >> std::endl;
| ~~~~~~~~~ ^~ ~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:74:43: note: candidate: 'operator>>(int, int)' (built-in)
74 | std::cout >> P >> std::endl;
| ~~~~~~~~~~^~~~
a.cc:74:43: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:74:38: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
74 | std::cout >> P >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:74:18: required from here
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s256943271 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT")
baseball.add_out();
if(baseball.get_out() == 3){
int P = 1;
std::cout >> P >> std::endl;
break;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:43: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
74 | std::cout >> P >> std::endl;
| ~~~~~~~~~ ^~ ~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:74:43: note: candidate: 'operator>>(int, int)' (built-in)
74 | std::cout >> P >> std::endl;
| ~~~~~~~~~~^~~~
a.cc:74:43: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:74:38: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
74 | std::cout >> P >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:74:46: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:74:18: required from here
74 | std::cout >> P >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s658853912 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT"){
baseball.add_out();
if(baseball.get_out() == 3){
std::cout >> baseball.get_point() >> std::endl;
break;
}
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:73:51: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
73 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:73:51: note: candidate: 'operator>>(int, int)' (built-in)
73 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:73:51: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:73:46: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
73 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:73:73: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:73:38: required from here
73 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s766035944 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT"){
baseball.add_out();
if(baseball.get_out() == 3){
std::cout >> 7 >> std::endl;
break;
}
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:73:51: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
73 | std::cout >> 7 >> std::endl;
| ~~~~~~~~~ ^~ ~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:73:51: note: candidate: 'operator>>(int, int)' (built-in)
73 | std::cout >> 7 >> std::endl;
| ~~~~~~~~~~^~~~
a.cc:73:51: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:73:46: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
73 | std::cout >> 7 >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:73:54: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:73:19: required from here
73 | std::cout >> 7 >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s178323980 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT"){
baseball.add_out();
if(baseball.get_out() == 3)
break;
}
}
std::cout >> baseball.get_point() >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:77:19: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
77 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:77:19: note: candidate: 'operator>>(int, int)' (built-in)
77 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:77:19: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:77:14: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
77 | std::cout >> baseball.get_point() >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:77:41: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:77:34: required from here
77 | std::cout >> baseball.get_point() >> std::endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s636482099 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int point;
int out;
int base; //0:no runner 1:runner
//home,third,second,first
public:
Baseball(int fir_point, int fir_out, int fir_base){
point = fir_point;
out = fir_out;
base = fir_base;
}
int get_point(){
return point;
}
int get_out(){
return out;
}
void hit(){
base = (base * 10) + 1;
if(base >= 1000){
base -= 1000;
point += 1;
}
}
void home_run(){
point += 1;
for(int i = base; i > 0; i /= 10){
point += i%10;
}
base = 0;
}
void add_out(){
out += 1;
}
};
int main(){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball(0, 0, 0);
while(true){
std::string str;
std::cin >> str;
if(str == "HIT")
baseball.hit();
else if(str == "HOMERUN")
baseball.home_run();
else if(str == "OUT"){
baseball.add_out();
if(baseball.get_out() == 3)
break;
}
}
std::cout >> "1" >> std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:77:27: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [2]')
77 | std::cout >> "1" >> std::endl;
| ~~~~~~~~~ ^~ ~~~
| | |
| | const char [2]
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
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:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:77:22: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
77 | std::cout >> "1" >> std::endl;
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:77:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[2]]':
a.cc:77:16: required from here
77 | std::cout >> "1" >> std::endl;
| ^~~
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s448838495 | p00103 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;
#define PI 4*atan(1)
int main(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
bool base[3] = {false};
int point = 0, out = 0;
while(1){
char s[8];
cin >> s;
if(strcmp(s, "HIT") == 0){
if(base[2] == true){
point += 1;
base[2] = false;
}
if(base[1] == true){
base[1] = false;
base[2] = true;
}
if(base[0] == true){
base[0] = false;
base[1] = true;
}
base[0] = true;
}
if(strcmp(s, "OUT") == 0){
out++;
if(out == 3)break;
}
if(strcmp(s, "HOMERUN") == 0){
for(int j = 0; j < 3; j++){
if(base[i] == true){
base[i] = false;
point++;
}
}
point++;
}
}
cout << point << endl;
}
} | a.cc: In function 'int main()':
a.cc:23:10: error: 'strcmp' was not declared in this scope
23 | if(strcmp(s, "HIT") == 0){
| ^~~~~~
a.cc:10:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include <cstdio>
+++ |+#include <cstring>
10 | using namespace std;
a.cc:38:10: error: 'strcmp' was not declared in this scope
38 | if(strcmp(s, "OUT") == 0){
| ^~~~~~
a.cc:38:10: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:42:10: error: 'strcmp' was not declared in this scope
42 | if(strcmp(s, "HOMERUN") == 0){
| ^~~~~~
a.cc:42:10: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s571072219 | p00103 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
bool F,S,T //???
int out,point;
int i,j;
int dataN,dataLoop;
string E; //????????????
cin>>dataN;
for(dataLoop=0;dataLoop<dataN;dataLoop++){
//????????????
out=0;point=0;
while(out==3){
cin>>E;
switch(E){
case "HIT":
if(T){point++;}
T=S;S=F;F=true;
break;
case "HOMERUN":
point++;
if(F){point++;F=false;}
if(S){point++;S=false;}
if(T){point++;T=false;}
break;
case "OUT":
out++;
break;
}
}
cout<<point<<endl;
//???????????§
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: expected initializer before 'int'
7 | int out,point;
| ^~~
a.cc:17:9: error: 'out' was not declared in this scope
17 | out=0;point=0;
| ^~~
a.cc:17:15: error: 'point' was not declared in this scope
17 | out=0;point=0;
| ^~~~~
a.cc:20:17: error: switch quantity not an integer
20 | switch(E){
| ^
a.cc:22:20: error: 'T' was not declared in this scope
22 | if(T){point++;}
| ^
a.cc:23:17: error: 'T' was not declared in this scope
23 | T=S;S=F;F=true;
| ^
|
s929721725 | p00103 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
bool F,S,T; //???
int out,point;
int i,j;
int dataN,dataLoop;
string E; //????????????
cin>>dataN;
for(dataLoop=0;dataLoop<dataN;dataLoop++){
//????????????
out=0;point=0;
while(out==3){
cin>>E;
switch(E){
case "HIT":
if(T){point++;}
T=S;S=F;F=true;
break;
case "HOMERUN":
point++;
if(F){point++;F=false;}
if(S){point++;S=false;}
if(T){point++;T=false;}
break;
case "OUT":
out++;
break;
}
}
cout<<point<<endl;
//???????????§
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:17: error: switch quantity not an integer
20 | switch(E){
| ^
|
s019583745 | p00103 | C++ | #include<stdio.h>
int main(void)
{
char str[16]={};
int n;
int score=0;
int base=0;
int out=0;
scanf("%d", &n);
for(i=0;i<n;i++)
{
scanf("%s", str);
if(str[1]='I')
if(base==3)
score++,base=0;
else
base++;
else if(str[1]='U')
if(out==2)
out=base=0;
else
out++;
else if(str[1]='O')
score+=base+1,base=0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:7: error: 'i' was not declared in this scope
13 | for(i=0;i<n;i++)
| ^
|
s851860373 | p00103 | C++ | #include <iostream>
#include <string>
int main(){
int n;
int base[3];
int out, score;
string event;
std::cin >> n;
for(int i=0; i<n; i++){
base[0] = 0;
base[1] = 0;
base[2] = 0;
out = 0;
score = 0;
while(out!=3){
std::cin >> event;
if(event=="HIT"){
if(base[2]>=1){
base[2]--;
score++;
}
if(base[1]>=1){
base[1]--;
base[2]++;
}
if(base[0]>=1){
base[0]--;
base[1]++;
}
base[0]++;
}else if(event=="HOMERUN"){
score += base[2];
base[2] = 0;
score += base[1];
base[1] = 0;
score += base[0];
base[0] = 0;
}else{
out++;
}
}
std::cout << score << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:3: error: 'string' was not declared in this scope
9 | string event;
| ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:18:19: error: 'event' was not declared in this scope
18 | std::cin >> event;
| ^~~~~
|
s260958974 | p00103 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,a[4],k=0,l=0;
string s;
cin>>n;
while(k!=n){
cin>>s;
if(s=='H'){
if(!a[0])a[0]++;
else {
if(!a[1])a[1]++;
else{
if(!a[2])a[2]++;
else a[3]++;
}
}
}
else if(s=='O'){
l++;
if(l==3){
a[1]=a[2]=a[0]=l=0;
k++;
}
}
else{
a[3]+=1+a[1]+a[2]+a[0];
a[1]=a[2]=a[0]=0;
}
}
cout<<a[3]<<endl;
} | a.cc: In function 'int main()':
a.cc:9:9: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
9 | if(s=='H'){
| ~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
9 | if(s=='H'){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
9 | if(s=='H'){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(s=='H'){
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
9 | if(s=='H'){
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
9 | if(s=='H'){
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:9:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
9 | if(s=='H'){
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, bas |
s831988458 | p00103 | C++ | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
while(n){
int o=0,a=0,b=0;
while(o!=3){
string s;
cin>>s;
if(s=="HIT"){
if(b==3){
a++;
}
else b++;
}
}
else if(s=="OUT")o++;
else{
a+=++b;
b=0;
}
}
cout<<a<<endl;
n--;
}
} | a.cc: In function 'int main()':
a.cc:18:4: error: 'else' without a previous 'if'
18 | else if(s=="OUT")o++;
| ^~~~
a.cc:18:12: error: 's' was not declared in this scope
18 | else if(s=="OUT")o++;
| ^
a.cc:24:9: error: 'a' was not declared in this scope
24 | cout<<a<<endl;
| ^
a.cc: At global scope:
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s625094561 | p00103 | C++ | for i in range(int(input())):
f, s, t, count, point = 0, 0, 0, 0, 0
while count != 3:
data = input()
if data == 'HIT':
if t == 1:
point += 1
t = 0
if s == 1:
t = 1
s = 0
if f == 1:
s = 1
f = 1
elif data == 'OUT':
count += 1
elif data == 'HO' \
'' :
point += f + s + t + 1
f, s, t = 0, 0, 0
print(point) | a.cc:5:20: warning: multi-character character constant [-Wmultichar]
5 | if data == 'HIT':
| ^~~~~
a.cc:15:22: warning: multi-character character constant [-Wmultichar]
15 | elif data == 'OUT':
| ^~~~~
a.cc:17:22: warning: multi-character character constant [-Wmultichar]
17 | elif data == 'HO' \
| ^~~~
a.cc:18:20: error: empty character constant
18 | '' :
| ^~
a.cc:1:1: error: expected unqualified-id before 'for'
1 | for i in range(int(input())):
| ^~~
|
s828718725 | p00103 | C++ | #include <iostream>
#include <string>
int main(){
int hit, out, score, data_set_num;
std::string event;
cin >> data_set_num;
while(data_set_num--){
cin >> event;
if(event == "HIT"){
++hit;
if(hit == 4){
++score;
hit = 3;
}
}else if(event == "HOMERUN"){
score += (hit + 1);
hit = 0;
}else if(event == "OUT"){
++out;
}
if(out == 3){
std::cout << score << std::endl;
hit = 0;
core = 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >> data_set_num;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:28:13: error: 'core' was not declared in this scope; did you mean 'score'?
28 | core = 0;
| ^~~~
| score
|
s916501172 | p00103 | C++ |
#include <iostream>
#include <string>
#include <fstream>
int main(){
int hit, out, score, data_set_num;
std::string event;
std::getline(std::cin,str);
sscanf(str.c_str(),"%d ",&data_set_num);
while(data_set_num--){
std::cin >> event;
if(event == "HIT"){
++hit;
if(hit == 4){
++score;
hit = 3;
}
}else if(event == "HOMERUN"){
score += (hit + 1);
hit = 0;
}else if(event == "OUT"){
++out;
}
if(out == 3){
std::cout << score << std::endl;
hit = 0;
score = 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:27: error: 'str' was not declared in this scope; did you mean 'std'?
9 | std::getline(std::cin,str);
| ^~~
| std
|
s677816550 | p00103 | C++ | #include <iostream>
#include <array>
class Baseball{
private:
int m_runner = 0;
int m_out = 0;
int m_point = 0;
public:
void isHit(){
if(m_runner < 3){
++m_runner;
//if fill all base
} else {
++m_point;
}
}
void isHomerun(){
//add point and reset runner
m_point += m_runner + 1;
m_runner = 0;
}
void setOut(){
++m_out;
}
int getOut(){
return m_out;
}
int getPoint(){
return m_point;
}
void resetInning(){
m_runner = 0;
m_out = 0;
m_point = 0;
}
};
int main(){
int n;
std::string event;
std::cin >> n;
Baseball baseball;
for(int i = 0; i < n; ++i){
//until out count = 3
while(baseball.getOut() < 3) {
//input event
std::cin >> event;
if (event == "HIT") {
baseball.isHit();
} else if (event == "OUT") {
baseball.setOut();
} else if (event == "HOMERUN"){
baseball.isHomerun();
}
}
std::cout << baseball.getPoint() << std::endl;
resetInning();
}
} | a.cc: In function 'int main()':
a.cc:61:9: error: 'resetInning' was not declared in this scope
61 | resetInning();
| ^~~~~~~~~~~
|
s078001039 | p00103 | C++ | //0103
#include<string.h>
#include<stdio.h>
int main()
{
int n,op,f,se,t,r;
char s[16];
scanf("%d",&n);
for(int i=0;i<n;i++){
r=0;
op=0;
f=0;
se=0;
t=0;
while(op<3){
scanf("%s",s);
if(strcmp("OUT",s)==0){
op++;
}else if(strcmp("HIT",s)){
r+=t;
t=se;
se=f;
f++;
}else{
r+=(f+se+t+1);
f=s=t=0;
}
}
printf("%d\n",r-3);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:27:36: error: incompatible types in assignment of 'int' to 'char [16]'
27 | f=s=t=0;
| ~^~~~
|
s175748199 | p00103 | C++ | #include <string>
using namespace std;
int base[3];
int point = 0;
int out = 0;
int n;
//イニング終わり
void reset_base() {
for (int i = 0; i < 3; ++i) {
base[i] = 0;
}
}
//シングルヒット
void Single_hit() {
point += base[2];
base[2] = base[1];
base[1] = base[0];
base[0] = 1;
}
//ホームラン
void HomeRun() {
for (int i = 0; i < 2; ++i) {
point += base[i];
base[i] = 0;
}
++point;
}
void Out() {
++out;
if (out == 3) {
reset_base();
out = 0;
cout << point << endl;
point = 0;
--n;
}
}
int main() {
cin >> n;
string s;
while (n) {
cin >> s;
if (s == "HIT") {
Single_hit();
}
else if (s == "HOMERUN") {
HomeRun();
}
else if (s == "OUT") {
Out();
}
}
}
| a.cc: In function 'void Out()':
a.cc:38:17: error: 'cout' was not declared in this scope
38 | cout << point << endl;
| ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <string>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:38:34: error: 'endl' was not declared in this scope
38 | cout << point << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <string>
+++ |+#include <ostream>
2 | using namespace std;
a.cc: In function 'int main()':
a.cc:46:9: error: 'cin' was not declared in this scope
46 | cin >> n;
| ^~~
a.cc:46:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s406675330 | p00103 | C++ | #include<cstdio>
int main() {
bool a = false, b = false, c = false;
int score = 0;
char event[10];
int d;
scanf_s("%d", &d, 10);
for (int i = 0; i<d; i++) {
score = 0;
a = b = c = false;
int out = 0;
while (1) {
scanf_s("%s", &event, 10);
if (event[1] == 'I') {
if (c)score++;
c = b;
b = a;
a = true;
}
else if (event[1] == 'O') {
score++;
if (a)score++;
if (b)score++;
if (c)score++;
a = b = c = false;
}
else out++;
if (out == 3) {
printf("%d\n", score);
break;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
8 | scanf_s("%d", &d, 10);
| ^~~~~~~
| scanf
|
s277763430 | p00103 | C++ | #include <iostream>
#include <queue>
#include <string>
class Baseball {
public:
int score; //得点
int count; //アウトカウント
std::queue<int> runner; //ランナー
//コンストラクタ
Baseball(int sc,int co){
score = sc;
count = co;
while(!runner.empty()){
runner.pop();
}
}
//ヒット
void hit(){
if(runner.size() == 3){
++score;
}
}
//ホームラン
void homerun(){
while(!runner.empty()){
++score;
runner.pop();
}
++score;;
}
//アウト
void out(){
++count;
}
};
int main(){
int n;
std::string event;
std::cin >> n;
Baseball game(0,0);
while(n > 0 && std::cin >> event){
switch(event){
case 'HIT':
game.hit();
break;
case 'HOMERUN':
game.homerun();
break;
case 'OUT':
game.out();
}
if(game.count == 3){
--n;
std::cout << game.score << std::endl;
game = Baseball(0,0);
}
}
}
| a.cc:54:18: warning: multi-character character constant [-Wmultichar]
54 | case 'HIT':
| ^~~~~
a.cc:57:18: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
57 | case 'HOMERUN':
| ^~~~~~~~~
a.cc:60:18: warning: multi-character character constant [-Wmultichar]
60 | case 'OUT':
| ^~~~~
a.cc: In function 'int main()':
a.cc:53:16: error: switch quantity not an integer
53 | switch(event){
| ^~~~~
|
s277413083 | p00103 | C++ | #include <iostream>
#include <queue>
#include <string>
class Baseball {
public:
int score; //得点
int count; //アウトカウント
std::queue<int> runner; //ランナー
//コンストラクタ
Baseball(int sc,int co){
score = sc;
count = co;
while(!runner.empty()){
runner.pop();
}
}
//ヒット
void hit(){
if(runner.size() == 3){
++score;
}
}
//ホームラン
void homerun(){
while(!runner.empty()){
++score;
runner.pop();
}
++score;
}
//アウト
void out(){
++count;
}
};
int main(){
int n;
std::string event;
std::cin >> n;
Baseball game(0,0);
while(n > 0 && std::cin >> event){
if(event == "HIT")
game.hit();
else if(event == "HOMERUN")
game.homerun();
else
game.out();
}
if(game.count == 3){
--n;
std::cout << game.score << std::endl;
game = Baseball(0,0);
}
}
}
| a.cc:66:1: error: expected declaration before '}' token
66 | }
| ^
|
s052687100 | p00103 | C++ | #include <iostream>
#include <string>
int base;
int hit(){
if(base==3) return 1;
else base++;
return 0;
}
int homerun(){
base++;
return base;
}
int main(){
int inning;
std::cin << inning;
for(int i=0;i<inning;i++){
int outCount=0;
int point=0;
string result;
base=0;
while(outCount<3){
std::cin << result;
if(result == "HIT"){
point += hit();
} else if(result == "HOMERUN"){
point += homerun();
base=0;
} else if(result == "OUT"){
outCount++;
}
}
std::cout >> point >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:18: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
19 | std::cin << inning;
| ~~~~~~~~ ^~ ~~~~~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:19:18: note: candidate: 'operator<<(int, int)' (built-in)
19 | std::cin << inning;
| ~~~~~~~~~^~~~~~~~~
a.cc:19:18: 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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
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:19:14: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
19 | std::cin << inning;
| ~~~~~^~~
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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:14: required from here
19 | std::cin << inning;
| ^~~~~~
/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:24:17: error: 'string' was not declared in this scope
24 | string result;
| ^ |
s338560685 | p00103 | C++ | #include <iostream>
#include <string>
int base;
int hit(){
if(base==3) return 1;
else base++;
return 0;
}
int homerun(){
base++;
return base;
}
int main(){
int inning;
std::cin << inning;
for(int i=0;i<inning;i++){
int outCount=0;
int point=0;
string result;
base=0;
while(outCount<3){
std::cin << result;
if(result == "HIT"){
point += hit();
} else if(result == "HOMERUN"){
point += homerun();
base=0;
} else if(result == "OUT"){
outCount++;
}
}
std::cout >> point >> std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:18: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
19 | std::cin << inning;
| ~~~~~~~~ ^~ ~~~~~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:19:18: note: candidate: 'operator<<(int, int)' (built-in)
19 | std::cin << inning;
| ~~~~~~~~~^~~~~~~~~
a.cc:19:18: 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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
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:19:14: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
19 | std::cin << inning;
| ~~~~~^~~
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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:21: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
19 | std::cin << inning;
| ^~~~~~
/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:19:14: required from here
19 | std::cin << inning;
| ^~~~~~
/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:24:17: error: 'string' was not declared in this scope
24 | string result;
| ^ |
s945619288 | p00103 | C++ | #include <iostream>
#include <string>
int base;
int hit(){
if(base==3) return 1;
else base++;
return 0;
}
int homerun(){
base++;
return base;
}
int main(){
int inning;
std::cin >> inning;
for(int i=0;i<inning;i++){
int outCount=0;
int point=0;
string result;
base=0;
while(outCount<3){
std::cin >> result;
if(result == "HIT"){
point += hit();
} else if(result == "HOMERUN"){
point += homerun();
base=0;
} else if(result == "OUT"){
outCount++;
}
}
std::cout << point << std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:17: error: 'string' was not declared in this scope
24 | string result;
| ^~~~~~
a.cc:24:17: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:27:37: error: 'result' was not declared in this scope
27 | std::cin >> result;
| ^~~~~~
|
s162955164 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int first;
int second;
int third;
int score;
int count;
public:
Baseball(){
first=0;
second=0;
third=0;
score=0;
count=0;
}
int score(){
return score;
}
void hit(){
score+=third;
third=second;
second=first;
first=1;
}
void homerun(){
score+=third+second+first+1;
first=0;
second=0;
third=0;
}
void out(){
count++;
}
int count(){
return count;
}
}
int main(){
int inning;
std::cin >> inning;
for(int i=0;i<inning;i++){
Baseball attack;
std::string result;
while(attack.count()<3){
std::cin >> result;
if(result == "HIT"){
attack.hit();
} else if(result == "HOMERUN"){
attack.homerun();
} else if(result == "OUT"){
attack.out();
}
}
std::cout << attack.score() <<std::endl;
}
return 0;
}
| a.cc:21:9: error: 'int Baseball::score()' conflicts with a previous declaration
21 | }
| ^
a.cc:9:13: note: previous declaration 'int Baseball::score'
9 | int score;
| ^~~~~
a.cc:39:9: error: 'int Baseball::count()' conflicts with a previous declaration
39 | }
| ^
a.cc:10:13: note: previous declaration 'int Baseball::count'
10 | int count;
| ^~~~~
a.cc:40:2: error: expected ';' after class definition
40 | }
| ^
| ;
a.cc: In function 'int main()':
a.cc:49:30: error: 'int Baseball::count' is private within this context
49 | while(attack.count()<3){
| ^~~~~
a.cc:10:13: note: declared private here
10 | int count;
| ^~~~~
a.cc:49:35: error: expression cannot be used as a function
49 | while(attack.count()<3){
| ~~~~~~~~~~~~^~
a.cc:60:37: error: 'int Baseball::score' is private within this context
60 | std::cout << attack.score() <<std::endl;
| ^~~~~
a.cc:9:13: note: declared private here
9 | int score;
| ^~~~~
a.cc:60:42: error: expression cannot be used as a function
60 | std::cout << attack.score() <<std::endl;
| ~~~~~~~~~~~~^~
|
s419661178 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball{
private:
int first;
int second;
int third;
int score;
int count;
public:
Baseball(){
first=0;
second=0;
third=0;
score=0;
count=0;
}
int getScore(){
return score;
}
void hit(){
score+=third;
third=second;
second=first;
first=1;
}
void homerun(){
score+=third+second+first+1;
first=0;
second=0;
third=0;
}
void out(){
count++;
}
int getCount(){
return count;
}
}
int main(){
int inning;
std::cin >> inning;
for(int i=0;i<inning;i++){
Baseball attack;
std::string result;
while(attack.getCount()<3){
std::cin >> result;
if(result == "HIT"){
attack.hit();
} else if(result == "HOMERUN"){
attack.homerun();
} else if(result == "OUT"){
attack.out();
}
}
std::cout << attack.getScore() <<std::endl;
}
return 0;
}
| a.cc:40:2: error: expected ';' after class definition
40 | }
| ^
| ;
|
s438938194 | p00103 | C++ | #include<stdio.h>
#include<string.h>
int main(void)
{
int base=0,out=0,score=0,e,i,j;
char str[10];
scanf("%d",&e);
if(e==0)break;
for(i=0;i<e;){
scanf("%s",&str);
if(!strcmp(str,"HIT"))base++;
else if(!strcmp(str,"OUT")){
out++;
}
else if(!strcmp(str,"HOMERUN")){
score=score+base+1;
base=0;
}
if(base>3){
base--;
score++;
}
if(out==3){
out=0;
printf("%d\n",score);
i++;
base=0;
score=0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:17: error: break statement not within loop or switch
9 | if(e==0)break;
| ^~~~~
|
s755218462 | p00103 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
string ins;
cin>>n;
for(int ix=0;ix<n;ix++){
int out=0,po=0;
vector<bool> runner(3,false);
for(;;){
cin>>ins;
if(ins=="HIT"){
if(runner[2]){
po++;
runner[2]=false;
}
if(runner[1]){
runner[2]=true;
runner[1]=false;
}
if(runner[0]) runner[1]=true;
runner[0]=true;
}else if(ins=="OUT"){
out++;
if(out==3)break;
}else if(ins=="HOMERUN"){
po++;
for(int i=0;i<3;i++){
if(runner[i])po++;
runner[i]=false;
}
}
}
cout<<po<<enld;
printf("%d\n",po);
}
} | a.cc: In function 'int main()':
a.cc:35:19: error: 'enld' was not declared in this scope
35 | cout<<po<<enld;
| ^~~~
|
s998402062 | p00103 | C++ | #include <iostream>
#include <string>
using namespace std;
void solve()
{
int n;
cin >> n;
while(n--)
{
int point = 0;
int outcount = 0;
bool runner[3];
memset(runner, 0, sizeof(bool) * 3);
while(true)
{
string str;
cin >> str;
if(str == "HIT")
{
if(runner[2])
{
point++;
}
for(int i = 1; i >= 0; --i)
{
if(runner[i])
{
runner[i + 1] = true;
}
}
runner[0] = true;
}
else if(str == "OUT")
{
outcount++;
if(outcount == 3)
{
cout << point << endl;
break;
}
}
else if(str == "HOMERUN")
{
point++;
for(int i = 0; i < 3; ++i)
{
if(runner[i])
{
point++;
runner[i] = false;
}
}
}
}
}
}
int main()
{
solve();
return(0);
} | a.cc: In function 'void solve()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset(runner, 0, sizeof(bool) * 3);
| ^~~~~~
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 | #include <string>
|
s628896429 | p00103 | C++ | #include<stdio.h>
main(){
int c,y,t,o,p;
char a[9];
scanf("%d",&c);
for(y=0;;y++){
t=o=p=0;
while(~scanf("%s",&a)||exit(1)){
if(a[0]=='H')t++;
else o++;
if(a[1]=='O'){p+=t;t=0;}
if(t>3){p++;t--;}
if(o>2)break;
}
printf("%d\n",p);
}
} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:9:40: error: 'exit' was not declared in this scope
9 | while(~scanf("%s",&a)||exit(1)){
| ^~~~
a.cc:2:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
1 | #include<stdio.h>
+++ |+#include <cstdlib>
2 |
|
s574357371 | p00103 | C++ | b,s,o;main(a){for(scanf("%*d");~scanf("%s",&a);b=a%3?(a%3-2)?b+1:o?b:(s=!printf("%d\n",s+((b>3)?b-3:0))):!(s+=++b))a%3-2||(o=(o+1)%3);} | a.cc:1:1: error: 'b' does not name a type
1 | b,s,o;main(a){for(scanf("%*d");~scanf("%s",&a);b=a%3?(a%3-2)?b+1:o?b:(s=!printf("%d\n",s+((b>3)?b-3:0))):!(s+=++b))a%3-2||(o=(o+1)%3);}
| ^
a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token
1 | b,s,o;main(a){for(scanf("%*d");~scanf("%s",&a);b=a%3?(a%3-2)?b+1:o?b:(s=!printf("%d\n",s+((b>3)?b-3:0))):!(s+=++b))a%3-2||(o=(o+1)%3);}
| ^
|
s992274822 | p00103 | C++ | #include<stdio.h>
int main(){
int c,y,t,o,p;
char a[9];
read(0,c,4);
for(y=0;;y++){
for(t=o=p=0;;){
if(!~scanf("%s",a))return 0;
if(a[0]=='H')t++;
else o++;
if(a[1]=='O'){p+=t;t=0;}
if(t>3){p++;t--;}
if(o>2)break;
}
printf("%d\n",p);
}
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'read' was not declared in this scope; did you mean 'fread'?
6 | read(0,c,4);
| ^~~~
| fread
|
s697413433 | p00103 | C++ | main(){
int c,y,t,o,p;
char a[9];
scanf("%d",&c);
for(y=0;y<c;y++){
for(t=o=p=0;;){
if(!~scanf("%s",a))return 0;
if(a[0]=='H')t++;
else o++;
if(a[1]=='O'){p+=t;t=0;}
if(t>3){p++;t--;}
if(o>2)break;
}
printf("%d\n",p);
}c=1;
} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:4:9: error: 'scanf' was not declared in this scope
4 | scanf("%d",&c);
| ^~~~~
a.cc:14:17: error: 'printf' was not declared in this scope
14 | printf("%d\n",p);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | main(){
|
s188085419 | p00103 | C++ | main(){
int c,y,t,o,p;
char a[9];
scanf("%d",&c);
for(y=0;y<c;y++){
for(t=o=p=0;;){
scanf("%s",a);
if(a[0]=='H')t++;
else o++;
if(a[1]=='O'){p+=t;t=0;}
if(t>3){p++;t--;}
if(o>2)break;
}
printf("%d\n",p);
}c=1;
} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:4:9: error: 'scanf' was not declared in this scope
4 | scanf("%d",&c);
| ^~~~~
a.cc:14:17: error: 'printf' was not declared in this scope
14 | printf("%d\n",p);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | main(){
|
s113046466 | p00103 | C++ | main(){
int c,y,t,o,p;
char a[9];
scanf("%d",&c);
for(y=0;y<c;y++){
for(t=o=p=0;;){
scanf("%s",a);
if(a[0]=='H')t++;
else o++;
if(a[1]=='O'){p+=t;t=0;}
if(t>3){p++;t--;}
if(o>2)break;
}
printf("%d\n",p);
}c=1;
} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:4:9: error: 'scanf' was not declared in this scope
4 | scanf("%d",&c);
| ^~~~~
a.cc:14:17: error: 'printf' was not declared in this scope
14 | printf("%d\n",p);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | main(){
|
s354065478 | p00103 | C++ | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)
{
if(a%3){
if(a&1,++o){
if(o%3){
b=!printf("%d\n",s+b>3?b-3:0),s=0;
}
}
else{
b++;
}
}
else{
s+=b,b=0;
}
}
} | a.cc:1:1: error: 'b' does not name a type
1 | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)
| ^
a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token
1 | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)
| ^
|
s022314537 | p00103 | C++ | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)a%3?a&1?++o%3?:(s=!printf("%d\n",b>3?s+b-3:s),b=0):b++:(s+=b+1,b=0);} | a.cc:1:1: error: 'b' does not name a type
1 | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)a%3?a&1?++o%3?:(s=!printf("%d\n",b>3?s+b-3:s),b=0):b++:(s+=b+1,b=0);}
| ^
a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token
1 | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)a%3?a&1?++o%3?:(s=!printf("%d\n",b>3?s+b-3:s),b=0):b++:(s+=b+1,b=0);}
| ^
|
s595305428 | p00103 | C++ | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)b=a%3?a&1?++o%3?b:(s=!printf("%d\n",b>3?s+b-3:s)):b+1:(s+=b+1);} | a.cc:1:1: error: 'b' does not name a type
1 | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)b=a%3?a&1?++o%3?b:(s=!printf("%d\n",b>3?s+b-3:s)):b+1:(s+=b+1);}
| ^
a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token
1 | b,o,s;main(a){for(scanf("%d");~scanf("%s",&a);)b=a%3?a&1?++o%3?b:(s=!printf("%d\n",b>3?s+b-3:s)):b+1:(s+=b+1);}
| ^
|
s004962492 | p00103 | C++ | #include<stdio.h>
int main(void){
int i,j,k,q,p,inning,point,kazu[20];
char eve[10];
point=0;
j=0;
k=0;
q=0;
p=0;
scanf("%d",&inning);
for(k=0;k<inning;k++){
point=0;
j=0;
q=0;
p=0;
while(q<3){
for(j=0;j<10;j++){
eve[j]=0;
}
gets(eve);
if(eve[0]=='O'){
if(eve[1]=='U'){
if(eve[2]=='T'){
q++;
}
}
}
if(eve[0]=='H'){
if(eve[1]=='I'){
if(eve[2]=='T'){
p++;
if(p>=4){
point++;
}
}
}
}
if(eve[0]=='H'){
if(eve[1]=='O'){
if(eve[2]=='M'){
if(eve[3]=='E'){
if(eve[4]=='R'){
if(eve[5]=='U'){
if(eve[6]=='N'){
point=point+p+1;
p=0;
}
}
}
}
}
}
}
}
kazu[k]=point;
}
for(k=0;k<inning;k++){
printf("%d\n",kazu[k]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:25: error: 'gets' was not declared in this scope; did you mean 'getw'?
29 | gets(eve);
| ^~~~
| getw
|
s023741313 | p00103 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void)
{
int point;
int single_hit;
int out;
int inning;
string event;
cin >> inning;
for(int i = 0 ; i < inning ; i++)
{
point = 0;
out = 0;
single_hit = 0;
while(1)
{
if(out == 3) break;
cin >> event;
if(event == "HIT") single_hit++;
if(event == "OUT") out++;
if(event == "HOMERUN")
{
point += (single_hit + 1);
/*if(single_hit == 1) point+=2;
if(single_hit == 2) point+=3;
if(single_hit == 3) point+=4;*/
single_hit = 0;
}
if(single_hit == 4)
{
point++;
single_hit--;
}
}
cout << point << endl;
}
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | #include <iostream>
| ^
a.cc:1:10: error: stray '#' in program
1 | #include <iostream>
| ^
a.cc:1:17: error: stray '#' in program
1 | #include <iostream>
| ^
a.cc:1:3: error: expected unqualified-id before numeric constant
1 | #include <iostream>
| ^~~~~
a.cc:1:11: error: expected unqualified-id before numeric constant
1 | #include <iostream>
| ^~~~~
a.cc:1:18: error: 'include' does not name a type
1 | #include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/std |
s136444811 | p00103 | C++ | #include<iostram>
#include<cstdio>
#include<algorithm>
using namespace std;
main(){
int N;
scanf("%d",&N);
for(int i=;i<N;i++){
int oc=0;
int po=0;
int co[3]={0};
while(oc<3){
string str;
cin >> str;
if(str=="OUT") oc++;
if(str=="HIT"){
po+=co[2];
co[2]=co[1];
co[1]=co[0];
co[0]++;
}
if(str=="HOMERUN"){
po+=co[0]+co[1]+co[2]+1;
}
}
cout << po << endl;
}
} | a.cc:1:9: fatal error: iostram: No such file or directory
1 | #include<iostram>
| ^~~~~~~~~
compilation terminated.
|
s583648079 | p00103 | C++ | #include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int loop;
int HIT,OUT,point;
string stait;
int main(){
scanf("%d",&loop);
for(int i=0;i<loop;i++){
int base[4]={0};
point = 0;
OUT=0;
while(OUT<3){
cin>>stait;
cout<<stait[1];
if(stait[1]=="O"){
for(int j=1;j<4;j++)
if(base[j]==1){base[j]=0;point++;}
point++;
}
if(stait[1]=="U"){OUT++;}
if(stait[1]=="I"){
if(base[3]==1){
point++;
}
for(int j=3;j>1;j--){
base[j]=base[j-1];
base[j-1]=0;
}
}
}
printf("%d\n",point);
}
} | a.cc: In function 'int main()':
a.cc:20:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
20 | if(stait[1]=="O"){
a.cc:25:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
25 | if(stait[1]=="U"){OUT++;}
a.cc:26:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
26 | if(stait[1]=="I"){
|
s451472976 | p00103 | C++ | #include <stdio.h>
int main(void){
int dataset,ining;
int i;
int runner[3],point,out;
char str[8];
scanf("%d",&dataset);
for(ining=0;ining<dataset;ining++){
//init state variable
for(i=0;i<3;i++){
runner[i]=0;
}
point=0;
out=0;
//start ining
while(out<3){
scanf("%s",&str[0]);
if(strcmp(str,"HOMERUN")==0){
for(i=0;i<3;i++){
point+=runner[i];
runner[i]=0;
}
point++;
}
else if(strcmp(str,"HIT")==0){
if(runner[2]==1){
runner[2]=0;
point++;
}
if(runner[1]==1){
runner[1]=0;
runner[2]=1;
}
if(runner[0]==1){
runner[0]=0;
runner[1]=1;
}
runner[0]=1;
}
else if(strcmp(str,"OUT")==0){
out++;
}
printf("POINT:%d OUT:%d\n",point,out);
}
//finish ining
printf("%d\n",point);
}
} | a.cc: In function 'int main()':
a.cc:23:28: error: 'strcmp' was not declared in this scope
23 | if(strcmp(str,"HOMERUN")==0){
| ^~~~~~
a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <stdio.h>
+++ |+#include <cstring>
2 |
|
s265772594 | p00103 | C++ | #include <iostream>
#include <string>
 
using namespace std;
 
int main()
{
    int n, o, h, t;
    string s;
    cin >> n;
     
    while(n--)
{
        o = h = t = 0;
        while(o < 3)
{
            cin >> s;
            if(s == "HIT")
{
                if(h == 3)
{
                    t++;
                }
else
{
                    h++;
                }
            } else if(s == "HOMERUN")
{
                t = t + h + 1;
                h = 0;
            }
else
{
                o++;
            }
        }
        cout << t << endl;
    }
     
    return 0;
} | a.cc:3:2: error: stray '#' in program
3 |  
| ^
a.cc:5:2: error: stray '#' in program
5 |  
| ^
a.cc:8:2: error: stray '#' in program
8 |     int n, o, h, t;
| ^
a.cc:8:8: error: stray '#' in program
8 |     int n, o, h, t;
| ^
a.cc:8:14: error: stray '#' in program
8 |     int n, o, h, t;
| ^
a.cc:8:20: error: stray '#' in program
8 |     int n, o, h, t;
| ^
a.cc:9:2: error: stray '#' in program
9 |     string s;
| ^
a.cc:9:8: error: stray '#' in program
9 |     string s;
| ^
a.cc:9:14: error: stray '#' in program
9 |     string s;
| ^
a.cc:9:20: error: stray '#' in program
9 |     string s;
| ^
a.cc:10:2: error: stray '#' in program
10 |     cin >> n;
| ^
a.cc:10:8: error: stray '#' in program
10 |     cin >> n;
| ^
a.cc:10:14: error: stray '#' in program
10 |     cin >> n;
| ^
a.cc:10:20: error: stray '#' in program
10 |     cin >> n;
| ^
a.cc:11:2: error: stray '#' in program
11 |      
| ^
a.cc:11:8: error: stray '#' in program
11 |      
| ^
a.cc:11:14: error: stray '#' in program
11 |      
| ^
a.cc:11:20: error: stray '#' in program
11 |      
| ^
a.cc:11:26: error: stray '#' in program
11 |      
| ^
a.cc:12:2: error: stray '#' in program
12 |     while(n--)
| ^
a.cc:12:8: error: stray '#' in program
12 |     while(n--)
| ^
a.cc:12:14: error: stray '#' in program
12 |     while(n--)
| ^
a.cc:12:20: error: stray '#' in program
12 |     while(n--)
| ^
a.cc:14:2: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:8: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:14: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:20: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:26: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:32: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:38: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:14:44: error: stray '#' in program
14 |         o = h = t = 0;
| ^
a.cc:15:2: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:8: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:14: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:20: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:26: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:32: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:38: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:15:44: error: stray '#' in program
15 |         while(o < 3)
| ^
a.cc:17:2: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:8: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:14: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:20: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:26: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:32: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:38: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:44: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:50: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:56: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:62: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:17:68: error: stray '#' in program
17 |             cin >> s;
| ^
a.cc:18:2: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:8: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:14: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:20: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:26: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:32: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:38: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:44: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:50: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:56: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:62: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:18:68: error: stray '#' in program
18 |             if(s == "HIT")
| ^
a.cc:20:2: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:8: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:14: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:20: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:26: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:32: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:38: error: stray '#' in program
20 |                 if(h == 3)
| ^
a.cc:20:44: error: stray '#' in program
20 |                 if(h == 3)
| |
s880057965 | p00103 | C++ | int main(){
int n;
string input;
int out;
cin >> n;
for(int i = 0; i < n; i++)
{
first = second = third = out = point = 0;
out = 0;
while(out < 3)
{
cin >> input;
if(input == "OUT")
{
out++;
continue;
}
else if(input == "HIT")
{
point += third;
third = second;
second = first;
first = 1;
continue;
}
else if(input == "HOMERUN")
{
point += first + second + third + 1;
first = second = third = 0;
continue;
}
}
cout << point << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:3:3: error: 'string' was not declared in this scope
3 | string input;
| ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope
5 | cin >> n;
| ^~~
a.cc:8:5: error: 'first' was not declared in this scope
8 | first = second = third = out = point = 0;
| ^~~~~
a.cc:8:13: error: 'second' was not declared in this scope
8 | first = second = third = out = point = 0;
| ^~~~~~
a.cc:8:22: error: 'third' was not declared in this scope
8 | first = second = third = out = point = 0;
| ^~~~~
a.cc:8:36: error: 'point' was not declared in this scope; did you mean 'int'?
8 | first = second = third = out = point = 0;
| ^~~~~
| int
a.cc:12:14: error: 'input' was not declared in this scope; did you mean 'int'?
12 | cin >> input;
| ^~~~~
| int
a.cc:33:5: error: 'cout' was not declared in this scope; did you mean 'out'?
33 | cout << point << endl;
| ^~~~
| out
a.cc:33:22: error: 'endl' was not declared in this scope
33 | cout << point << endl;
| ^~~~
|
s966205692 | p00103 | C++ | #include <iostream>
#include <string>
#include <array>
int Baseball()
{
int num_of_runner = 0, num_of_out = 0, point = 0;
std::string event;
while(num_of_out != 3){
std::cin >> event;
switch(event){
case HIT:
if(num_of_runner == 3);
++point;
else
++num_of_runner;
break;
case HOMERUN:
point += 1 + num_of_runner;
num_of_runner = 0;
break;
case OUT:
++num_of_out;
break;
}
}
return point;
}
int main()
{
u_int num_of_inning;
std::cin >> num_of_inning;
for(u_int i = 0; i < num_of_inning; ++i){
std::cout << Baseball() << std::endl;
}
return 0;
} | a.cc: In function 'int Baseball()':
a.cc:11:16: error: switch quantity not an integer
11 | switch(event){
| ^~~~~
a.cc:12:18: error: 'HIT' was not declared in this scope
12 | case HIT:
| ^~~
a.cc:15:17: error: 'else' without a previous 'if'
15 | else
| ^~~~
a.cc:18:18: error: 'HOMERUN' was not declared in this scope
18 | case HOMERUN:
| ^~~~~~~
a.cc:22:18: error: 'OUT' was not declared in this scope
22 | case OUT:
| ^~~
|
s205143992 | p00103 | C++ | #include <iostream>
#include <string>
int Baseball()
{
int num_of_runner = 0, num_of_out = 0, point = 0;
std::string event;
while(num_of_out != 3){
std::cin >> event;
if(event == HIT){
if(num_of_runner == 3)
++point;
else
++num_of_runner;
}
else if(evenr == HOMERUN){
point += 1 + num_of_runner;
num_of_runner = 0;
}
else
++num_of_out;
}
return point;
}
int main()
{
u_int num_of_inning;
std::cin >> num_of_inning;
for(u_int i = 0; i < num_of_inning; ++i){
std::cout << Baseball() << std::endl;
}
return 0;
} | a.cc: In function 'int Baseball()':
a.cc:10:21: error: 'HIT' was not declared in this scope
10 | if(event == HIT){
| ^~~
a.cc:16:17: error: 'evenr' was not declared in this scope; did you mean 'event'?
16 | else if(evenr == HOMERUN){
| ^~~~~
| event
a.cc:16:26: error: 'HOMERUN' was not declared in this scope
16 | else if(evenr == HOMERUN){
| ^~~~~~~
|
s511351528 | p00103 | C++ | #include <iostream>
#include <string>
int Baseball()
{
const u_int num_of_event = 100;
int num_of_runner = 0, num_of_out = 0, point = 0;
std::string event;
for(u_int i = 0; i < num_of_event; ++i){
std::cin >> event;
if(event == "HIT"){
if(num_of_runner == 3)
++point;
else
++num_of_runner;
}
else if(event == "HOMERUN"){
point += 1 + num_of_runner;
num_of_runner = 0;
}
else{
++num_of_out;
if(num_of_out == 3)
break;
}
return point;
}
int main()
{
u_int num_of_inning;
std::cin >> num_of_inning;
for(u_int i = 0; i < num_of_inning; ++i){
std::cout << Baseball() << std::endl;
}
return 0;
} | a.cc: In function 'int Baseball()':
a.cc:31:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
31 | int main()
| ^~
a.cc:31:9: note: remove parentheses to default-initialize a variable
31 | int main()
| ^~
| --
a.cc:31:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:32:1: error: a function-definition is not allowed here before '{' token
32 | {
| ^
a.cc:41:2: error: expected '}' at end of input
41 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
a.cc:41:2: warning: control reaches end of non-void function [-Wreturn-type]
41 | }
| ^
|
s981752447 | p00103 | C++ | #include <iostream>
#include <string>
class Baseball
{
u_int runner, out, point;
public:
Baseball();
~Baseball(){}
u_int get_out() const {return out;}
u_int get_point() const {return point;}
void game();
void event_hit();
void event_homerun();
void event_out();
private:
void set_runner(const u_int r) {runner = r;}
void inc_runner() {++runner;}
void inc_out() {++out;}
void add_point(const u_int p) {point += p;}
};
Baseball::Baseball()
{
runner = 0;
out = 0;
point = 0;
}
void Baseball::game()
{
std::string event;
while(get_out() != 3){
std::cin >> event;
if(event == "HIT"){
event_hit();
}
else if(event == "HOMERUN"){
event_homerun();
}
else{
event_out();
}
}
}
void Baseball::event_hit()
{
if(get_runner() == 3){
add_point(1);
}
else{
inc_runner();
}
}
void Baseball::event_homerun()
{
add_point(1 + get_runner());
set_runner(0);
}
void Baseball::event_out()
{
inc_out();
}
int main()
{
u_int inning;
std::cin >> inning;
for(u_int i = 0; i < inning; ++i){
Baseball b_ball;
b_ball.game();
std::cout << b_ball.get_point() << std::endl;
}
return 0;
} | a.cc: In member function 'void Baseball::event_hit()':
a.cc:53:8: error: 'get_runner' was not declared in this scope; did you mean 'set_runner'?
53 | if(get_runner() == 3){
| ^~~~~~~~~~
| set_runner
a.cc: In member function 'void Baseball::event_homerun()':
a.cc:63:19: error: 'get_runner' was not declared in this scope; did you mean 'set_runner'?
63 | add_point(1 + get_runner());
| ^~~~~~~~~~
| set_runner
|
s623691523 | p00103 | C++ | #include <iostream>
#include <queue>
#include <string>
class Baseball{
private:
std::queue<int> runner;
int out_count;
int score;
public:
void Baseball::initRunner(){
while(runner.empty() != true){
runner.pop();
}
for(int i = 0; i < 3; ++i){
runner.push(0);
}
}
Baseball(){
out_count = 0;
score = 0;
initRunner();
}
~Baseball(){}
void Baseball::hit(){
if(runner.front() == 1) ++score;
runner.pop();
runner.push(1);
}
void Baseball::homerun(){
do{
if(runner.front() == 1) ++score;
runner.pop();
} while (runner.empty() != true);
++score;
initRunner();
}
int Baseball::getScore(){
std::string str;
while(out_count != 3){
std::cin >> str;
if(str == "HIT") hit();
if(str == "HOMERUN") homerun();
if(str == "OUT") ++out_count;
}
return score;
}
};
int main(void){
int N;
std::cin >> N;
for(int i = 0; i < N; ++i){
Baseball baseball;
std::cout << baseball.getScore() << std::endl;
}
} | a.cc:12:14: error: extra qualification 'Baseball::' on member 'initRunner' [-fpermissive]
12 | void Baseball::initRunner(){
| ^~~~~~~~
a.cc:29:14: error: extra qualification 'Baseball::' on member 'hit' [-fpermissive]
29 | void Baseball::hit(){
| ^~~~~~~~
a.cc:35:14: error: extra qualification 'Baseball::' on member 'homerun' [-fpermissive]
35 | void Baseball::homerun(){
| ^~~~~~~~
a.cc:44:13: error: extra qualification 'Baseball::' on member 'getScore' [-fpermissive]
44 | int Baseball::getScore(){
| ^~~~~~~~
|
s234682106 | p00103 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
using namespace std;
int main(){
int n;
cin>>n;
rep(i,n){
int out=0;
int r1=0,r2=0,r3=0;
int tm=0;
while(out!=3){
char in[10];
cin>>in;
if(strcmp(in,"OUT")==0)out++;
if(strcmp(in,"HIT")==0){
if(r3==1){tm++;r3=0;}
if(r2==1){r3=1;r2=0;}
if(r1==1){r2=1;r1=0;}
r1++;
}
if(strcmp(in,"HOMERUN")==0){
if(r1==1){tm++;r1=0;}
if(r2==1){tm++;r2=0;}
if(r3==1){tm++;r3=0;}
tm++;
}
}
cout<<tm<<endl;
}
} | a.cc: In function 'int main()':
a.cc:21:4: error: 'strcmp' was not declared in this scope
21 | if(strcmp(in,"OUT")==0)out++;
| ^~~~~~
a.cc:7:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include<cmath>
+++ |+#include <cstring>
7 | #define pb(in,tmp) in.push_back(tmp)
a.cc:22:4: error: 'strcmp' was not declared in this scope
22 | if(strcmp(in,"HIT")==0){
| ^~~~~~
a.cc:22:4: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:28:4: error: 'strcmp' was not declared in this scope
28 | if(strcmp(in,"HOMERUN")==0){
| ^~~~~~
a.cc:28:4: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s938354353 | p00104 | Java | t H,W;
Scanner sc = new Scanner(System.in);
while(true){
H = sc.nextInt();
W = sc.nextInt();
if(H == 0 || W == 0){
break;
}
char [][] array = new char[H][W];
sc.nextLine();
for(int i = 0; i < H; i++){
String line = sc.nextLine();
for(int j = 0; j < W; j++){
array[i][j] = line.charAt(j);
}
}
int i = 0;
int j = 0;
boolean flag = true;
boolean visit[][] = new boolean[H][W];
here:while(flag){
if(visit[i][j]){
System.out.println("LOOP");
break here;
}
visit[i][j] = true;
switch(array[i][j]){
case '>':
j++;
break;
case '<':
j--;
break;
case '^':
i--;
break;
case 'v':
i++;
break;
case '.':
System.out.println(j+" "+i);
break here;
}
}
}
}
} | Main.java:1: error: class, interface, enum, or record expected
t H,W;
^
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
Scanner sc = new Scanner(System.in);
^
(use --enable-preview to enable unnamed classes)
Main.java:3: error: class, interface, enum, or record expected
while(true){
^
Main.java:5: error: class, interface, enum, or record expected
W = sc.nextInt();
^
Main.java:6: error: class, interface, enum, or record expected
if(H == 0 || W == 0){
^
Main.java:8: error: class, interface, enum, or record expected
}
^
Main.java:10: error: class, interface, enum, or record expected
sc.nextLine();
^
Main.java:11: error: class, interface, enum, or record expected
for(int i = 0; i < H; i++){
^
Main.java:11: error: class, interface, enum, or record expected
for(int i = 0; i < H; i++){
^
Main.java:11: error: class, interface, enum, or record expected
for(int i = 0; i < H; i++){
^
Main.java:13: error: class, interface, enum, or record expected
for(int j = 0; j < W; j++){
^
Main.java:13: error: class, interface, enum, or record expected
for(int j = 0; j < W; j++){
^
Main.java:13: error: class, interface, enum, or record expected
for(int j = 0; j < W; j++){
^
Main.java:15: error: class, interface, enum, or record expected
}
^
Main.java:20: error: class, interface, enum, or record expected
boolean visit[][] = new boolean[H][W];
^
Main.java:21: error: class, interface, enum, or record expected
here:while(flag){
^
Main.java:24: error: class, interface, enum, or record expected
break here;
^
Main.java:25: error: class, interface, enum, or record expected
}
^
Main.java:27: error: class, interface, enum, or record expected
switch(array[i][j]){
^
Main.java:30: error: class, interface, enum, or record expected
break;
^
Main.java:31: error: class, interface, enum, or record expected
case '<':
^
Main.java:33: error: class, interface, enum, or record expected
break;
^
Main.java:34: error: class, interface, enum, or record expected
case '^':
^
Main.java:36: error: class, interface, enum, or record expected
break;
^
Main.java:37: error: class, interface, enum, or record expected
case 'v':
^
Main.java:39: error: class, interface, enum, or record expected
break;
^
Main.java:40: error: class, interface, enum, or record expected
case '.':
^
Main.java:42: error: class, interface, enum, or record expected
break here;
^
Main.java:43: error: class, interface, enum, or record expected
}
^
29 errors
|
s120305090 | p00104 | Java | process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
main(chunk.trim());
});
function main(chunk){
var lines = chunk.split("\n");
for(var n=0;n<lines.length-1;){
var H = Number(lines[n].split(" ")[0]);
var W = Number(lines[n].split(" ")[1]);
var map = [];
n++;
for(var i=0;i<H;i++){
map[i] = lines[n].split("");
n++;
}
console.log(calc(map,0,0));
}
}
function calc(map,h,w){
if(map[h][w] == "."){
return w + " "+ h;
}
if(map[h][w] == "1"){
return "LOOP";
}
switch(map[h][w]){
case '>':
map[h][w] = "1";
return calc(map,h,w+1);
case '<':
map[h][w] = "1";
return calc(map,h,w-1);
case 'v':
map[h][w] = "1";
return calc(map,h+1,w);
case '^':
map[h][w] = "1";
return calc(map,h-1,w);
}
} | Main.java:1: error: class, interface, enum, or record expected
process.stdin.resume();
^
Main.java:2: error: class, interface, enum, or record expected
process.stdin.setEncoding('utf8');
^
Main.java:2: error: unclosed character literal
process.stdin.setEncoding('utf8');
^
Main.java:2: error: unclosed character literal
process.stdin.setEncoding('utf8');
^
Main.java:3: error: class, interface, enum, or record expected
process.stdin.on('data', function(chunk) {
^
Main.java:3: error: unclosed character literal
process.stdin.on('data', function(chunk) {
^
Main.java:3: error: unclosed character literal
process.stdin.on('data', function(chunk) {
^
Main.java:5: error: class, interface, enum, or record expected
});
^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
function main(chunk){
^
(use --enable-preview to enable unnamed classes)
Main.java:7: error: <identifier> expected
function main(chunk){
^
Main.java:12: error: illegal start of expression
var map = [];
^
Main.java:21: error: <identifier> expected
function calc(map,h,w){
^
Main.java:21: error: <identifier> expected
function calc(map,h,w){
^
Main.java:21: error: <identifier> expected
function calc(map,h,w){
^
14 errors
|
s244346067 | p00104 | Java | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new MagicTiles().solve();
}
public void solve() {
Scanner input = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int H, W;
char[][] maze = new char[101][101];
while (true) {
String[] tmp = input.nextLine().split(" ");
H = Integer.parseInt(tmp[0]);
W = Integer.parseInt(tmp[1]);
if(H == 0 && W == 0) break;
for (int i = 0; i < H; i++) {
maze[i] = input.nextLine().toCharArray();
}
int ii = 0, jj = 0;
while(maze[ii][jj] != '.' && maze[ii][jj] != 'X') {
if(maze[ii][jj] == '>') { maze[ii][jj] = 'X'; jj += 1; continue; }
if(maze[ii][jj] == '<') { maze[ii][jj] = 'X'; jj -= 1; continue; }
if(maze[ii][jj] == '^') { maze[ii][jj] = 'X'; ii -= 1; continue; }
if(maze[ii][jj] == 'v') { maze[ii][jj] = 'X'; ii += 1; continue; }
}
if(maze[ii][jj] == 'X') {
out.println("LOOP");
} else {
out.println(jj + " " + ii);
}
}
input.close();
out.close();
System.exit(0);
}
} | Main.java:6: error: cannot find symbol
new MagicTiles().solve();
^
symbol: class MagicTiles
location: class Main
1 error
|
s904770811 | p00104 | Java | import java.util.*;
public class Main {
int w,h;
int[][] map;
int[][] cost;
int ansx, ansy;
public void loop(int y, int x, int d){
if(map[y][x]==0){
System.out.println(x + " " + y);
return;
}
cost[y][x] = 1;
if(d==1){
if(cost[y-1][x]==1){
System.out.println("LOOP");
return;
}else{
loop(y-1,x,map[y-1][x]);
}
}else if(d==2){
if(cost[y][x+1]==1){
System.out.println("LOOP");
return;
}else{
loop(y,x+1,map[y][x+1]);
}
}else if(d==3){
if(cost[y+1][x]==1){
System.out.println("LOOP");
return;
}else{
loop(y+1,x,map[y+1][x]);
}
}else if(d==4){
if(cost[y][x-1]==1){
System.out.println("LOOP");
return;
}else{
loop(y,x-1,map[y][x-1]);
}
}
}
public static void main(String[] args) {
AOJ_0104 A = new AOJ_0104();
Scanner sc = new Scanner(System.in);
while(true){
A.h = sc.nextInt();
A.w = sc.nextInt();
if(A.h==0 && A.w==0)break;
A.map = new int[A.h][A.w];
A.cost = new int[A.h][A.w];
for(int i=0;i<A.h;i++){
String s = sc.next();
for(int j=0;j<A.w;j++){
String t = s.substring(j,j+1);
if(t.compareTo("^")==0){
A.map[i][j] = 1;
}else if(t.compareTo(">")==0){
A.map[i][j] = 2;
}else if(t.compareTo("v")==0){
A.map[i][j] = 3;
}else if(t.compareTo("<")==0){
A.map[i][j] = 4;
}
}
}
A.loop(0, 0, A.map[0][0]);
}
}
} | Main.java:51: error: cannot find symbol
AOJ_0104 A = new AOJ_0104();
^
symbol: class AOJ_0104
location: class Main
Main.java:51: error: cannot find symbol
AOJ_0104 A = new AOJ_0104();
^
symbol: class AOJ_0104
location: class Main
2 errors
|
s573456200 | p00104 | C | #include <cstdio>
#include <cstring>
using namespace std;
int main(){
int n,m,k,l,b[105][105]={0};
char a[105][105];
while(1){
scanf("%d %d ",&n,&m);
if( n==0 && m==0 ) break;
k=0; l=0;
for(int i=0 ; i<n ; i++ ){
scanf("%s",&a[i]);
}
while(1){
if(a[k][l]=='.'){
printf("%d %d\n",l,k);
break;
}
if(b[k][l]==1){
printf("LOOP\n");
break;
}
if(a[k][l]=='>'){
b[k][l]=1;
l++;
continue;
}
if(a[k][l]=='v'){
b[k][l]=1;
k++;
continue;
}
if(a[k][l]=='<' ){
b[k][l]=1;
l--;
continue;
}
if(a[k][l]=='^' ){
b[k][l]=1;
k--;
continue;
}
}
}
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s719857467 | p00104 | C | #include <stdio.h>
#define RIGHT '>'
#define LEFT '<'
#define TOP '^'
#define UNDER 'v'
#define LOOP 'l'
#define END '.'
#define MAX 101
void dfs(char mp[MAX][MAX],int i,int j){
if(mp[i][j]==END){
printf("%d %d\n" ,j ,i);
return;
}
if(mp[i][j]==LOOP){
printf("LOOP\n");
return;
}
if(mp[i][j]==RIGHT){
mp[i][j] = LOOP;
dfs(mp,i,j+1);
}
else if(mp[i][j]==LEFT){
mp[i][j] = LOOP;
dfs(mp,i,j-1);
}
else if(mp[i][j]==TOP){
mp[i][j] = LOOP;
dfs(mp,i-1,j);
}
else{
mp[i][j] = LOOP;
dfs(mp,i+1,j);
}
}
int main(){
char mp[MAX][MAX];
int n,m;
while(true){
scanf("%d%d" ,&n ,&m);
if(!n&&!m) break;
for(int i = 0 ; i < n ; i++) scanf("%s" ,mp[i]);
dfs(mp,0,0);
}
return 0;
} | main.c: In function 'main':
main.c:44:11: error: 'true' undeclared (first use in this function)
44 | while(true){
| ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include <stdio.h>
+++ |+#include <stdbool.h>
2 |
main.c:44:11: note: each undeclared identifier is reported only once for each function it appears in
44 | while(true){
| ^~~~
|
s100744925 | p00104 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int h,w;
while(cin>>h>>w,w||h){
string a;
for(int i=0;i<w;i++){
for(int j=0;j<h;j++){
cin>>a[i][j];
}
}
bool flag=true;
int i=0,j=0;
while(flag){
flag=true;
if(a[i][j]=='v'){
i++;
a[i][j]='!';
}
if(a[i][j]=='>'){
j++;
a[i][j]='!';
}
if(a[i][j]=='<'){
j--;
a[i][j]='!';
}
if(a[i][j]=='^'){
i--;
a[i][j]='!';
}
if(a[i][j]=='.'){
break;
}
if(a[i][j]=='!'){
flag=false;
}
}
if(!flag){
cout<<"LOOP"<<endl;
}
else{
cout<<j<<' '<<i<<endl;
}
}
} | a.cc: In function 'int main()':
a.cc:10:42: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
10 | cin>>a[i][j];
| ^
a.cc:17:32: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
17 | if(a[i][j]=='v'){
| ^
a.cc:19:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
19 | a[i][j]='!';
| ^
a.cc:21:32: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
21 | if(a[i][j]=='>'){
| ^
a.cc:23:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
23 | a[i][j]='!';
| ^
a.cc:25:32: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
25 | if(a[i][j]=='<'){
| ^
a.cc:27:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
27 | a[i][j]='!';
| ^
a.cc:29:32: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
29 | if(a[i][j]=='^'){
| ^
a.cc:31:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
31 | a[i][j]='!';
| ^
a.cc:33:32: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
33 | if(a[i][j]=='.'){
| ^
a.cc:36:32: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
36 | if(a[i][j]=='!'){
| ^
|
s039016590 | p00104 | C++ | #include<iosteram>
#include<string>
using namespace std;
int main(void){
int w,h;
while(cin>>>h>>w,h){
string f[h];
for(int i=0,i<h;i++){
cin>>f[i];
}
int x,y;
x=y=0;
bool used[h][w];
memset(used,0,sizeof(used));
while(true){
if(used[y][x]){
cout<<"LOOP"<<endl;
break;
}
if(f[y][x]=='.'){
cout<<x<<" "<<y<<endl;
break;
}
used[y][x]=true;
}
switch(f[y][x]){
case '>': x+=1; break;
case '<': x-=1; break;
case '^': y-=1; break;
case 'v': y+=1; break;
}
}
} | a.cc:1:9: fatal error: iosteram: No such file or directory
1 | #include<iosteram>
| ^~~~~~~~~~
compilation terminated.
|
s081338147 | p00104 | C++ | #include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <set>
using namespace std;
void calc(vector<vector<char> >, int y, int x);
int resultx;
int resulty;
set<string> passed;
int main() {
while(true) {
int width, height;
cin >> width >> height;
if(width == 0 && height == 0) break;
vector<vector<char> > field(width, vector<char>(height));
for(int w = 0; w < width; ++w) {
for(int h = 0; h < height; ++h) {
cin >> field[w][h];
}
}
if(calc(field, 0, 0)) cout << resulty << " " << resultx << endl;
}
return 0;
}
bool calc(vector<vector<char> > field, int y, int x) {
stringstream ss;
ss << y << ',' << x;
// cout << ss.str() << endl;
if(passed.find(ss.str()) != passed.end()) {
cout << "LOOP" << endl;
return false;
}
passed.insert(ss.str());
switch(field[x][y]) {
case '>':
calc(field, y + 1, x);
break;
case '<':
calc(field, y - 1, x);
break;
case '^':
calc(field, y, x - 1);
break;
case 'v':
calc(field, y, x + 1);
break;
case '.':
resultx = x;
resulty = y;
return true;
}
} | a.cc: In function 'int main()':
a.cc:23:10: error: could not convert 'calc(std::vector<std::vector<char> >(field), 0, 0)' from 'void' to 'bool'
23 | if(calc(field, 0, 0)) cout << resulty << " " << resultx << endl;
| ~~~~^~~~~~~~~~~~~
| |
| void
a.cc: At global scope:
a.cc:28:6: error: ambiguating new declaration of 'bool calc(std::vector<std::vector<char> >, int, int)'
28 | bool calc(vector<vector<char> > field, int y, int x) {
| ^~~~
a.cc:7:6: note: old declaration 'void calc(std::vector<std::vector<char> >, int, int)'
7 | void calc(vector<vector<char> >, int y, int x);
| ^~~~
a.cc: In function 'bool calc(std::vector<std::vector<char> >, int, int)':
a.cc:55:1: warning: control reaches end of non-void function [-Wreturn-type]
55 | }
| ^
|
s080414739 | p00104 | C++ | loop do
n,m=gets.split.map(&:to_i)
break if n==0
px,py,cnt=0,0,0
arr=Array.new()
n.times do
arr<<gets.chomp.split("")
end
loop do
case arr[py][px]
when "<" then px-=1
when ">" then px+=1
when "^" then py-=1
when "v" then py+=1
else break
end
cnt+=1
break if cnt>n*m
end
puts cnt>n*m ? "LOOP": "#{px} #{py}"
end | a.cc:1:1: error: 'loop' does not name a type
1 | loop do
| ^~~~
|
s217453505 | p00104 | C++ | int main(int argc, char **argv)
{
int h, w;
int x = 0, y = 0;
char tiles[100][100];
bool throughed[100][100] = {};
bool loop = false;
bool end = false;
while(std::cin >> h >> w, h+w != 0){
x = 0;
y = 0;
for(int i = 0; i < 100; i++){
for(int j = 0; j < 100; j++){
throughed[j][i] = false;
}
}
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
std::cin >> tiles[j][i];
}
}
while(true){
if(throughed[x][y]){
loop = true;
break;
}
throughed[x][y] = true;
switch(tiles[x][y]){
case '.':
end = true;
break;
case '^':
y--;
break;
case 'v':
y++;
break;
case '<':
x--;
break;
case '>':
x++;
break;
}
if(end){
break;
}
}
if(loop){
std::cout << "LOOP" << std::endl;
}else{
std::cout << x << " " << y << std::endl;
}
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:9:20: error: 'cin' is not a member of 'std'
9 | while(std::cin >> h >> w, h+w != 0){
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | int main(int argc, char **argv)
a.cc:19:38: error: 'cin' is not a member of 'std'
19 | std::cin >> tiles[j][i];
| ^~~
a.cc:19:38: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:50:30: error: 'cout' is not a member of 'std'
50 | std::cout << "LOOP" << std::endl;
| ^~~~
a.cc:50:30: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:50:53: error: 'endl' is not a member of 'std'
50 | std::cout << "LOOP" << std::endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | int main(int argc, char **argv)
a.cc:52:30: error: 'cout' is not a member of 'std'
52 | std::cout << x << " " << y << std::endl;
| ^~~~
a.cc:52:30: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:52:60: error: 'endl' is not a member of 'std'
52 | std::cout << x << " " << y << std::endl;
| ^~~~
a.cc:52:60: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s973803969 | p00104 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
char s[101][101];
int n,m,a[100][100],c;
using namespace std;
void dfs(int y,int x){
if(c)goto Z;
if(a[y][x]++)goto L;
if(s[y][x]=='.'){cout<<x<<' '<<y<<endl;p++;}
else if(s[y][x]=='^')dfs(y-1,x);
else if(s[y][x]=='v')dfs(y+1,x);
else if(s[y][x]=='>')dfs(y,x+1);
else if(s[y][x]=='<')dfs(y,x-1);
L:cout<<"LOOP"<<endl;p++;Z:;
}
int main(){
while(cin>>n>>m,n){c=0;
rep(i,100)rep(j,100)a[i][j]=0;
rep(i,n)rep(j,m)cin>>s[i][j];dfs(0,0);
}
} | a.cc: In function 'void dfs(int, int)':
a.cc:9:42: error: 'p' was not declared in this scope
9 | if(s[y][x]=='.'){cout<<x<<' '<<y<<endl;p++;}
| ^
a.cc:14:24: error: 'p' was not declared in this scope
14 | L:cout<<"LOOP"<<endl;p++;Z:;
| ^
|
s669671199 | p00104 | C++ | #include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
while (cin >> a >> b) {
if (a == 0 && b == 0) {
break;
}
char data[102][102];
int b[a][b] = { 0 };
for(int i=0; i< a; i++){
for(int j=0; j< b; j++){
cin >> data[i][j];
}
}
int H = 0, W = 0;
int loop = 0;
while (1) {
if (data[H][W] == '<') {
b[H][W] = 1;
W -= 1;
if (b[H][W] == 1) {
loop = 1;
break;
}
} else if (data[H][W] == '>') {
b[H][W] = 1;
W += 1;
if (b[H][W] == 1) {
loop = 1;
break;
}
} else if (data[H][W] == 'v') {
b[H][W] = 1;
H += 1;
if (b[H][W] == 1) {
loop = 1;
break;
}
} else if (data[H][W] == '^') {
b[H][W] = 1;
H -= 1;
if (b[H][W] == 1) {
loop = 1;
break;
}
} else {
break;
}
}
if (loop != 1) {
printf("%d %d\n", W, H);
} else {
printf("LOOP\n");
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | for(int j=0; j< b; j++){
| ~^~~
|
s392713559 | p00104 | C++ | #include <iostream>
#include <stdio.h>
#include <time.h>
#include<string>
using namespace std;
int main(){
char tile[101][101];
int dp[101][101]={0};
bool finished=false;
int x,y;
while(1){
cin>>y>>x;
memset(dp,0,sizeof(dp));
finished=false;
if(y==0 && x==0){
break;
}
for(int i=0;i<y;i++){
for(int j=0;j<x;j++){
cin>>tile[i][j];
}
}int i=0,j=0;
while(1){
switch(tile[i][j]){
case '>': j++ ;dp[i][j]++;break;
case '<': j--;dp[i][j]++;break;
case '^': i--;dp[i][j]++;break;
case 'v': i++;dp[i][j]++;break;
case '.': cout<<j<<" "<<i<<endl;finished=true; break;
}
if(finished==true){
break;
}
if(dp[i][j]==2){
cout<<"LOOP"<<endl;
break;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
13 | memset(dp,0,sizeof(dp));
| ^~~~~~
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 | #include <stdio.h>
|
s971861813 | p00104 | C++ | #include <iostream>
#include <stdio.h>
#include <time.h>
#include<string>
using namespace std;
int main(){
char tile[101][101];
int dp[101][101]={0};
bool finished=false;
int x,y;
while(1){
cin>>y>>x;
memset(dp,0,sizeof(dp)-1);
finished=false;
if(y==0 && x==0){
break;
}
for(int i=0;i<y;i++){
for(int j=0;j<x;j++){
cin>>tile[i][j];
}
}int i=0,j=0;
while(1){
switch(tile[i][j]){
case '>': j++ ;dp[i][j]++;break;
case '<': j--;dp[i][j]++;break;
case '^': i--;dp[i][j]++;break;
case 'v': i++;dp[i][j]++;break;
case '.': cout<<j<<" "<<i<<endl;finished=true; break;
}
if(finished==true){
break;
}
if(dp[i][j]==2){
cout<<"LOOP"<<endl;
break;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
13 | memset(dp,0,sizeof(dp)-1);
| ^~~~~~
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 | #include <stdio.h>
|
s367152463 | p00104 | C++ | import java.util.*;
class Main {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
while(true){
int h = in.nextInt(), w = in.nextInt();
if(w==0 && h==0) return ;
String board[] = new String[h];
for(int i=0; i<h; i++){
board[i] = in.next();
}
int cx = 0, cy = 0;
boolean isLoop = false;
HashSet<Integer> s = new HashSet<Integer>();
while(board[cy].charAt(cx) != '.'){
char c = board[cy].charAt(cx);
cx += (c == '>')?1:(c == '<')?-1:0;
cy += (c == '^')?-1:(c == 'v')?1:0;
if(s.contains(new Integer(cx*10000+cy))){
isLoop = true;
break;
}
else{
s.add(new Integer(cx*10000+cy));
}
}
if(isLoop){
System.out.println("LOOP");
}
else{
System.out.println(cx + " " + cy);
}
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
4 | public static void main(String args[]){
| ^~~~~~~
| :
a.cc:4:33: error: 'String' has not been declared
4 | public static void main(String args[]){
| ^~~~~~
a.cc:37:2: error: expected ';' after class definition
37 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:17: error: 'Scanner' was not declared in this scope
5 | Scanner in = new Scanner(System.in);
| ^~~~~~~
a.cc:7:33: error: 'in' was not declared in this scope; did you mean 'int'?
7 | int h = in.nextInt(), w = in.nextInt();
| ^~
| int
a.cc:8:28: error: 'w' was not declared in this scope
8 | if(w==0 && h==0) return ;
| ^
a.cc:9:25: error: 'String' was not declared in this scope
9 | String board[] = new String[h];
| ^~~~~~
a.cc:11:33: error: 'board' was not declared in this scope
11 | board[i] = in.next();
| ^~~~~
a.cc:14:25: error: 'boolean' was not declared in this scope; did you mean 'bool'?
14 | boolean isLoop = false;
| ^~~~~~~
| bool
a.cc:15:25: error: 'HashSet' was not declared in this scope
15 | HashSet<Integer> s = new HashSet<Integer>();
| ^~~~~~~
a.cc:15:33: error: 'Integer' was not declared in this scope
15 | HashSet<Integer> s = new HashSet<Integer>();
| ^~~~~~~
a.cc:15:42: error: 's' was not declared in this scope
15 | HashSet<Integer> s = new HashSet<Integer>();
| ^
a.cc:15:50: error: 'HashSet' does not name a type
15 | HashSet<Integer> s = new HashSet<Integer>();
| ^~~~~~~
a.cc:15:67: error: expected primary-expression before ')' token
15 | HashSet<Integer> s = new HashSet<Integer>();
| ^
a.cc:16:31: error: 'board' was not declared in this scope
16 | while(board[cy].charAt(cx) != '.'){
| ^~~~~
a.cc:20:51: error: expected type-specifier before 'Integer'
20 | if(s.contains(new Integer(cx*10000+cy))){
| ^~~~~~~
a.cc:21:41: error: 'isLoop' was not declared in this scope
21 | isLoop = true;
| ^~~~~~
a.cc:25:51: error: expected type-specifier before 'Integer'
25 | s.add(new Integer(cx*10000+cy));
| ^~~~~~~
a.cc:28:28: error: 'isLoop' was not declared in this scope
28 | if(isLoop){
| ^~~~~~
a.cc:29:33: error: 'System' was not declared in this scope
29 | System.out.println("LOOP");
| ^~~~~~
a.cc:32:33: error: 'System' was not declared in this scope
32 | System.out.println(cx + " " + cy);
| ^~~~~~
|
s535426479 | p00104 | C++ | #include<stdio.h>
#include<windows.h>
char masu[101][101];
int H,W,x,y;
int main()
{
int i,j;
int f,t1,t2;
char temp;
for(;;){
x=0;
y=0;
f=0;
scanf("%d %d", &H, &W);
if(H==0)break;
scanf("%c",&temp);
for(i=0;i<H;i++){
for(j=0;j<W+1;j++){
scanf("%c",&masu[i][j]);
}
}
for(;;){
if(masu[y][x]==','){
f=1;
break;
}
t1=x;
t2=y;
if(masu[y][x]=='>')x++;
else if(masu[y][x]=='<')x--;
else if(masu[y][x]=='v')y++;
else if(masu[y][x]=='^')y--;
else if(masu[y][x]=='.')break;
masu[t2][t1]=',';
}
if(f==1)puts("LOOP");
else printf("%d %d\n",x,y);
}
return 0;
} | a.cc:2:9: fatal error: windows.h: No such file or directory
2 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s761813849 | p00104 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int w,h;
string m[110];
bool f[110][110], flag;
while( cin >> h >> w , w, h ){
flag = false;
for(int y=0 ; y<h ; y++){
m[y].clear();
for(int x=0 ; x<w ; x++){
f[y][x] = false;
}
}
for(int y=0 ; y<h ; y++){
cin >> m[y];
}
int x=0, y=0;
while(1){
if( m[y][x]=='>' ) x++;
if( m[y][x]=='<' ) x--;
if( m[y][x]=='v' ) y++;
if( m[y][x]=='^' ) y--;
if( m[y][x]=='.' || f[y][x] ){
( f[y][x] )? flag = true : ;
break;
}
f[y][x] = true;
}
(flag)? (cout << "LOOP" << endl) : (cout << x << " " << y << endl);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:60: error: expected primary-expression before ';' token
29 | ( f[y][x] )? flag = true : ;
| ^
|
s222227586 | p00104 | C++ | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int w = sc.nextInt();
while(h != 0){
sc.nextLine();
char[][] map = new char[h][w];
boolean[][] passed = new boolean[h][w];
int[] xy = new int[2];
passed[0][0] = true;
for(int i = 0 ; i < h ; i++){
String s = sc.nextLine();
for(int j = 0 ; j < w ; j++){
map[i][j] = s.charAt(j);
}
}
System.out.println((move(map, xy, passed) == 1) ? xy[0] + " " + xy[1] : "LOOP");
h = sc.nextInt();
w = sc.nextInt();
}
}
static int move(char[][] map, int[] xy, boolean[][] passed){
switch(map[xy[1]][xy[0]]){
case '>':
xy[0]++;
break;
case '<':
xy[0]--;
break;
case '^':
xy[1]--;
break;
case 'v':
xy[1]++;
break;
case '.':
return 1;
}
if(passed[xy[1]][xy[0]]){
return -1;
}else{
passed[xy[1]][xy[0]] = true;
return move(map, xy, passed);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
4 | public static void main(String[] args){
| ^~~~~~~
| :
a.cc:4:33: error: 'String' has not been declared
4 | public static void main(String[] args){
| ^~~~~~
a.cc:4:42: error: expected ',' or '...' before 'args'
4 | public static void main(String[] args){
| ^~~~
a.cc:25:32: error: multidimensional array must have bounds for all dimensions except the first
25 | static int move(char[][] map, int[] xy, boolean[][] passed){
| ^
a.cc:25:34: error: expected ',' or '...' before 'map'
25 | static int move(char[][] map, int[] xy, boolean[][] passed){
| ^~~
a.cc:49:2: error: expected ';' after class definition
49 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:17: error: 'Scanner' was not declared in this scope
5 | Scanner sc = new Scanner(System.in);
| ^~~~~~~
a.cc:6:25: error: 'sc' was not declared in this scope
6 | int h = sc.nextInt();
| ^~
a.cc:10:29: error: structured binding declaration cannot have type 'char'
10 | char[][] map = new char[h][w];
| ^~
a.cc:10:29: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:10:29: error: empty structured binding declaration
a.cc:10:31: error: expected initializer before '[' token
10 | char[][] map = new char[h][w];
| ^
a.cc:11:25: error: 'boolean' was not declared in this scope; did you mean 'bool'?
11 | boolean[][] passed = new boolean[h][w];
| ^~~~~~~
| bool
a.cc:11:33: error: expected primary-expression before ']' token
11 | boolean[][] passed = new boolean[h][w];
| ^
a.cc:11:35: error: expected primary-expression before ']' token
11 | boolean[][] passed = new boolean[h][w];
| ^
a.cc:12:28: error: structured binding declaration cannot have type 'int'
12 | int[] xy = new int[2];
| ^~
a.cc:12:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:28: error: empty structured binding declaration
a.cc:12:31: error: expected initializer before 'xy'
12 | int[] xy = new int[2];
| ^~
a.cc:13:25: error: 'passed' was not declared in this scope
13 | passed[0][0] = true;
| ^~~~~~
a.cc:15:33: error: 'String' was not declared in this scope
15 | String s = sc.nextLine();
| ^~~~~~
a.cc:17:41: error: 'map' was not declared in this scope
17 | map[i][j] = s.charAt(j);
| ^~~
a.cc:17:53: error: 's' was not declared in this scope
17 | map[i][j] = s.charAt(j);
| ^
a.cc:20:25: error: 'System' was not declared in this scope
20 | System.out.println((move(map, xy, passed) == 1) ? xy[0] + " " + xy[1] : "LOOP");
| ^~~~~~
a.cc:20:50: error: 'map' was not declared in this scope
20 | System.out.println((move(map, xy, passed) == 1) ? xy[0] + " " + xy[1] : "LOOP");
| ^~~
a.cc:20:55: error: 'xy' was not declared in this scope
20 | System.out.println((move(map, xy, passed) == 1) ? xy[0] + " " + xy[1] : "LOOP");
| ^~
a.cc: In static member function 'static int Main::move(...)':
a.cc:26:24: error: 'map' was not declared in this scope
26 | switch(map[xy[1]][xy[0]]){
| ^~~
a.cc:26:28: error: 'xy' was not declared in this scope
26 | switch(map[xy[1]][xy[0]]){
| ^~
a.cc:42:20: error: 'passed' was not declared in this scope
42 | if(passed[xy[1]][xy[0]]){
| ^~~~~~
a.cc:42:27: error: 'xy' was not declared in this scope
42 | if(passed[xy[1]][xy[0]]){
| ^~
a.cc:46:37: error: 'map' was not declared in this scope
46 | return move(map, xy, passed);
| ^~~
|
s830763732 | p00104 | C++ | #include<iostream>
#include<vector>
#include<string>
using namespace std;
char f[101][101];
int judge[101][101];
int ex, ey;
void move(int i, int j)
{
//printf("%3d:%3d\n", i, j);
if(judge[i][j] == 1)
{
ex = -1; ey = -1;
return;
}
else if(f[i][j] == '.')
{
ex = j; ey = i;
returan;
}
judge[i][j] = 1;
if(f[i][j] == '>')
{
move(i, j+1);
}
else if(f[i][j] == '<')
{
move(i, j-1);
}
else if(f[i][j] == '^')
{
move(i-1, j);
}
else if(f[i][j] == 'v')
{
move(i+1, j);
}
}
int main()
{
int w, h;
while(cin >> h >> w)
{
if(h == 0 && w == 0) break;
for(int i = 0; i < h; i++)
{
cin >> f[i];
}
/*
for(int i = 0; i < h; i++)
{
for(int j = 0; j < w; j++)
{
cout << f[i][j];
}
cout << endl;
}
*/
//cout << "Run" << endl;
move(0, 0);
//cout << "Finish" << endl;
if(ex == -1 && ey == -1)
{
cout << "LOOP" << endl;
}
else
{
cout << ex << ' ' << ey << endl;
}
}
} | a.cc: In function 'void move(int, int)':
a.cc:22:17: error: 'returan' was not declared in this scope
22 | returan;
| ^~~~~~~
|
s200558105 | p00104 | C++ | #include<cstdio>
#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
int W,H;
char fie[102][102];
int cost[102][102];
char df[]={'>','v','<','^'};
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
while(1){
cin >> W >> H;
memset(fie,-1,sizeof(fie));
memset(cost,0,sizeof(cost));
if(W==0 && H==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin >> fie[j][i];
}
}
int x=0,y=0;
bool f=false;
cost[x][y]=1;
while(fie[x][y]!='.'){
for(int i=0;i<4;i++){
if(fie[x][y]==df[i]){
x+=dx[i];
y+=dy[i];
}
}
if(cost[x][y]){
f=true;
break;
}
cost[x][y]=1;
}
if(!f) printf("%d %d\n",x,y);
else puts("LOOP");
}
} | a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
15 | memset(fie,-1,sizeof(fie));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<iostream>
+++ |+#include <cstring>
5 | using namespace std;
|
s406157311 | p00104 | C++ | #include<cstdio>
#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
int W,H;
char fie[102][102];
int cost[102][102];
char df[]={'>','v','<','^'};
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
while(1){
cin >> H >> W;
memset(fie,-1,sizeof(fie));
memset(cost,0,sizeof(cost));
if(W==0 && H==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin >> fie[j][i];
}
}
int x=0,y=0;
bool f=false;
cost[x][y]=1;
while(fie[x][y]!='.'){
for(int i=0;i<4;i++){
if(fie[x][y]==df[i]){
x+=dx[i];
y+=dy[i];
}
}
if(cost[x][y]){
f=true;
break;
}
cost[x][y]=1;
}
if(!f) printf("%d %d\n",x,y);
else puts("LOOP");
}
} | a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
15 | memset(fie,-1,sizeof(fie));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<iostream>
+++ |+#include <cstring>
5 | using namespace std;
|
s915798525 | p00104 | C++ | #include <iostream>
using namespace std;
int main(){
int w,h;
int ichi[101][101]={0};
while(1){
int i=0,j=0;
cin >> w >> h;
if(w == 0 && h == 0){
break;
}
char map[w][h];
for(int n=0;n<w;n++){
for(int k=0;k<h;k++){
cin >> map[n][k];
}
}
while(1){
for(int n=0;n<w;n++){
memset(ichi[n],0,sizeof(ichi[i]));
}
if(ichi[i][j] == 1){
cout << "LOOP" << endl;
break;
}
else if(map[i][j] == '.'){
cout << j << " " << i << endl;
break;
}
if(map[i][j] == '>'){
ichi[i][j] = 1;
j++;
}
else if(map[i][j] == '<'){
ichi[i][j] = 1;
j--;
}
else if(map[i][j] == '^'){
ichi[i][j] = 1;
i--;
}
else if(map[i][j] == 'v'){
ichi[i][j] = 1;
i++;
}
}
} | a.cc: In function 'int main()':
a.cc:21:17: error: 'memset' was not declared in this scope
21 | memset(ichi[n],0,sizeof(ichi[i]));
| ^~~~~~
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 | using namespace std;
a.cc:48:6: error: expected '}' at end of input
48 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s871039923 | p00104 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int w,h;
int ichi[101][101]={0};
while(1){
int i=0,j=0;
cin >> w >> h;
if(w == 0 && h == 0){
break;
}
char map[w][h];
for(int n=0;n<w;n++){
for(int k=0;k<h;k++){
cin >> map[n][k];
}
}
while(1){
for(int n=0;n<w;n++){
memset(ichi[n],0,sizeof(ichi[i]));
}
if(ichi[i][j] == 1){
cout << "LOOP" << endl;
break;
}
else if(map[i][j] == '.'){
cout << j << " " << i << endl;
break;
}
if(map[i][j] == '>'){
ichi[i][j] = 1;
j++;
}
else if(map[i][j] == '<'){
ichi[i][j] = 1;
j--;
}
else if(map[i][j] == '^'){
ichi[i][j] = 1;
i--;
}
else if(map[i][j] == 'v'){
ichi[i][j] = 1;
i++;
}
}
}
} | a.cc: In function 'int main()':
a.cc:22:17: error: 'memset' was not declared in this scope
22 | memset(ichi[n],0,sizeof(ichi[i]));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdio>
+++ |+#include <cstring>
3 | using namespace std;
|
s273286924 | p00104 | C++ | #include<iostream>
int w,h;
int d[100][100];
char c;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
int main(){
while( std::cin>>h>>w , (w || h) ){
memset(d,-1,sizeof(d));
for(int i=0;i<h;++i){
for(int l=0;l<w;++l){
std::cin>>c;
if( c=='>' )
d[l][i]=0;
else if( c=='v' )
d[l][i]=1;
else if( c=='<' )
d[l][i]=2;
else if( c=='^' )
d[l][i]=3;
}
}
int Point[2]={0,0};
while(1){
if( d[Point[0]][Point[1]] == -1 ){
break;
}else if( d[Point[0]][Point[1]] < 4 ){
int dnum=d[ Point[0] ][ Point[1] ];
d[Point[0]][Point[1]]=4;
Point[0]+=dx[ dnum ];
Point[1]+=dy[ dnum ];
}else{
Point[0] = Point[1] = -1;
break;
}
}
if( Point[0]==-1 && Point[1]==-1 ){
std::cout<<"LOOP"<<std::endl;
}else{
std::cout<<Point[0]<<" "<<Point[1]<<std::endl;
}
}
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(d,-1,sizeof(d));
| ^~~~~~
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 |
|
s787676463 | p00104 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair
int main(){
typedef vector<string> vs;
int h,w;
while(cin>>h>>w, h|w){
vs G(a);
for(auto & a: G) cin>>a;
vector<vector<bool>> vis(vector<bool>(w,false),h);
int cx = 0, cy = 0;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};
map<char,int> m;
m['>'] = 0, m['^'] = 1, m['<'] = 2, m['v'] = 3;
while(1){
if(vis[cy][cs]){
cout << "LOOP" << endl;
goto end;
}
vis[cy][cx] = true;
char c = G[cy][cx];
if(c=='.'){
cout << cx << " " << cy << endl;
goto end;
}
cx += dx[m[c]], cy += dy[m[c]];
}
end:;
}
} | a.cc: In function 'int main()':
a.cc:26:14: error: 'a' was not declared in this scope
26 | vs G(a);
| ^
a.cc:29:57: error: no matching function for call to 'std::vector<std::vector<bool> >::vector(std::vector<bool>, int&)'
29 | vector<vector<bool>> vis(vector<bool>(w,false),h);
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
a.cc:29:57: note: deduced conflicting types for parameter '_InputIterator' ('std::vector<bool>' and 'int')
29 | vector<vector<bool>> vis(vector<bool>(w,false),h);
| ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'std::vector<bool>' to 'std::initializer_list<std::vector<bool> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<bool> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'std::vector<bool>' to 'std::vector<std::vector<bool> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<bool> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'std::vector<bool>' to 'const std::vector<std::vector<bool> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; size_type = long unsigned int; value_type = std::vector<bool>; allocator_type = std::allocator<std::vector<bool> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:24: note: no known conversion for argument 1 from 'std::vector<bool>' to 'std::vector<std::vector<bool> >::size_type' {aka 'long unsigned int'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<bool> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:24: note: no known conversion for argument 1 from 'std::vector<bool>' to 'std::vector<std::vector<bool> >::size_type' {aka 'long unsigned int'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; allocator_type = std::allocator<std::vector<bool> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
a.cc:38:24: error: 'cs' was not declared in this scope; did you mean 'cy'?
38 | if(vis[cy][cs]){
| ^~
| cy
|
s534375828 | p00104 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair
int main(){
typedef vector<string> vs;
int h,w;
while(cin>>h>>w, h|w){
vs G(h);
for(auto & a: G) cin>>a;
vector<vector<bool>> vis(h, vector<bool>(w,false));
int cx = 0, cy = 0;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};
map<char,int> m;
m['>'] = 0, m['^'] = 1, m['<'] = 2, m['v'] = 3;
while(1){
if(vis[cy][cs]){
cout << "LOOP" << endl;
goto end;
}
vis[cy][cx] = true;
char c = G[cy][cx];
if(c=='.'){
cout << cx << " " << cy << endl;
goto end;
}
cx += dx[m[c]], cy += dy[m[c]];
}
end:;
}
} | a.cc: In function 'int main()':
a.cc:38:24: error: 'cs' was not declared in this scope; did you mean 'cy'?
38 | if(vis[cy][cs]){
| ^~
| cy
|
s448031076 | p00104 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, i, j;
char map[102][102]
while(1){
cin >> a >> b;
if(a+b==0) break;
for(i=0; i< a; i++){
for(j=0; j< b; j++){
cin >> map[i][j];
}
}
i=0;j=0;
while(1){
if(map[i][j]=="."){
cout << i << " " << j << endl;
}else if(map[i][j]=="#"){
cout << "loop" << endl;
}else if(map[i][j]==">"){
map[i][j]="#";
j++;
}else if(map[i][j]=="<"){
map[i][j]="#";
j--;
}else if(map[i][j]=="^"){
map[i][j]="#";
i++;
}else if(map[i][j]=="v"){
map[i][j]="#";
i--;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:4: error: expected initializer before 'while'
8 | while(1){
| ^~~~~
|
s546855770 | p00104 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, i, j;
char map[102][102];
while(1){
cin >> a >> b;
if(a+b==0) break;
for(i=0; i< a; i++){
for(j=0; j< b; j++){
cin >> map[i][j];
}
}
i=0;j=0;
while(1){
if(map[i][j]=="."){
cout << i << " " << j << endl;
break;
}else if(map[i][j]=="#"){
cout << "loop" << endl;
break;
}else if(map[i][j]==">"){
map[i][j]="#";
j++;
}else if(map[i][j]=="<"){
map[i][j]="#";
j--;
}else if(map[i][j]=="^"){
map[i][j]="#";
i++;
}else if(map[i][j]=="v"){
map[i][j]="#";
i--;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
19 | if(map[i][j]=="."){
| ~~~~~~~~~^~~~~
a.cc:22:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
22 | }else if(map[i][j]=="#"){
| ~~~~~~~~~^~~~~
a.cc:25:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
25 | }else if(map[i][j]==">"){
| ~~~~~~~~~^~~~~
a.cc:26:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
26 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:28:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
28 | }else if(map[i][j]=="<"){
| ~~~~~~~~~^~~~~
a.cc:29:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
29 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:31:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
31 | }else if(map[i][j]=="^"){
| ~~~~~~~~~^~~~~
a.cc:32:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
32 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:34:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
34 | }else if(map[i][j]=="v"){
| ~~~~~~~~~^~~~~
a.cc:35:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
35 | map[i][j]="#";
| ^~~
| |
| const char*
|
s327813910 | p00104 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, i, j;
char map[102][102];
while(1){
cin >> a >> b;
if(a+b==0) break;
for(i=0; i< a; i++){
for(j=0; j< b; j++){
cin >> map[i][j];
}
}
i=0;j=0;
while(1){
if(map[i][j]=="."){
cout << i << " " << j << endl;
break;
}else if(map[i][j]=="#"){
cout << "loop" << endl;
break;
}else if(map[i][j]==">"){
map[i][j]="#";
j++;
}else if(map[i][j]=="<"){
map[i][j]="#";
j--;
}else if(map[i][j]=="^"){
map[i][j]="#";
i++;
}else if(map[i][j]=="v"){
map[i][j]="#";
i--;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
19 | if(map[i][j]=="."){
| ~~~~~~~~~^~~~~
a.cc:22:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
22 | }else if(map[i][j]=="#"){
| ~~~~~~~~~^~~~~
a.cc:25:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
25 | }else if(map[i][j]==">"){
| ~~~~~~~~~^~~~~
a.cc:26:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
26 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:28:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
28 | }else if(map[i][j]=="<"){
| ~~~~~~~~~^~~~~
a.cc:29:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
29 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:31:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
31 | }else if(map[i][j]=="^"){
| ~~~~~~~~~^~~~~
a.cc:32:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
32 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:34:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
34 | }else if(map[i][j]=="v"){
| ~~~~~~~~~^~~~~
a.cc:35:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
35 | map[i][j]="#";
| ^~~
| |
| const char*
|
s740234653 | p00104 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, i, j;
char map[102][102];
while(1){
cin >> a >> b;
if(a+b==0) break;
for(i=0; i< a; i++){
for(j=0; j< b; j++){
cin >> map[i][j];
}
}
i=0;j=0;
while(1){
if(map[i][j]=='.'){
cout << i << " " << j << endl;
break;
}else if(map[i][j]=='#'){
cout << "loop" << endl;
break;
}else if(map[i][j]=='>'){
map[i][j]="#";
j++;
}else if(map[i][j]=='<'){
map[i][j]="#";
j--;
}else if(map[i][j]=='^'){
map[i][j]="#";
i++;
}else if(map[i][j]=='v'){
map[i][j]="#";
i--;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
26 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:29:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
29 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:32:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
32 | map[i][j]="#";
| ^~~
| |
| const char*
a.cc:35:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
35 | map[i][j]="#";
| ^~~
| |
| const char*
|
s639860806 | p00104 | C++ | #include<iostream>
using namespace std;
int main(void)
{
int h,w;
while(true)
{
cin>>h>>w;
if(h==0 && w==0)break;
char str[h][w];
int looper[h][w];
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
cin>>str[i][j];
looper[i][j]=0;
}
}
int i=0,j=0;
while(true)
{
if(str[i][j]=='>')
{
j++;
}
else if(str[i][j]=='<')
{
j--;
}
else if(str[i][j]=='v')
{
i++;
}
else
{
i--;
}
if(str[i][j]=='.')
{
cout<<j<<" "<<i<<endl;
break;
}
else if(looper[i][j]==1)
{
cout<<"LOOP"<<endl;
break;
}
loop[i][j]++;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:54:11: error: 'loop' was not declared in this scope; did you mean 'looper'?
54 | loop[i][j]++;
| ^~~~
| looper
|
s137790317 | p00105 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public class Main {
private BufferedReader in = new BufferedReader(new InputStreamReader(
System.in));
public static void main(String[] args) {
BookIndex wordcount = new BookIndex();
String[] words = wordcount.input();
Map<String, ArrayList<Integer>> entries = wordcount.count(words);
wordcount.print(entries);
}
/**
* 出現位置を保存
*/
private Map<String, ArrayList<Integer>> count(String[] entries) {
Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>();
for (int i = 0; i < entries.length; i += 2) {
if (entries[i].equals(""))
continue;
List<Integer> index;
if ((index = map.get(entries[i])) == null) {
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(Integer.parseInt(entries[i + 1]));
map.put(entries[i], list);
} else {
index.add(Integer.parseInt(entries[++i]));
}
}
return map;
}
/**
* 単語+改行+indexで出力
*/
private void print(Map<String, ArrayList<Integer>> map) {
for (String str : map.keySet()) {
List<Integer> list = map.get(str);
System.out.print(str + "\n" + list.get(0));
for (int i = 1; i < list.size(); i++) {
System.out.print(" " + list.get(i));
}
System.out.println();
}
}
/**
* 標準入力から読み込んだ文字列を空白区切りで分割
*/
private String[] input() {
String str = null;
try {
str = in.readLine();
while (true) {
String input = in.readLine();
if (input == null)
break;
str = str + " " + input;
}
} catch (IOException e) {
e.printStackTrace();
}
if (str == null)
return new String[0];
else
return str.toLowerCase().split("\\s+");
}
} | Main.java:15: error: cannot find symbol
BookIndex wordcount = new BookIndex();
^
symbol: class BookIndex
location: class Main
Main.java:15: error: cannot find symbol
BookIndex wordcount = new BookIndex();
^
symbol: class BookIndex
location: class Main
2 errors
|
s107314691 | p00105 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public class Main {
private BufferedReader in = new BufferedReader(new InputStreamReader(
System.in));
public static void main(String[] args) {
Main wordcount = new Main();
String[] words = wordcount.input();
Map<String, ArrayList<Integer>> entries = wordcount.count(words);
wordcount.print(entries);
}
/**
* 出現位置を保存
*/
private Map<String, ArrayList<Integer>> count(String[] entries) {
Map<String, ArrayList<Integer>> map = new TreeMap<String, ArrayList<Integer>>();
for (int i = 0; i < entries.length; i += 2) {
if (entries[i].equals(""))
continue;
List<Integer> index;
if ((index = map.get(entries[i])) == null) {
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(Integer.parseInt(entries[i + 1]));
map.put(entries[i], list);
} else {
index.add(Integer.parseInt(entries[i + 1]));
}
}
return map;
}
/**
* 単語+改行+indexで出力
*/
private void print(Map<String, ArrayList<Integer>> map) {
for (String str : map.keySet()) {
List<Integer> list = map.get(str);
Collections.sort(list);
System.out.print(str + "\n" + list.get(0));
for (int i = 1; i < list.size(); i++) {
System.out.print(" " + list.get(i));
}
System.out.println();
}
}
/**
* 標準入力から読み込んだ文字列を空白区切りで分割
*/
private String[] input() {
String str = null;
try {
str = in.readLine();
while (true) {
String input = in.readLine();
if (input == null)
break;
str = str + " " + input;
}
} catch (IOException e) {
e.printStackTrace();
}
if (str == null)
return new String[0];
else
return str.toLowerCase().split("\\s+");
}
} | Main.java:47: error: cannot find symbol
Collections.sort(list);
^
symbol: variable Collections
location: class Main
1 error
|
s801129820 | p00105 | Java | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Map<String, List<Integer>> ref = new HashMap<String, List<Integer>>();
PriorityQueue<String> q = new PriorityQueue<String>();
while(sc.hasNext()){
String s = sc.next();
if(ref.containsKey(s)){
ref.get(s).add(sc.nextInt());
}
else{
q.add(s);
List<Integer> list = new ArrayList<Integer>();
list.add(sc.nextInt());
ref.put(s, list);
}
}
while(!q.isEmpty()){
String s = q.poll();
List<Integer> list = ref.get(s);
System.out.println(s);
Collections.sort(list);
boolean f = true;
for(int v:list){
if(!f)System.out.print(" ");
f = false;
System.out.print(v);
}
System.out.println();
}
} | Main.java:40: error: reached end of file while parsing
}
^
1 error
|
s134000274 | p00105 | C | #include<stdio.h>
#define W 30
#define P 1000
int main(){
int p;
char c[W];
while(scanf("%c %d",c,&p)!=EOF){
}
retrn 0;
} | main.c: In function 'main':
main.c:15:1: error: 'retrn' undeclared (first use in this function)
15 | retrn 0;
| ^~~~~
main.c:15:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:6: error: expected ';' before numeric constant
15 | retrn 0;
| ^~
| ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.