submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s824636234
p00025
C++
#include <iostream> #include <array> #include <algorithm> int main(){ int a1, a2, a3, a4, b1, b2, b3, b4; while(std::cin >> a1 >> a2 >> a3 >> a4){ std::cin >> b1 >>b2 >> b3 >>b4; std::array<int> A = {a1, a2, a3, a4}; std::array<int> B = {b1, b2, b3, b4}; int hit = 0; int blow = 0; for(int i = 0; i < 4; ++i){ if(A[i] == B[i]) hit++; count += std::count(A.begin(), A.end(), B[i]); } std::cout << hit << blow << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:31: error: wrong number of template arguments (1, should be 2) 13 | std::array<int> A = {a1, a2, a3, a4}; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:99:12: note: provided for 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:13:33: error: scalar object 'A' requires one element in initializer 13 | std::array<int> A = {a1, a2, a3, a4}; | ^ a.cc:14:31: error: wrong number of template arguments (1, should be 2) 14 | std::array<int> B = {b1, b2, b3, b4}; | ^ /usr/include/c++/14/bits/stl_pair.h:99:12: note: provided for 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:14:33: error: scalar object 'B' requires one element in initializer 14 | std::array<int> B = {b1, b2, b3, b4}; | ^ a.cc:24:25: error: 'count' was not declared in this scope; did you mean 'std::count'? 24 | count += std::count(A.begin(), A.end(), B[i]); | ^~~~~ | std::count In file included from /usr/include/c++/14/algorithm:86, from a.cc:3: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~
s890966023
p00025
C++
#include <iostream> #include <array> #include <algorithm> int main(){ int a1, a2, a3, a4, b1, b2, b3, b4; while(std::cin >> a1 >> a2 >> a3 >> a4){ std::cin >> b1 >>b2 >> b3 >>b4; std::array<int, 4> A = {a1, a2, a3, a4}; std::array<int, 4> B = {b1, b2, b3, b4}; int hit = 0; int blow = 0; for(int i = 0; i < 4; ++i){ if(A[i] == B[i]) ++hit; count += std::count(A.begin(), A.end(), B[i]); } std::cout << hit << blow << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:25: error: 'count' was not declared in this scope; did you mean 'std::count'? 24 | count += std::count(A.begin(), A.end(), B[i]); | ^~~~~ | std::count In file included from /usr/include/c++/14/algorithm:86, from a.cc:3: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~
s680292549
p00025
C++
#include <iostream> #include <vector> #include <algorithm> int main(){ std::vector<int> a(4); while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){ int hit = 0, blow = 0; for(int i = 0; i < 4; ++i){ int b; std::cin >> b; auto it = std::find(a.begin(), a.end(), b); if(it == a.begin() + i) ++hit; else if(it != a.end()) ++blow; } std::cout << hit << " " << blow << std::endl; } return 0;
a.cc: In function 'int main()': a.cc:24:14: error: expected '}' at end of input 24 | return 0; | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s541577926
p00025
C++
import java.io.IOException; import java.util.Scanner; class Main { public static void main(String[] args) throws IOException { Scanner sc = null; try { sc = new Scanner(System.in); int countHit=0; int countBlow=0; while (sc.hasNext()) { String[] a = sc.nextLine().split(" "); String[] b = sc.nextLine().split(" "); for (int i = 0; i < a.length; i++) { for(int j =0; j<b.length;j++){ if (a[i] .equals(b[i])) { countHit++; break; } else if(a[i].equals(b[j])){ countBlow++; } } } System.out.println(countHit+" "+countBlow); } } finally { sc.close(); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.IOException; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:15: error: expected ':' before 'static' 6 | public static void main(String[] args) throws IOException { | ^~~~~~~ | : a.cc:6:33: error: 'String' has not been declared 6 | public static void main(String[] args) throws IOException { | ^~~~~~ a.cc:6:42: error: expected ',' or '...' before 'args' 6 | public static void main(String[] args) throws IOException { | ^~~~ a.cc:6:46: error: expected ';' at end of member declaration 6 | public static void main(String[] args) throws IOException { | ^ | ; a.cc:6:48: error: 'throws' does not name a type 6 | public static void main(String[] args) throws IOException { | ^~~~~~ a.cc:46:2: error: expected ';' after class definition 46 | } | ^ | ;
s524617700
p00025
C++
#include <stdio.h> int main(void){ int a[4],b[4],n,t,r,i,c,d; for(r=0,r<2;r++){ c=0; d=0; for(t=0;t<4;t++){ scanf("%d",&a[t]); } for(t=0;t<4;t++){ scanf("%d",&b[t]); } for(t=0;t<4;t++){ for(i=0;i<4;i++){ if(b[t]==a[i]){ c++; } } } for(i=0;i<4;i++){ if(b[i]==a[i]){ d++; } } printf("%d %d\n",d,c-d); } return 0; }
a.cc: In function 'int main()': a.cc:5:24: error: expected ';' before ')' token 5 | for(r=0,r<2;r++){ | ^ | ;
s537072480
p00025
C++
import Control.Monad import Control.Applicative import Data.List main = do xs <- input $ map read . words :: IO [[Int]] mapM_ putStrLn $ solve xs solve :: [[Int]] -> [String] solve [] = [] solve (xs:ys:yss) = (show h ++ " " ++ show b) : solve yss where h = hit xs ys b = smn xs ys - h hit :: [Int] -> [Int] -> Int hit xs ys = sum $ zipWith (\x y -> if x == y then 1 else 0) xs ys smn :: [Int] -> [Int] -> Int smn xs ys = foldl f 0 ys where f :: Int -> Int -> Int f acc z = if z `elem` xs then acc + 1 else acc input :: (String -> a) -> IO [a] input f = map f . lines <$> getContents
a.cc:16:28: error: stray '\' in program 16 | hit xs ys = sum $ zipWith (\x y -> if x == y then 1 else 0) xs ys | ^ a.cc:22:20: error: stray '`' in program 22 | f acc z = if z `elem` xs then acc + 1 else acc | ^ a.cc:22:25: error: stray '`' in program 22 | f acc z = if z `elem` xs then acc + 1 else acc | ^ a.cc:1:1: error: 'import' does not name a type 1 | import Control.Monad | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s944926789
p00025
C++
#include<iostream> int main(){ int a[4],b[4],i,j,H,B; while(std::cin>>a[0]){ for(i=0;i<4;i++){ std::cin>>a[i]; } for(j=0;j<4;j++){ std::cin>>b[j]; } H=0; B=0; for(i=0;i<4;i++){ for(j=0;j<4;j++){ if(a[i]==b[j]){ if(i==j){ H++; } else(){ B++; } } } } std::cout<< H << " " << B <<std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:46: error: expected primary-expression before ')' token 20 | else(){ | ^
s343336085
p00025
C++
def hit_blow(arr1, arr2) n, m = 0, 0 4.times do |i| n += 1 if arr1[i] == arr2[i] m += 1 if arr1.include?(arr2[i]) end return [n, m - n] end while gets arr1, arr2 = $_.split, gets.split h, b = hit_blow(arr1, arr2) puts "#{h} #{b}" end
a.cc:1:1: error: 'def' does not name a type 1 | def hit_blow(arr1, arr2) | ^~~
s237948055
p00025
C++
while gets a=$<.split.map(&:to_i) b=gets.split.map(&:to_i) c,d=0,0; 4.times do |i| if a[i]==b[i] then c+=1 else 4.times do |j| if a[i]==b[j] then d+=1;break; end end end end print c," ",d,"\n" end
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while gets | ^~~~~ a.cc:5:9: error: expected unqualified-id before numeric constant 5 | 4.times do |i| | ^~~~~~~ a.cc:11:46: error: expected unqualified-id before 'break' 11 | d+=1;break; | ^~~~~ a.cc:12:33: error: 'end' does not name a type 12 | end | ^~~
s498286209
p00025
C++
while gets a=$_.split.map(&:to_i) b=gets.split.map(&:to_i) c,d=0,0; 4.times{|i| if a[i]==b[i] then c+=1 else d+=1 if b.find{|j|j==a[i]} end } print c," ",d,"\n" end
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while gets | ^~~~~ a.cc:5:1: error: expected unqualified-id before numeric constant 5 | 4.times{|i| | ^~~~~~~ a.cc:12:1: error: 'print' does not name a type; did you mean 'int'? 12 | print c," ",d,"\n" | ^~~~~ | int
s247143365
p00025
C++
#include<iostream> using namespace std; int main(){ int a[4],c[4]; while(1){ int e=0,b=0,k; for(int i=0;i<4;i++) k=cin >> a[i]; if(!k)break; if(a[i]==-1)break; for(int i=0;i<4;i++){ cin >> c[i]; for(int j=0;j<4;j++) if(c[i]==a[j]){ if(i==j)e++; else b++; } } cout<<e<<' '<<b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' in assignment 9 | k=cin >> a[i]; | ~~~~^~~~~~~ | | | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:11:10: error: 'i' was not declared in this scope 11 | if(a[i]==-1)break; | ^
s347907943
p00025
C++
#include<iostream> using namespace std; int main(){ int a[4],c[4]; while(1){ int e=0,b=0,k; for(int i=0;i<4;i++) k=cin >> a[i]; if(!k)break; for(int i=0;i<4;i++){ cin >> c[i]; for(int j=0;j<4;j++) if(c[i]==a[j]){ if(i==j)e++; else b++; } } cout<<e<<' '<<b<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' in assignment 9 | k=cin >> a[i]; | ~~~~^~~~~~~ | | | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
s434261460
p00025
C++
#include <iostream> using namespace std; int main() { int a[4], b[4]; int blow, hit; while(cin >> a[0] == EOF){ cin >> a[1] >> a[2] >> a[3]; cin >> b[0] >> b[1] >> b[2] >> b[3]; hit = blow = 0; for(int i = 0; i < 4; i++){ if(a[i] == b[i]){ hit += 1; } } for(int i = 0; i < 4; i++){ for(int n = 0; n < 4; n++){ if(a[i] != b[i] && a[i] == b[n]){ blow++; } } } cout << hit << " " << blow << endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:21: error: no match for 'operator==' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 11 | while(cin >> a[0] == EOF){ | ~~~~~~~~~~~ ^~ | | | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:11:21: note: candidate: 'operator==(int, int)' (built-in) 11 | while(cin >> a[0] == EOF){ | ^ a.cc:11:21: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/cstdio:42, from /usr/include/c++/14/ext/string_conversions.h:45, from /usr/include/c++/14/bits/basic_string.h:4154, 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: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 11 | while(cin >> a[0] == EOF){ | ^~~ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 11 | while(cin >> a[0] == EOF){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | while(cin >> a[0] == EOF){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | while(cin >> a[0] == EOF){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47: /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:11:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:11:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | while(cin >> a[0] == EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:11:24: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 11 | while(cin >> a[0] == EOF){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | while(cin >> a[0] == EOF){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/
s099776216
p00025
C++
#include <iostream> using namespace std; int main(){ int a[4]; int b[4]; int h=0; int b=0; int m, n; for(int i=0; i<4; i++){ cin >> a[i]; } for(int i=0; i<4; i++){ cin >> b[i]; } for(m=0; m<4; m++){ for(n=0; n<4; n++){ if(a[m] == b[n] && m == n){ h = h+1; } else if(a[m] == b[n]){ b = b+1; } } cout << h << " " << b << endl; }
a.cc: In function 'int main()': a.cc:9:13: error: conflicting declaration 'int b' 9 | int b=0; | ^ a.cc:7:13: note: previous declaration as 'int b [4]' 7 | int b[4]; | ^ a.cc:24:35: error: incompatible types in assignment of 'int*' to 'int [4]' 24 | b = b+1; | ~~^~~~~ a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s670951055
p00025
C++
#include <iostream> #include <iostream> using namespace std; int main(){ int a[4]; int b[4]; int hit=0; int blow=0; int m, n; for(int i=0; i<4; i++){ cin >> a[i]; } for(int i=0; i<4; i++){ cin >> b[i]; } for(m=0; m<4; m++){ for(n=0; n<4; n++){ if(a[m] == b[n] && m == n){ hit = hit + 1; } else if(a[m] == b[n]){ blow = blow + 1; } } cout << hit << " " << blow << endl; }
a.cc: In function 'int main()': a.cc:30:2: error: expected '}' at end of input 30 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s467699325
p00025
C++
#include<vector> #include<iostream> using namespace std; int main() { int code[4], line, hit, bro; while (true) { hit = 0; bro = 0; for (int i = 0; i < 4; ++i) { cin >> code[i]; }#include<vector> #include<iostream> using namespace std; int main() { int code[4], line, hit, bro; while (cin>>code[0]) { hit = 0; bro = 0; for (int i = 1; i < 4; ++i) { cin >> code[i]; } for (int i = 0; i < 4; ++i) { cin >> line; if (code[i] == line) { ++hit; } else { for (int i2 = 0; i2 < 4; ++i2) { if (code[i2] == line) { ++bro; } } } } cout << hit << " " << bro << endl; } return 0; } for (int i = 0; i < 4; ++i) { cin >> line; if (code[i] == line) { ++hit; } else { for (int i2 = 0; i2 < 4; ++i2) { if (code[i2] == line) { ++bro; } } } } cout << hit << " " << bro << endl; } return 0; }
a.cc:11:18: error: stray '#' in program 11 | }#include<vector> | ^ a.cc: In function 'int main()': a.cc:11:19: error: 'include' was not declared in this scope 11 | }#include<vector> | ^~~~~~~ a.cc:11:33: error: missing template arguments before '>' token 11 | }#include<vector> | ^ a.cc:13:1: error: expected primary-expression before 'using' 13 | using namespace std; | ^~~~~ a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 14 | int main() { | ^~ a.cc:14:9: note: remove parentheses to default-initialize a variable 14 | int main() { | ^~ | -- a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable a.cc:14:12: error: a function-definition is not allowed here before '{' token 14 | int main() { | ^
s795250373
p00025
C++
#include <iostream> #include <vector> #include <cmath> #include <iomanip> #include <string> #include <queue> #include <algorithm> #include <cctype> #define shosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef pair<int,int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<P> vp; typedef vector<vp> vvp; typedef pair<int,P> pip; typedef vector<pip> vip; const int inf=1<<30; const double pi=acos(-1); vector<char> a(4),b(4); int main(){ char c,d,e,f; while(cin>>c>>d>>e>>f>>g>>h>>d>>k){ int hit=0,blow=0; a={c,d,e,f}; b={g,h,d,k}; // for(int i=0;i<4;i++) cin>>b[i]; for(int i=0;i<4;i++){ if(a[i]==b[i]) hit++; } for(int i=0;i<4;i++){ for(int j=0;j<4;j++){ if(i==j) continue; if(a[i]==b[j]) blow++; } } cout<<hit<<' '<<blow<<endl; } }
a.cc: In function 'int main()': a.cc:26:32: error: 'g' was not declared in this scope 26 | while(cin>>c>>d>>e>>f>>g>>h>>d>>k){ | ^ a.cc:26:35: error: 'h' was not declared in this scope 26 | while(cin>>c>>d>>e>>f>>g>>h>>d>>k){ | ^ a.cc:26:41: error: 'k' was not declared in this scope 26 | while(cin>>c>>d>>e>>f>>g>>h>>d>>k){ | ^ a.cc:29:27: error: no match for 'operator=' (operand types are 'std::vector<char>' and '<brace-enclosed initializer list>') 29 | b={g,h,d,k}; | ^ In file included from /usr/include/c++/14/vector:72, from a.cc:2: /usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<char>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<char>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = char; _Alloc = std::allocator<char>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<char>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
s593231681
p00025
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication26 { class Program { static void Main(string[] args) { string s,t; while((s=Console.ReadLine())!=null) { t=Console.ReadLine(); int[] a = s.Split().Select(int.Parse).ToArray(); int[] b = t.Split().Select(int.Parse).ToArray(); int d,e; d=e=0; for(int c =0;c<4;c++) { if(a[c]==b[c])d++; else{ bool flag=false; for(int h =0;h<4;h++) { if(a[c]==b[h])flag=true; } if(flag==true)e++; } } Console.WriteLine("{0} {1}",d,e); } } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:10:26: error: 'string' has not been declared 10 | static void Main(string[] args) | ^~~~~~ a.cc:10:35: error: expected ',' or '...' before 'args' 10 | static void Main(string[] args) | ^~~~ a.cc:35:6: error: expected ';' after class definition 35 | } | ^ | ; a.cc: In static member function 'static void ConsoleApplication26::Program::Main(int*)': a.cc:12:25: error: 'string' was not declared in this scope 12 | string s,t; | ^~~~~~ a.cc:13:32: error: 's' was not declared in this scope 13 | while((s=Console.ReadLine())!=null) | ^ a.cc:13:34: error: 'Console' was not declared in this scope 13 | while((s=Console.ReadLine())!=null) | ^~~~~~~ a.cc:13:55: error: 'null' was not declared in this scope 13 | while((s=Console.ReadLine())!=null) | ^~~~ a.cc:15:33: error: 't' was not declared in this scope 15 | t=Console.ReadLine(); | ^ a.cc:16:36: error: structured binding declaration cannot have type 'int' 16 | int[] a = s.Split().Select(int.Parse).ToArray(); | ^~ a.cc:16:36: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:16:36: error: empty structured binding declaration a.cc:16:39: error: expected initializer before 'a' 16 | int[] a = s.Split().Select(int.Parse).ToArray(); | ^ a.cc:17:36: error: structured binding declaration cannot have type 'int' 17 | int[] b = t.Split().Select(int.Parse).ToArray(); | ^~ a.cc:17:36: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:17:36: error: empty structured binding declaration a.cc:17:39: error: expected initializer before 'b' 17 | int[] b = t.Split().Select(int.Parse).ToArray(); | ^ a.cc:22:44: error: 'a' was not declared in this scope 22 | if(a[c]==b[c])d++; | ^ a.cc:22:50: error: 'b' was not declared in this scope 22 | if(a[c]==b[c])d++; | ^
s784711763
p00025
C++
int main() { int hit[4]={},blow[4]={}; while(cin>>hit[0]){ int ans1=0,ans2=0; for(int i=1; i<4; i++){ cin>>hit[i]; } for(int i=0; i<4; i++){ cin>>blow[i]; } for(int i=0; i<4; i++){ for(int j=0; j<4; j++){ if(hit[i]==blow[j]){ (i==j)?ans1++:ans2++; } } } cout<<ans1<<" "<<ans2<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:4:11: error: 'cin' was not declared in this scope 4 | while(cin>>hit[0]){ | ^~~ a.cc:19:9: error: 'cout' was not declared in this scope 19 | cout<<ans1<<" "<<ans2<<endl; | ^~~~ a.cc:19:32: error: 'endl' was not declared in this scope 19 | cout<<ans1<<" "<<ans2<<endl; | ^~~~
s031719577
p00025
C++
#include<iostream> int main() { int hit[4]={},blow[4]={}; while(cin>>hit[0]){ int ans1=0,ans2=0; for(int i=1; i<4; i++){ cin>>hit[i]; } for(int i=0; i<4; i++){ cin>>blow[i]; } for(int i=0; i<4; i++){ for(int j=0; j<4; j++){ if(hit[i]==blow[j]){ (i==j)?ans1++:ans2++; } } } cout<<ans1<<" "<<ans2<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | while(cin>>hit[0]){ | ^~~ | 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:20:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 20 | cout<<ans1<<" "<<ans2<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:20:32: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 20 | cout<<ans1<<" "<<ans2<<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) | ^~~~
s032318195
p00025
C++
#include<iostream> using namespace std; int main(){ int a[4],b[4],n,m; while(cin >> a[0]){ n = 0; m = 0; cin >> a[1] >> a[2] >> a[3]; for(int i=0;i<4;i++){ cin >> b[i]; if(a[i] == b[i]) n++; } sort(a,a+4); for(int i=0;i<4;i++){ if(*lower_bound(a,a+4,b[i])==b[i]) m++; } cout << n << " " << (m-n) << endl; } return (0); }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(a,a+4); | ^~~~ | short
s549832409
p00025
C++
#include <iostream> #include <array> int main(){ std::array<int,4> num_a, num; std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3]; while(std::cin >> num[0] >> num[1] >> num[2] >> num[3]){ int hit = 0, blow = 0; for(size_t i = 0; i < 4; ++i){ if(num_a[i] == num[i]){ ++hit; }else{ for(size_t j = 0; j < 4; ++j){ if(num_a[j] == num[i]){ ++blow; } } } } std::out << hit << " " << blow << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:22: error: 'out' is not a member of 'std'; did you mean 'oct'? 23 | std::out << hit << " " << blow << std::endl; | ^~~ | oct
s430656995
p00025
C++
#include<iostream> #include<vector> using namespace std; void get(int* nums_a,int* nums_b){ int nums_a[4]; int nums_b[4]; for(int i=0;i<4;i++){ cin>>nums_a[i]; } for(int i=0;i<4;i++){ cin>>nums_b[i]; } } int main(){ vector<int> hit_anss; vector<int> bolor_anss; int hit=0,bolor=0; while(get(nums_a,nums_b)){ //hit????¢???? for(int i=0;i<4;i++){ if(nums_a[i]==nums_b[i])hit++; } //bolor????¢???? for(int i=0;i<4;i++){ for(int j=0;j<4;j++){ if(i==j)continue; if(nums_a[i]==nums_b[j]){ bolor++; break; } } } hit_anss.push_back(hit); bolor_anss.push_back(bolor); } for(int i=0;i<hit_anss.size();i++){ cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl; } }
a.cc: In function 'void get(int*, int*)': a.cc:6:7: error: declaration of 'int nums_a [4]' shadows a parameter 6 | int nums_a[4]; | ^~~~~~ a.cc:5:15: note: 'int* nums_a' previously declared here 5 | void get(int* nums_a,int* nums_b){ | ~~~~~^~~~~~ a.cc:7:7: error: declaration of 'int nums_b [4]' shadows a parameter 7 | int nums_b[4]; | ^~~~~~ a.cc:5:27: note: 'int* nums_b' previously declared here 5 | void get(int* nums_a,int* nums_b){ | ~~~~~^~~~~~ a.cc: In function 'int main()': a.cc:20:13: error: 'nums_a' was not declared in this scope 20 | while(get(nums_a,nums_b)){ | ^~~~~~ a.cc:20:20: error: 'nums_b' was not declared in this scope 20 | while(get(nums_a,nums_b)){ | ^~~~~~
s301347035
p00025
C++
#include<iostream> #include<vector> using namespace std; int main(){ vector<int> hit_anss; vector<int> bolor_anss; int nums_a[4],nums_b[4]; int hit=0,bolor=0; while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ for(int i=0;i<4;i++){ cin>>nums_b[i]; } //hit????¢???? for(int i=0;i<4;i++){ if(nums_a[i]==nums_b[i])hit++; } //bolor????¢???? for(int i=0;i<4;i++){ for(int j=0;j<4;j++){ if(i==j)continue; if(nums_a[i]==nums_b[j]){ bolor++; break; } } } hit_anss.push_back(hit); bolor_anss.push_back(bolor); } for(int i=0;i<hit_anss.size();i++){ cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl; } }
a.cc: In function 'int main()': a.cc:9:23: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ~~~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:9:23: note: candidate: 'operator<<(int, int)' (built-in) 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ~~~~~~~~~~~~~~^~~~~~~~~~~ a.cc:9:23: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ 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:9:12: note: cannot convert 'std::cin.std::basic_istream<char>::operator>>(nums_a[0])' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ~~~^~~~~~~~~~~ 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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ 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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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:9:33: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){ | ^ /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* __
s145768558
p00025
C++
#include<iostream> using namespace std; int main(){ int a,b,c,d,e,f,g,h,x=0,y=0; while(cin >> a >> b >> c >> d >> e >> f >> g >> h){ x=0; y=0; if (a==e){x=x+1} if (b==f){x=x+1} if (c==g){x=x+1} if (d==h){x=x+1} if (e==a || e==b || e==c || e==d){y=y+1;} if (f==a || f==b || f==c || f==d){y=y+1;} if (g==a || g==b || g==c || g==d){y=y+1;} if (h==a || h==b || h==c || h==d){y=y+1;} cout << x << " " << y << endl; } return 0 ; }
a.cc: In function 'int main()': a.cc:8:24: error: expected ';' before '}' token 8 | if (a==e){x=x+1} | ^ | ; a.cc:9:24: error: expected ';' before '}' token 9 | if (b==f){x=x+1} | ^ | ; a.cc:10:24: error: expected ';' before '}' token 10 | if (c==g){x=x+1} | ^ | ; a.cc:11:24: error: expected ';' before '}' token 11 | if (d==h){x=x+1} | ^ | ;
s745703759
p00025
C++
#include<iostream> using namespace std; int main(){ int a,b,c,d,e,f,g,h,x=0,y=0; while(cin >> a >> b >> c >> d >> e >> f >> g >> h){ x=0; y=0; if (a==e){x=x+1;e=e+10} if (b==f){x=x+1;f=f+10} if (c==g){x=x+1;g=g+10} if (d==h){x=x+1;h=h+10} if (e==a || e==b || e==c || e==d){y=y+1;} if (f==a || f==b || f==c || f==d){y=y+1;} if (g==a || g==b || g==c || g==d){y=y+1;} if (h==a || h==b || h==c || h==d){y=y+1;} cout << x << " " << y << endl; } return 0 ; }
a.cc: In function 'int main()': a.cc:8:31: error: expected ';' before '}' token 8 | if (a==e){x=x+1;e=e+10} | ^ | ; a.cc:9:31: error: expected ';' before '}' token 9 | if (b==f){x=x+1;f=f+10} | ^ | ; a.cc:10:31: error: expected ';' before '}' token 10 | if (c==g){x=x+1;g=g+10} | ^ | ; a.cc:11:31: error: expected ';' before '}' token 11 | if (d==h){x=x+1;h=h+10} | ^ | ;
s854526627
p00025
C++
#include <iostream> int main(){ std::array(u_int, 4) a, b; int hit=0, blow=0; while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ cin >> b[0] >> b[1] >> b[2] >> b[3]; for(int i=0;i<4;i++){ if(a[i]==b[i]) hit++; for(int j=0;j<4;j++){ if(a[i]==b[j]) blow++; } } cout << hit << blow-hit << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:4:19: error: missing template arguments before '(' token 4 | std::array(u_int, 4) a, b; | ^ a.cc:4:25: error: expected primary-expression before ',' token 4 | std::array(u_int, 4) a, b; | ^ a.cc:7:15: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^~~ | 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:7:22: error: 'a' was not declared in this scope 7 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^ a.cc:8:24: error: 'b' was not declared in this scope 8 | cin >> b[0] >> b[1] >> b[2] >> b[3]; | ^ a.cc:15:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 15 | cout << hit << blow-hit << std::endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s346025186
p00025
C++
#include <iostream> #include <array> int main(){ std::array(u_int, 4) a, b; int hit=0, blow=0; while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ cin >> b[0] >> b[1] >> b[2] >> b[3]; for(int i=0;i<4;i++){ if(a[i]==b[i]) hit++; for(int j=0;j<4;j++){ if(a[i]==b[j]) blow++; } } cout << hit << blow-hit << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:19: error: missing template arguments before '(' token 5 | std::array(u_int, 4) a, b; | ^ a.cc:5:25: error: expected primary-expression before ',' token 5 | std::array(u_int, 4) a, b; | ^ a.cc:8:15: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^~~ | 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:8:22: error: 'a' was not declared in this scope 8 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^ a.cc:9:24: error: 'b' was not declared in this scope 9 | cin >> b[0] >> b[1] >> b[2] >> b[3]; | ^ a.cc:16:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | cout << hit << blow-hit << std::endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s101952171
p00025
C++
#include <iostream> #include <array> int main(){ std::array(u_int, 4) a, b; int hit=0, blow=0; while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ cin >> b[0] >> b[1] >> b[2] >> b[3]; for(int i=0;i<4;i++){ if(a[i]==b[i]) hit++; for(int j=0;j<4;j++){ if(a[i]==b[j]) blow++; } } cout << hit << blow-hit << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:19: error: missing template arguments before '(' token 5 | std::array(u_int, 4) a, b; | ^ a.cc:5:25: error: expected primary-expression before ',' token 5 | std::array(u_int, 4) a, b; | ^ a.cc:8:15: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^~~ | 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:8:22: error: 'a' was not declared in this scope 8 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^ a.cc:9:24: error: 'b' was not declared in this scope 9 | cin >> b[0] >> b[1] >> b[2] >> b[3]; | ^ a.cc:16:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | cout << hit << blow-hit << std::endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s504368494
p00025
C++
#include <iostream> #include <array> int main(){ std::array(u_int, 4) a; std::array(u_int, 4) b; int hit=0, blow=0; while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ cin >> b[0] >> b[1] >> b[2] >> b[3]; for(int i=0;i<4;i++){ if(a[i]==b[i]) hit++; for(int j=0;j<4;j++){ if(a[i]==b[j]) blow++; } } cout << hit << blow-hit << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:19: error: missing template arguments before '(' token 5 | std::array(u_int, 4) a; | ^ a.cc:5:25: error: expected primary-expression before ',' token 5 | std::array(u_int, 4) a; | ^ a.cc:6:19: error: missing template arguments before '(' token 6 | std::array(u_int, 4) b; | ^ a.cc:6:25: error: expected primary-expression before ',' token 6 | std::array(u_int, 4) b; | ^ a.cc:9:15: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 9 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^~~ | 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:9:22: error: 'a' was not declared in this scope 9 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^ a.cc:10:24: error: 'b' was not declared in this scope 10 | cin >> b[0] >> b[1] >> b[2] >> b[3]; | ^ a.cc:17:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 17 | cout << hit << blow-hit << std::endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s358734691
p00025
C++
#include <iostream> #include <array> int main(){ std::array(u_int, 4) a,b; int hit=0, blow=0; while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){ std::cin >> b[0] >> b[1] >> b[2] >> b[3]; for(int i=0;i<4;i++){ if(a[i]==b[i]) hit++; for(int j=0;j<4;j++){ if(a[i]==b[j]) blow++; } } std::cout << hit << blow-hit << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:19: error: missing template arguments before '(' token 5 | std::array(u_int, 4) a,b; | ^ a.cc:5:25: error: expected primary-expression before ',' token 5 | std::array(u_int, 4) a,b; | ^ a.cc:8:27: error: 'a' was not declared in this scope 8 | while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){ | ^ a.cc:9:29: error: 'b' was not declared in this scope 9 | std::cin >> b[0] >> b[1] >> b[2] >> b[3]; | ^
s915586267
p00025
C++
#include <iostream> using namespace std; int main() { int a[4], b, hit, blow, i, j; while (cin >> a[0]) { h = 0, blow = 0; for (i = 1; i < 4; i++) { cin >> a[i]; } for (i = 0; i < 4; i++) { cin >> b; for (j = 0; j < 4; j++) { if (a[j] == b) { if (i == j) { hit++; } else { blow++; } } } } cout << hit << ' ' << blow << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'h' was not declared in this scope 8 | h = 0, blow = 0; | ^
s039608568
p00025
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int a[4],b[4],h,bb,i; while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){ h=bb=0 for(i=0;i<4;i++)if(a[i]==b[i])h++; sort(a,a+4);sort(b,b+4); for(i=0;i<4;i++)if(find(b,b+4,a[i])!=b+4)bb++; bb -= h; cout<<h<<" "<< bb << endl; } zreturn 0; }
a.cc: In function 'int main()': a.cc:7:9: error: expected ';' before 'for' 7 | h=bb=0 | ^ | ; 8 | for(i=0;i<4;i++)if(a[i]==b[i])h++; | ~~~ a.cc:8:18: error: expected ';' before ')' token 8 | for(i=0;i<4;i++)if(a[i]==b[i])h++; | ^ | ; a.cc:14:2: error: 'zreturn' was not declared in this scope 14 | zreturn 0; | ^~~~~~~
s480975070
p00025
C++
#include<iostream> #include<vector> using namespace std; int main(){ vector<int> a(4); while(cin>>a[0]>>a[1]>>a[2]>>a[3]){ vector<int> b(4); cin>>b[0]>>b[1]>>b[2]>>b[3]; int h=0,bl=0; for(int i=0;i<4;++i){ if(b[i]==a[i]) ++h; else if(find(a.begin(),a.end(),b[i])!=a.end()) ++bl; } cout << h << " " << bl << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:37: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 12 | else if(find(a.begin(),a.end(),b[i])!=a.end()) ++bl; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:12:37: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' 12 | else if(find(a.begin(),a.end(),b[i])!=a.end()) ++bl; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
s908642633
p00025
C++
#include <iostream> using namespace std; int main(){ int a[4]; int b[4]; while(1){ int hit = 0; int blow = 0; cin >> a[0] >> a[1] >> a[2] >> a[3]; cin >> b[0] >> b[1] >> b[2] >> b[3]; for(int i=0; i<4; i++){ for(int j=0; j<4; j++){ if(a[i] == b[j]){ if(i == j) hit++; else blow++; } } } } printf("%d %d\n", hit, blow); return 0; }
a.cc: In function 'int main()': a.cc:25:23: error: 'hit' was not declared in this scope 25 | printf("%d %d\n", hit, blow); | ^~~ a.cc:25:28: error: 'blow' was not declared in this scope 25 | printf("%d %d\n", hit, blow); | ^~~~
s240733420
p00025
C++
#include <iostream> #include <vector> using namespace std; int main() { vector<int> a(4), b(4); while (cin >> a[0]) { for (int i = 1; i < 4; i++) cin >> a[i]; for (int i = 0; i < 4; i++) cin >> b[i]; int hit = 0, blow = 0; for (int i = 0; i < 4; i++) { if (find(b.begin(), b.end(), a[i]) != b.end()) { if (a[i] == b[i]) hit++; else blow++; } } cout << hit << " " << blow << endl; } }
a.cc: In function 'int main()': a.cc:12:15: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 12 | if (find(b.begin(), b.end(), a[i]) != b.end()) { | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:12:15: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' 12 | if (find(b.begin(), b.end(), a[i]) != b.end()) { | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
s636481557
p00025
C++
#include <stdio.h> int main(){ int a[5],b[5],i,j; int hit=0,blow=0; while(scanf("%d %d %d %d %d %d %d %d",&a[1],&a[2],&a[3],&a[4],&b[1],&b[2],&b[3],&b[4]) != EOF){ for(i=1;i<=4;i++){ if(a[i]==b[i]){ hit++; } } for(i=1;i<=4;i++){ for(j=1;j<= 4;j++){ if(j != i){ if(a[i]==b[j]){ blow++; } } } printf("%d %d\n",hit,blow); hit=0; blow=0; } return 0; }
a.cc: In function 'int main()': a.cc:23:4: error: expected '}' at end of input 23 | } | ^ a.cc:2:13: note: to match this '{' 2 | int main(){ | ^
s125435483
p00025
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a[4]; int b[4]; while(cin>>a[0]>>a[1]>>a[2]>>a[3]) { for(int i=0; i<4; i++) cin>>b[i]; int hit=0; int blow=0; for(int i=0;i<4;i++) { if(a[i]==b[i]) hit++; else { for(int j=0;j<4;j++) if(a[i]==b[j]) { blow++; } } } } cout<<hit<<" "<<blow<<endl; return 0; }
a.cc: In function 'int main()': a.cc:30:10: error: 'hit' was not declared in this scope 30 | cout<<hit<<" "<<blow<<endl; | ^~~ a.cc:30:20: error: 'blow' was not declared in this scope 30 | cout<<hit<<" "<<blow<<endl; | ^~~~
s981386373
p00025
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a[4]; int b[4]; while(cin>>a[0]>>a[1]>>a[2]>>a[3]) { for(int i=0; i<4; i++) { cin>>b[i]; int hit=0; int blow=0; for(int i=0;i<4;i++) { if(a[i]==b[i]) hit++; else { for(int j=0;j<4;j++) if(a[i]==b[j]) { blow++; } } } } cout<<hit<<" "<<blow<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:31:10: error: 'hit' was not declared in this scope 31 | cout<<hit<<" "<<blow<<endl; | ^~~ a.cc:31:20: error: 'blow' was not declared in this scope 31 | cout<<hit<<" "<<blow<<endl; | ^~~~
s273925342
p00025
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a[4]; int b[4]; while(cin>>a[0]>>a[1]>>a[2]>>a[3]) { for(int i=0; i<4; i++) cin>>b[i]; int hit=0; int blow=0; for(int i=0;i<4;i++) { if(a[i]==b[i]) { hit++; else { for(int j=0;j<4;j++) if(a[i]==b[j]) { blow++; } } } } cout<<hit<<" "<<blow<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:6: error: expected '}' before 'else' 22 | else | ^~~~ a.cc:20:6: note: to match this '{' 20 | { | ^ a.cc:32:10: error: 'hit' was not declared in this scope 32 | cout<<hit<<" "<<blow<<endl; | ^~~ a.cc:32:20: error: 'blow' was not declared in this scope 32 | cout<<hit<<" "<<blow<<endl; | ^~~~ a.cc: At global scope: a.cc:34:4: error: expected unqualified-id before 'return' 34 | return 0; | ^~~~~~ a.cc:35:1: error: expected declaration before '}' token 35 | } | ^
s534818556
p00025
C++
a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);}
a.cc:1:1: error: 'a' does not name a type 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^ a.cc:1:11: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^~~~ a.cc: In function 'int main()': a.cc:1:61: error: 'a' was not declared in this scope 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^ a.cc:1:75: error: 'b' was not declared in this scope 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^ a.cc:1:36: error: 'scanf' was not declared in this scope 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^~~~~ a.cc:1:90: error: 'printf' was not declared in this scope 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} a.cc:1:175: error: 'exit' was not declared in this scope 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);} | ^~~~ a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>' +++ |+#include <cstdlib> 1 | a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);}
s158018815
p00025
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main(void){ while(cin<<n){ int a,b,c,d; cin>>a>>b>>c>>d; int w,x,y,z; int hit=0,blow=0; cin>>w>>x>>y>>z; if(w==a)hit++; else if(w==b||w==c||w==d)blow++; if(x==b)hit++; else if(x==a||x==c||x==d)blow++; if(y==c)hit++; else if(y==b||y==a||y==d)blow++; if(z==d)hit++; else if(z==b||z==c||z==a)blow++; cout<<hit<<" "<<blow<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:16: error: 'n' was not declared in this scope 8 | while(cin<<n){ | ^
s645791886
p00025
C++
#include <iostream> using namespace std; int main() { int i,j; int a[4]; int b[4]; while(1){ int hit = 0; int blow = 0; if(cin.eof())return; for(i=0;i<4;++i)cin>>a[i]; for(i=0;i<4;++i)cin>>b[i]; for(i=0;i<4;++i){ for(j=0;j<4;++j){ if(b[i] == a[j]){ (j == i) ? ++hit : ++blow; } } } cout << hit << ' ' << blow << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:30: error: return-statement with no value, in function returning 'int' [-fpermissive] 13 | if(cin.eof())return; | ^~~~~~
s501710803
p00025
C++
include <iostream> using namespace std; int main() { int a[4], b[4]; while(cin >> a[0] >> a[1] >> a[2] >> a[3]) { cin >> b[0] >> b[1] >> b[2] >> b[3]; int hit=0, blow=0; bool checked[4][4]; for(int i=0;i<4;i++)for(int j=0;j<4;j++)checked[i][j]=false; for(int i = 0; i < 4; i++) { for(int j = i; j < 4; j++) { if(checked[i][j]) continue; if(i == j && a[i] == b[j]) { hit++; checked[i][j] = true; checked[j][i] = true; } else if(a[i] == b[j]) { blow++; checked[i][j] = true; checked[j][i] = true; } } } cout << hit << " " << blow << endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope 8 | while(cin >> a[0] >> a[1] >> a[2] >> a[3]) { | ^~~ a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout << hit << " " << blow << endl; | ^~~~ a.cc:28:35: error: 'endl' was not declared in this scope 28 | cout << hit << " " << blow << endl; | ^~~~
s798861843
p00025
C++
#include <iostream> using namespace std; int main(){ int a[4], b[4]; while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){ int hit = 0, blow = 0; for(int i = 0; i < 4; i++){ for(int j = 0; j < 4; j++){ if(a[i] == b[j]){ if(i == j){ hit++; }else{ blow++; } } } } cout << hit << " " << blow << endl; } return 0; }
a.cc:6:46: error: extended character   is not valid in an identifier 6 | while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){ | ^ a.cc: In function 'int main()': a.cc:6:46: error: expected ')' before '\U00003000' 6 | while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){ | ~ ^~ | ) a.cc:6:46: error: '\U00003000' was not declared in this scope 6 | while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){ | ^~
s352908363
p00025
C++
#include <iostream> #include <math.h> using namespace std; int main() { double num, t; int a[4],b[4]; int hit, brow; while ( cin >> a[0] >> a[1] >> a[2] >> a[3] ) { cin >> b[0] >> b[1] >> b[2] >> b[3]; hit = 0; brow = 0; for( int i = 0; i < 4; i++ ) { for( int j = 0; j < 4; j++ ) { if( b[i] == a[j] ) { if( i == j ) { hit++; } else { brow++; } } } } cout << hit << << " " << brow << endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:40: error: expected primary-expression before '<<' token 27 | cout << hit << << " " << brow << endl; | ^~
s604311054
p00025
C++
#include <iostream> #include <iomanip> #include <cassert> #include <algorithm> #include <functional> #include <vector> #include <string> #include <cstring> #include <stack> #include <queue> #include <map> #include <bitset> #include <sstream> #include <istream> #include <cmath> #include <cstdio> using namespace std; #define vci vector<int> #define vcs vector<string> #define pb push_back #define sz size() #define mapci map<char, int> #define mapsi map<string, int> #define all(x) x.begin(), x.end() #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) #define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--) #define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c) #define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define vcitr vector<int>::iterator #define vcsitr vector<string>::iterator #define mapcitr map<char, int>::iterator #define mapsitr map<string, int>::iterator typedef long long ll; const int iINF = 2147483647; const ll lINF = 9223372036854775807; template <class T> inline void dbg(T t) { cout << t << endl; } int main() { vci a(4), b(4); bool use[10] = { 0 }; while (~scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) { for_(i, 0, 4) use[ a[i] ] = 1; int hit = 0, blow = 0; for_(i, 0, 4) { if (a[i] == b[i]) hit++; else if (use[ b[i] ]) blow++; } cout << hit << " " << blow << endl; } return 0; }
a.cc: In function 'int main()': a.cc:50:105: error: expected ')' before '{' token 50 | while (~scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) { | ~ ^~ | )
s443465546
p00025
C++
#include <iostream> #include <vector> int get_hit(std::vector<u_int> *A, std::vector<u_int> *B) { u_int hit = 0; for(u_int i = 0; i < A -> size(); ++i) if(A -> at(i) == B -> at(i)) ++hit; return hit; } int get_blow(std::vector<u_int> *A, std::vector<u_int> *B) { u_int blow = 0; for(u_int i = 0; i < A -> size(); ++i){ for(u_int j = 0; j < B -> size(); ++j){ if(A -> at(i) == B -> at(j)){ if(i != j) ++blow; break; } } } return blow; } int main() { const u_int number = 4; std::vector<u_int> A; std::vector<u_int> B; A.reserve(number); B.reserve(number); std::array<u_int, number> array; bool flag = true; while(std::cin >> array[0] >> array[1] >> array[2] >> array[3]){ if(flag){ A.clear(); B.clear(); for(u_int i = 0; i < number; ++i) A.push_back(array.at(i)); flag = !flag; }else{ for(u_int i = 0; i < number; ++i) B.push_back(array.at(i)); std::cout << get_hit(&A, &B) << " " << get_blow(&A, &B) << std::endl; flag = !flag; } } return 0; }
a.cc: In function 'int main()': a.cc:38:31: error: aggregate 'std::array<unsigned int, 4> array' has incomplete type and cannot be defined 38 | std::array<u_int, number> array; | ^~~~~ a.cc:3:1: note: 'std::array' is defined in header '<array>'; this is probably fixable by adding '#include <array>' 2 | #include <vector> +++ |+#include <array> 3 |
s018712338
p00026
Java
import java.util.Scanner; public class DroppingInc { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); scanner.useDelimiter(",|\\n"); int x,y,plotSize; int paper[][] = new int[14][14]; int zeroCellNum = 0; int mostDark = 0; while(scanner.hasNext()){ x = 2 + scanner.nextInt(); y = 2 + scanner.nextInt(); plotSize = scanner.nextInt(); System.out.println(x + " " + y + " " + plotSize); paper[x][y]++; paper[x+1][y]++; paper[x-1][y]++; paper[x][y+1]++; paper[x][y-1]++; if(plotSize >= 2){ paper[x+1][y+1]++; paper[x+1][y-1]++; paper[x-1][y+1]++; paper[x-1][y-1]++; } if(plotSize == 3){ paper[x+2][y]++; paper[x-2][y]++; paper[x][y+2]++; paper[x][y-2]++; } } for(int i=2; i<12; i++){ for(int j=2; j<12; j++){ if(paper[i][j] == 0){ zeroCellNum++; System.out.println("i=" + i + " j=" + j); } if(paper[i][j] > mostDark){ mostDark = paper[i][j]; } } } System.out.println(zeroCellNum); System.out.println(mostDark); } }
Main.java:2: error: class DroppingInc is public, should be declared in a file named DroppingInc.java public class DroppingInc { ^ 1 error
s647689942
p00026
Java
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class AOJ0026DroppingInk { public static void main(String[] args) { exec(); } private static void exec() { Scanner sc = new Scanner(System.in); List<String> mapPointList = new ArrayList<String>(); int[][] dropPoint = null; // インキが滲んだ座標 while (sc.hasNextInt()) { int x = sc.nextInt(); // x座標 int y = sc.nextInt(); // y座標 int size = sc.nextInt(); // インキ滴サイズ // サイズ毎にインキが滲む座標を計算 if (size == 1) { dropPoint = smallDrop(x, y); } else if (size == 2) { dropPoint = middleDrop(x, y); } else if (size == 3) { dropPoint = largeDrop(x, y); } // インキが滲んだ紙の座標を計算 mapPointList = writePointMapArray(mapPointList, dropPoint); // 結果を計算 int[] result = writeDeepPoint(mapPointList); System.out.println(result[0]); System.out.println(result[1]); } } private static List<String> writePointMapArray(List<String> mapPointList, int[][] pointArray) { int index = 0; for (int point : pointArray[0]) { if ((point >= 0 && point < 10) && (pointArray[1][index] >= 0 && pointArray[1][index] < 10)) { String mapPoint = String.valueOf(point) + String.valueOf(pointArray[1][index]); mapPointList.add(mapPoint); } index++; } return mapPointList; } private static int[] writeDeepPoint(List<String> mapPointList) { Map<String, Integer> pointMap = new HashMap<String, Integer>(); int deepPoint = 1; // 最も濃い座標を計算 for (String point : mapPointList) { if (pointMap.containsKey(point)) { Integer number = pointMap.get(point); pointMap.remove(point); pointMap.put(point, number + 1); if (deepPoint < pointMap.get(point)) { deepPoint = pointMap.get(point); } } else { pointMap.put(point, 1); } } // 滲んでいない座標数を計算 int whitePoint = 100 - pointMap.size(); int[] result = new int[] { whitePoint, deepPoint }; return result; } private static int[][] largeDrop(int x, int y) { int[][] largeDropPointArray; largeDropPointArray = new int[2][]; largeDropPointArray[0] = new int[] { x, x - 1, x, x + 1, x - 2, x - 1, x, x + 1, x + 2, x - 1, x, x + 1, x }; largeDropPointArray[1] = new int[] { y - 2, y - 1, y - 1, y - 1, y, y, y, y, y, y + 1, y + 1, y + 1, y + 2 }; return largeDropPointArray; } private static int[][] middleDrop(int x, int y) { int[][] middleDropPointArray; middleDropPointArray = new int[2][]; middleDropPointArray[0] = new int[] { x - 1, x, x + 1, x - 1, x, x + 1, x - 1, x, x + 1 }; middleDropPointArray[1] = new int[] { y - 1, y - 1, y - 1, y, y, y, y + 1, y + 1, y + 1 }; return middleDropPointArray; } private static int[][] smallDrop(int x, int y) { int[][] smallDropPointArray; smallDropPointArray = new int[2][]; smallDropPointArray[0] = new int[] { x, x - 1, x, x + 1, x }; smallDropPointArray[1] = new int[] { y - 1, y, y, y, y + 1 }; return smallDropPointArray; } }
Main.java:7: error: class AOJ0026DroppingInk is public, should be declared in a file named AOJ0026DroppingInk.java public class AOJ0026DroppingInk { ^ 1 error
s519605433
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class V00026 { private static BufferedReader br; private static int[][] squares; static { br = new BufferedReader(new InputStreamReader(System.in)); squares = new int[10][10]; } public static void main(String[] args) throws IOException { String line; int x, y, size, blind = 100, max = 0; while ((line = br.readLine()) != null && !line.isEmpty()) { StringTokenizer st = new StringTokenizer(line, ","); while (st.hasMoreTokens()) { x = Integer.parseInt(st.nextToken()); y = Integer.parseInt(st.nextToken()); size = Integer.parseInt(st.nextToken()); squares[x][y]++; switch (size) { case 1: set1(x, y); break; case 2: set1(x, y); set2(x, y); break; case 3: set1(x, y); set2(x, y); set3(x, y); default: break; } } } for (int[] square : squares) { for (int value : square) { if (value != 0) { blind--; } if (max < value) { max = value; } } } System.out.println(blind + "\n" + max); } private static void set1(int x, int y) { if (x > 0) { squares[x - 1][y]++; } if (x < 9) { squares[x + 1][y]++; } if (y > 0) { squares[x][y - 1]++; } if (y < 9) { squares[x][y + 1]++; } } private static void set2(int x, int y) { if (x > 0 && y > 0) { squares[x - 1][y - 1]++; } if (x > 0 && y < 9) { squares[x - 1][y + 1]++; } if (x < 9 && y > 0) { squares[x + 1][y - 1]++; } if (x < 9 && y < 10) { squares[x + 1][y + 1]++; } } private static void set3(int x, int y) { if (x - 1 > 0) { squares[x - 2][y]++; } if (x + 1 < 9) { squares[x + 2][y]++; } if (y - 1 > 0) { squares[x][y - 2]++; } if (y + 1 < 9) { squares[x][y + 2]++; } } }
Main.java:7: error: class V00026 is public, should be declared in a file named V00026.java public class V00026 { ^ 1 error
s239782397
p00026
Java
int field[][] = setField(); System.out.println("入力してください"); Scanner input = new Scanner(System.in); while (input.hasNext()) { String[] inputString = input.next().split(","); drop(field, Integer.parseInt(inputString[0]), Integer.parseInt(inputString[1]), Integer.parseInt(inputString[2]) ); } amountOfWhite(field); maxDepth(field); } private static int[][] setField() { int field[][] = new int[10][10]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { field[i][j] = 0; } } return field; } private static void drop(int[][] field, int x, int y, int size) { switch (size) { case 1: dropSmall(field, x, y); break; case 2: dropMiddle(field, x, y); break; case 3: dropLarge(field, x, y); break; } } private static void dropLarge(int[][] field, int x, int y) { dropMiddle(field, x, y); int dropX[] = { -2, 0, 2, 0 }; int dropY[] = { 0, -2, 0, 2 }; for (int i = 0; i < dropX.length; i++) { x += dropX[i]; y += dropY[i]; dropping(field, x, y); } } private static void dropMiddle(int[][] field, int x, int y) { dropSmall(field, x, y); int dropX[] = { -1, -1, 1, 1 }; int dropY[] = { 1, -1, 1, -1 }; for (int i = 0; i < dropX.length; i++) { x += dropX[i]; y += dropY[i]; dropping(field, x, y); } } private static void dropSmall(int[][] field, int x, int y) { int dropX[] = { -1, 0, 1, 0 }; int dropY[] = { 0, -1, 0, 1 }; dropping(field, x, y); for (int i = 0; i < dropX.length; i++) { x += dropX[i]; y += dropY[i]; dropping(field, x, y); } } private static int[][] dropping(int[][] field, int x, int y) { if (0 < x || x < 10 || 0 < y || y < 10) { field[x][y] += 1; } return field; } private static void amountOfWhite(int[][] field){ int count = 0; for (int i = 0; i < 9; i++) { for ( int j = 0; j < 9; j++) { if(field[i][j] == 0){ count++; } } } System.out.println(count); } private static void maxDepth(int[][] field){ int maxDepth = 0; for (int i = 0; i < 9; i++) { for ( int j = 0; j < 9; j++) { if(maxDepth < field[i][j]){ maxDepth = field[i][j]; } } } System.out.println(maxDepth); }
Main.java:1: error: class, interface, enum, or record expected int field[][] = setField(); ^ Main.java:2: error: class, interface, enum, or record expected System.out.println("????????"); ^ Main.java:3: error: unnamed classes are a preview feature and are disabled by default. Scanner input = new Scanner(System.in); ^ (use --enable-preview to enable unnamed classes) Main.java:4: error: class, interface, enum, or record expected while (input.hasNext()) { ^ Main.java:6: error: class, interface, enum, or record expected drop(field, Integer.parseInt(inputString[0]), ^ Main.java:9: error: class, interface, enum, or record expected } ^ Main.java:11: error: class, interface, enum, or record expected maxDepth(field); ^ Main.java:13: error: class, interface, enum, or record expected } ^ Main.java:17: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:17: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:17: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:18: error: class, interface, enum, or record expected for (int j = 0; j < 9; j++) { ^ Main.java:18: error: class, interface, enum, or record expected for (int j = 0; j < 9; j++) { ^ Main.java:20: error: class, interface, enum, or record expected } ^ Main.java:23: error: class, interface, enum, or record expected } ^ Main.java:29: error: class, interface, enum, or record expected break; ^ Main.java:31: error: class, interface, enum, or record expected case 2: ^ Main.java:33: error: class, interface, enum, or record expected break; ^ Main.java:34: error: class, interface, enum, or record expected case 3: ^ Main.java:36: error: class, interface, enum, or record expected break; ^ Main.java:37: error: class, interface, enum, or record expected } ^ Main.java:45: error: class, interface, enum, or record expected int dropX[] = { -2, 0, 2, 0 }; ^ Main.java:46: error: class, interface, enum, or record expected int dropY[] = { 0, -2, 0, 2 }; ^ Main.java:48: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:48: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:48: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:50: error: class, interface, enum, or record expected y += dropY[i]; ^ Main.java:51: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:52: error: class, interface, enum, or record expected } ^ Main.java:59: error: class, interface, enum, or record expected int dropX[] = { -1, -1, 1, 1 }; ^ Main.java:60: error: class, interface, enum, or record expected int dropY[] = { 1, -1, 1, -1 }; ^ Main.java:62: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:62: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:62: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:64: error: class, interface, enum, or record expected y += dropY[i]; ^ Main.java:65: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:66: error: class, interface, enum, or record expected } ^ Main.java:71: error: class, interface, enum, or record expected int dropY[] = { 0, -1, 0, 1 }; ^ Main.java:72: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:74: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:74: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:74: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:76: error: class, interface, enum, or record expected y += dropY[i]; ^ Main.java:77: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:78: error: class, interface, enum, or record expected } ^ Main.java:84: error: class, interface, enum, or record expected } ^ Main.java:86: error: class, interface, enum, or record expected } ^ Main.java:90: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:90: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:90: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:91: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:91: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:94: error: class, interface, enum, or record expected } ^ Main.java:98: error: class, interface, enum, or record expected } ^ Main.java:102: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:102: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:102: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:103: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:103: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:106: error: class, interface, enum, or record expected } ^ Main.java:110: error: class, interface, enum, or record expected } ^ 61 errors
s459781968
p00026
Java
int field[][] = setField(); System.out.println("入力してください"); Scanner input = new Scanner(System.in); while (input.hasNext()) { String[] inputString = input.next().split(","); drop(field, Integer.parseInt(inputString[0]), Integer.parseInt(inputString[1]), Integer.parseInt(inputString[2]) ); } amountOfWhite(field); maxDepth(field); } private static int[][] setField() { int field[][] = new int[10][10]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { field[i][j] = 0; } } return field; } private static void drop(int[][] field, int x, int y, int size) { switch (size) { case 1: dropSmall(field, x, y); break; case 2: dropMiddle(field, x, y); break; case 3: dropLarge(field, x, y); break; } } private static void dropLarge(int[][] field, int x, int y) { dropMiddle(field, x, y); int dropX[] = { -2, 0, 2, 0 }; int dropY[] = { 0, -2, 0, 2 }; for (int i = 0; i < dropX.length; i++) { x += dropX[i]; y += dropY[i]; dropping(field, x, y); } } private static void dropMiddle(int[][] field, int x, int y) { dropSmall(field, x, y); int dropX[] = { -1, -1, 1, 1 }; int dropY[] = { 1, -1, 1, -1 }; for (int i = 0; i < dropX.length; i++) { x += dropX[i]; y += dropY[i]; dropping(field, x, y); } } private static void dropSmall(int[][] field, int x, int y) { int dropX[] = { -1, 0, 1, 0 }; int dropY[] = { 0, -1, 0, 1 }; dropping(field, x, y); for (int i = 0; i < dropX.length; i++) { x += dropX[i]; y += dropY[i]; dropping(field, x, y); } } private static int[][] dropping(int[][] field, int x, int y) { if (0 < x || x < 10 || 0 < y || y < 10) { field[x][y] += 1; } return field; } private static void amountOfWhite(int[][] field){ int count = 0; for (int i = 0; i < 9; i++) { for ( int j = 0; j < 9; j++) { if(field[i][j] == 0){ count++; } } } System.out.println(count); } private static void maxDepth(int[][] field){ int maxDepth = 0; for (int i = 0; i < 9; i++) { for ( int j = 0; j < 9; j++) { if(maxDepth < field[i][j]){ maxDepth = field[i][j]; } } } System.out.println(maxDepth); }
Main.java:1: error: class, interface, enum, or record expected int field[][] = setField(); ^ Main.java:2: error: class, interface, enum, or record expected System.out.println("????????"); ^ Main.java:3: error: unnamed classes are a preview feature and are disabled by default. Scanner input = new Scanner(System.in); ^ (use --enable-preview to enable unnamed classes) Main.java:4: error: class, interface, enum, or record expected while (input.hasNext()) { ^ Main.java:6: error: class, interface, enum, or record expected drop(field, Integer.parseInt(inputString[0]), ^ Main.java:9: error: class, interface, enum, or record expected } ^ Main.java:11: error: class, interface, enum, or record expected maxDepth(field); ^ Main.java:13: error: class, interface, enum, or record expected } ^ Main.java:17: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:17: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:17: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:18: error: class, interface, enum, or record expected for (int j = 0; j < 9; j++) { ^ Main.java:18: error: class, interface, enum, or record expected for (int j = 0; j < 9; j++) { ^ Main.java:20: error: class, interface, enum, or record expected } ^ Main.java:23: error: class, interface, enum, or record expected } ^ Main.java:29: error: class, interface, enum, or record expected break; ^ Main.java:31: error: class, interface, enum, or record expected case 2: ^ Main.java:33: error: class, interface, enum, or record expected break; ^ Main.java:34: error: class, interface, enum, or record expected case 3: ^ Main.java:36: error: class, interface, enum, or record expected break; ^ Main.java:37: error: class, interface, enum, or record expected } ^ Main.java:45: error: class, interface, enum, or record expected int dropX[] = { -2, 0, 2, 0 }; ^ Main.java:46: error: class, interface, enum, or record expected int dropY[] = { 0, -2, 0, 2 }; ^ Main.java:48: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:48: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:48: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:50: error: class, interface, enum, or record expected y += dropY[i]; ^ Main.java:51: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:52: error: class, interface, enum, or record expected } ^ Main.java:59: error: class, interface, enum, or record expected int dropX[] = { -1, -1, 1, 1 }; ^ Main.java:60: error: class, interface, enum, or record expected int dropY[] = { 1, -1, 1, -1 }; ^ Main.java:62: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:62: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:62: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:64: error: class, interface, enum, or record expected y += dropY[i]; ^ Main.java:65: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:66: error: class, interface, enum, or record expected } ^ Main.java:71: error: class, interface, enum, or record expected int dropY[] = { 0, -1, 0, 1 }; ^ Main.java:72: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:74: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:74: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:74: error: class, interface, enum, or record expected for (int i = 0; i < dropX.length; i++) { ^ Main.java:76: error: class, interface, enum, or record expected y += dropY[i]; ^ Main.java:77: error: class, interface, enum, or record expected dropping(field, x, y); ^ Main.java:78: error: class, interface, enum, or record expected } ^ Main.java:84: error: class, interface, enum, or record expected } ^ Main.java:86: error: class, interface, enum, or record expected } ^ Main.java:90: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:90: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:90: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:91: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:91: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:94: error: class, interface, enum, or record expected } ^ Main.java:98: error: class, interface, enum, or record expected } ^ Main.java:102: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:102: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:102: error: class, interface, enum, or record expected for (int i = 0; i < 9; i++) { ^ Main.java:103: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:103: error: class, interface, enum, or record expected for ( int j = 0; j < 9; j++) { ^ Main.java:106: error: class, interface, enum, or record expected } ^ Main.java:110: error: class, interface, enum, or record expected } ^ 61 errors
s403331744
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Question2 { public static void main(String[] args) { int field[][] = setField(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = null; while (true) { try { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); } if (input == null || input.isEmpty()) { break; } ; String[] inputs = input.split(","); drop(field, Integer.parseInt(inputs[0]), Integer.parseInt(inputs[1]), Integer.parseInt(inputs[2])); } amountOfWhite(field); maxDepth(field); } private static int[][] setField() { int field[][] = new int[10][10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { field[i][j] = 0; } } return field; } private static void drop(int[][] field, int x, int y, int size) { switch (size) { case 1: dropSmall(field, x, y); break; case 2: dropMiddle(field, x, y); break; case 3: dropLarge(field, x, y); break; } } private static void dropLarge(int[][] field, int x, int y) { dropMiddle(field, x, y); int dropX[] = { -2, 0, 2, 0 }; int dropY[] = { 0, -2, 0, 2 }; for (int i = 0; i < dropX.length; i++) { dropping(field, x + dropX[i], y + dropY[i]); } } private static void dropMiddle(int[][] field, int x, int y) { dropSmall(field, x, y); int dropX[] = { -1, -1, 1, 1 }; int dropY[] = { 1, -1, 1, -1 }; for (int i = 0; i < dropX.length; i++) { dropping(field, x + dropX[i], y + dropY[i]); } } private static void dropSmall(int[][] field, int x, int y) { int dropX[] = { -1, 0, 1, 0 }; int dropY[] = { 0, -1, 0, 1 }; dropping(field, x, y); for (int i = 0; i < dropX.length; i++) { dropping(field, x + dropX[i], y + dropY[i]); } } private static int[][] dropping(int[][] field, int x, int y) { if (0 <= x || x < 10 || 0 <= y || y < 10) { field[x][y] += 1; } return field; } private static void amountOfWhite(int[][] field) { int count = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (field[i][j] == 0) { count++; } } } System.out.println(count); } private static void maxDepth(int[][] field) { int maxDepth = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (maxDepth < field[i][j]) { maxDepth = field[i][j]; } } } System.out.println(maxDepth); } }
Main.java:5: error: class Question2 is public, should be declared in a file named Question2.java public class Question2 { ^ 1 error
s188905032
p00026
Java
package volume0; import java.io.IOException; import java.util.Scanner; public class MAIN { // 10*10????????????????????????????????´???????????????14*14????????????????????? private static int[][] square = new int[14][14]; private static int SMALL_INK = 1; private static int LARGE_INK = 3; private static int ALIGNMENT = 2; /** * ?¨??????\??????????????????????????????????????????????????????????????£???????????????????????????????????? * ??????????????\??????????????????????????????????????????????????§????????????????????°??¨??????????????????????????????????????????????????? * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { int mostDeep = 0; int whiteTiles = 0; String[] inputString; String readLine = ""; Scanner input = new Scanner(System.in); while (input.hasNext()) { readLine = input.next(); // ???????????£???????????????????????????????????? inputString = readLine.split(",", 0); inkPoint(Integer.parseInt(inputString[0]) + ALIGNMENT, Integer.parseInt(inputString[1]) + ALIGNMENT, Integer.parseInt(inputString[2])); } // 10*10?????????????????°?????????????????????????????????????????°??¨??????????????????????????????????????? for (int i = 2; i < 12; i++) { for (int j = 2; j < 12; j++) { if (square[i][j] == 0) { whiteTiles++; } else { if (square[i][j] > mostDeep) { mostDeep = square[i][j]; } } } } System.out.println(whiteTiles + "\r\n" + mostDeep); } /** * square???2???12??????????????????????????¨??? * * @param x * @param y * @param inkSize */ static void inkPoint(int x, int y, int inkSize) { square[x][y - 1]++; square[x - 1][y]++; square[x][y]++; square[x + 1][y]++; square[x][y + 1]++; if (inkSize != SMALL_INK) { square[x - 1][y - 1]++; square[x + 1][y - 1]++; square[x - 1][y + 1]++; square[x + 1][y + 1]++; } if (inkSize == LARGE_INK) { square[x][y - 2]++; square[x - 2][y]++; square[x + 2][y]++; square[x][y + 2]++; } } }
Main.java:6: error: class MAIN is public, should be declared in a file named MAIN.java public class MAIN { ^ 1 error
s817022780
p00026
Java
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; public class Main1 { public static void main(String[] args) { int x = 0; int y = 0; int scale = 0; //?´?[10??10] int[][] math = new int[10][10]; HashSet<Point> scopes = new HashSet<Point>(); //??\??????????????? BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { String inputStr = null; try { inputStr = br.readLine(); } catch (IOException e) { e.printStackTrace(); } if (inputStr == null || inputStr.isEmpty()) { break; } //??\???????????????","??§?????? String[] inputSplitStr = inputStr.split(","); x = Integer.valueOf(inputSplitStr[0]); y = Integer.valueOf(inputSplitStr[1]); scale = Integer.valueOf(inputSplitStr[2]); scopes.clear(); // ???????????´???????????????????¨???? switch (scale) { case 1: //???????????´????°???? scopes = calSmallScopes(x, y, scopes); break; case 2: //???????????´????????? scopes = calMediumScopes(x, y, scopes); break; case 3: //???????????´?????§??? scopes = calLargeScopes(x, y, scopes); break; } //???????????´?????????????????????(10??10)??§????????°1?????????????????? for (Point scope : scopes) { if (0 <= scope.x && scope.x < 10 && 0 <= scope.y && scope.y < 10) { math[scope.x][scope.y]++; } } } //???????????¶????????????????????¨????????????????????????????????? int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static HashSet<Point> calSmallScopes(int x, int y, HashSet<Point> scopes) { scopes.add(new Point(x - 1, y)); scopes.add(new Point(x, y - 1)); scopes.add(new Point(x, y)); scopes.add(new Point(x, y + 1)); scopes.add(new Point(x + 1, y)); return scopes; } private static HashSet<Point> calMediumScopes(int x, int y, HashSet<Point> scopes) { scopes.add(new Point(x - 1, y - 1)); scopes.add(new Point(x - 1, y)); scopes.add(new Point(x - 1, y + 1)); scopes.add(new Point(x, y - 1)); scopes.add(new Point(x, y)); scopes.add(new Point(x, y + 1)); scopes.add(new Point(x + 1, y - 1)); scopes.add(new Point(x + 1, y)); scopes.add(new Point(x + 1, y + 1)); return scopes; } private static HashSet<Point> calLargeScopes(int x, int y, HashSet<Point> scopes) { scopes.add(new Point(x - 2, y)); scopes.add(new Point(x - 1, y - 1)); scopes.add(new Point(x - 1, y)); scopes.add(new Point(x - 1, y + 1)); scopes.add(new Point(x, y - 2)); scopes.add(new Point(x, y - 1)); scopes.add(new Point(x, y)); scopes.add(new Point(x, y + 1)); scopes.add(new Point(x, y + 2)); scopes.add(new Point(x + 1, y - 1)); scopes.add(new Point(x + 1, y)); scopes.add(new Point(x + 1, y + 1)); scopes.add(new Point(x + 2, y)); return scopes; } }
Main.java:7: error: class Main1 is public, should be declared in a file named Main1.java public class Main1 { ^ 1 error
s624616577
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main4 { static int[][] math; static final int MATH_LENGTH = 10; public static void main(String[] args) throws IOException { //変数の初期化 math = new int[10][10]; int x = 0, y = 0; int scale = 0; //入力値を取得 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while (true) { inputStr = br.readLine(); if (inputStr == null || inputStr.isEmpty()) { break; } //入力文字列を","で分割 String[] inputSplitStr = inputStr.split(","); x = Integer.valueOf(inputSplitStr[0]); y = Integer.valueOf(inputSplitStr[1]); scale = Integer.valueOf(inputSplitStr[2]); // インキ滴が滲む範囲の計算 switch (scale) { case 1: //インキ滴「小」 setSmallInk(x, y); break; case 2: //インキ滴「中」 setMediumInk(x, y); break; case 3: //インキ滴「大」 setLargeInk(x, y); break; } } //塗りつぶしがないマスと最も濃いマスをカウント int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < MATH_LENGTH; i++) { for (int j = 0; j < MATH_LENGTH; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static void setSmallInk(int x, int y) { //左 if (0 <= x - 1) { math[x - 1][y]++; } //中上 if (0 <= y - 1) { math[x][y - 1]++; } //中央 math[x][y]++; //中下 if (MATH_LENGTH > y + 1) { math[x][y + 1]++; } //右 if (MATH_LENGTH > x + 1) { math[x + 1][y]++; } } /** * [機能] インキ滴「中」のマスの塗りつぶし * * @param x * @param y */ private static void setMediumInk(int x, int y) { //左 if (0 <= x - 1) { //左中 math[x - 1][y]++; //左上 if (0 <= y - 1) { math[x - 1][y - 1]++; } //左下 if (MATH_LENGTH > y + 1) { math[x - 1][y + 1]++; } } //中上 if (0 <= y - 1) { math[x][y - 1]++; } //中央 math[x][y]++; //中下 if (MATH_LENGTH > y + 1) { math[x][y + 1]++; } //右 if (MATH_LENGTH > x + 1) { math[x + 1][y]++; //右上 if (0 <= y - 1) { math[x + 1][y - 1]++; } //右下 if (MATH_LENGTH > y + 1) { math[x + 1][y + 1]++; } } } private static void setLargeInk(int x, int y) { //中央 math[x][y]++; //最左 if (0 <= x - 2) { //最左中 math[x - 2][y]++; //左中 math[x - 1][y]++; //左上 if (0 <= y - 1) { math[x - 1][y - 1]++; } //左下 if (MATH_LENGTH > y + 1) { math[x - 1][y + 1]++; } } else if (0 <= x - 1) { //左 //左中 math[x - 1][y]++; //左上 if (0 <= y - 1) { math[x - 1][y - 1]++; } //左下 if (MATH_LENGTH > y + 1) { math[x - 1][y + 1]++; } } //最右 if (MATH_LENGTH > x + 2) { //最右中 math[x + 2][y]++; //右中 math[x + 1][y]++; //右上 if (0 <= y - 1) { math[x + 1][y - 1]++; } //右下 if (MATH_LENGTH > y + 1) { math[x + 1][y + 1]++; } } else if (MATH_LENGTH > x + 1) { //右 //右中 math[x + 1][y]++; //右上 if (0 <= y - 1) { math[x + 1][y - 1]++; } //左下 if (MATH_LENGTH > y + 1) { math[x + 1][y + 1]++; } } //最上 if (0 <= y - 2) { //最中上 math[x][y - 2]++; //中上 math[x][y - 1]++; } else if (0 <= y - 1) { //上 //中上 math[x][y - 1]++; } //最下 if (MATH_LENGTH > y + 2) { //最中下 math[x][y + 2]++; //中下 math[x][y + 1]++; } else if (MATH_LENGTH > y + 1) {//中下 //中下 math[x][y + 1]++; } } }
Main.java:7: error: class Main4 is public, should be declared in a file named Main4.java public class Main4 { ^ 1 error
s518525740
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int[][] math; static final int MATH_LENGTH = 10; public static void main(String[] args) throws IOException { //紙 math = new int[10][10]; int scale; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while (true) { inputStr = br.readLine(); if (inputStr == null || inputStr.isEmpty()) { break; } String[] inputSplitStr = inputStr.split(","); scale = Integer.valueOf(inputSplitStr[2]); switch (scale) { case 1: //インキ滴「小」 setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); break; case 2: //インキ滴「中」 setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); break; case 3: //インキ滴「大」 setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); break; } } //集計 int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < MATH_LENGTH; i++) { for (int j = 0; j < MATH_LENGTH; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static void setSmallInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } } private static void setMediumInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } private static void setLargeInk(int x, int y) { math[x][y]++; if ((x - 2) >= 0) { math[x - 2][y]++; } if (MATH_LENGTH > (x + 2)) { math[x + 2][y]++; } if ((y - 2) >= 0) { math[x][y - 2]++; } if (MATH_LENGTH > (y + 2)) { math[x][y + 2]++; } if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } }
Main.java:27: error: ')' or ',' expected setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); ^ Main.java:30: error: ')' or ',' expected setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); ^ Main.java:33: error: ')' or ',' expected setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); ^ 3 errors
s309319964
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int[][] math; static final int MATH_LENGTH = 10; public static void main(String[] args) throws IOException { //紙 math = new int[10][10]; int scale; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while (true) { inputStr = br.readLine(); if (inputStr == null || inputStr.isEmpty()) { break; } String[] inputSplitStr = inputStr.split(","); switch (nteger.valueOf(inputSplitStr[2])) { case 1: //インキ滴「小」 setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); break; case 2: //インキ滴「中」 setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); break; case 3: //インキ滴「大」 setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); break; } } //集計 int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < MATH_LENGTH; i++) { for (int j = 0; j < MATH_LENGTH; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static void setSmallInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } } private static void setMediumInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } private static void setLargeInk(int x, int y) { math[x][y]++; if ((x - 2) >= 0) { math[x - 2][y]++; } if (MATH_LENGTH > (x + 2)) { math[x + 2][y]++; } if ((y - 2) >= 0) { math[x][y - 2]++; } if (MATH_LENGTH > (y + 2)) { math[x][y + 2]++; } if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } }
Main.java:26: error: ')' or ',' expected setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); ^ Main.java:29: error: ')' or ',' expected setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); ^ Main.java:32: error: ')' or ',' expected setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1]); ^ 3 errors
s291756457
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int[][] math; static final int MATH_LENGTH = 10; public static void main(String[] args) throws IOException { //紙 math = new int[10][10]; int scale; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while (true) { inputStr = br.readLine(); if (inputStr == null || inputStr.isEmpty()) { break; } String[] inputSplitStr = inputStr.split(","); switch (nteger.valueOf(inputSplitStr[2])) { case 1: //インキ滴「小」 setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; case 2: //インキ滴「中」 setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; case 3: //インキ滴「大」 setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; } } //集計 int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < MATH_LENGTH; i++) { for (int j = 0; j < MATH_LENGTH; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static void setSmallInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } } private static void setMediumInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } private static void setLargeInk(int x, int y) { math[x][y]++; if ((x - 2) >= 0) { math[x - 2][y]++; } if (MATH_LENGTH > (x + 2)) { math[x + 2][y]++; } if ((y - 2) >= 0) { math[x][y - 2]++; } if (MATH_LENGTH > (y + 2)) { math[x][y + 2]++; } if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } }
Main.java:24: error: cannot find symbol switch (nteger.valueOf(inputSplitStr[2])) { ^ symbol: variable nteger location: class Main 1 error
s232194352
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int[][] math; static final int MATH_LENGTH = 10; public static void main(String[] args) throws IOException { math = new int[10][10]; int scale; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while (true) { inputStr = br.readLine(); if (inputStr == null || inputStr.isEmpty()) { break; } String[] inputSplitStr = inputStr.split(","); switch (nteger.valueOf(inputSplitStr[2])) { case 1: //インキ滴「小」 setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; case 2: //インキ滴「中」 setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; case 3: //インキ滴「大」 setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; } } int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < MATH_LENGTH; i++) { for (int j = 0; j < MATH_LENGTH; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static void setSmallInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } } private static void setMediumInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } private static void setLargeInk(int x, int y) { math[x][y]++; if ((x - 2) >= 0) { math[x - 2][y]++; } if (MATH_LENGTH > (x + 2)) { math[x + 2][y]++; } if ((y - 2) >= 0) { math[x][y - 2]++; } if (MATH_LENGTH > (y + 2)) { math[x][y + 2]++; } if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } }
Main.java:21: error: cannot find symbol switch (nteger.valueOf(inputSplitStr[2])) { ^ symbol: variable nteger location: class Main 1 error
s324280719
p00026
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int[][] math; static final int MATH_LENGTH = 10; public static void main(String[] args) throws IOException { math = new int[10][10]; int scale; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while (true) { inputStr = br.readLine(); if (inputStr == null || inputStr.isEmpty()) { break; } string[] inputSplitStr = inputStr.split(","); switch (Integer.valueOf(inputSplitStr[2])) { case 1: //インキ滴「小」 setSmallInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; case 2: //インキ滴「中」 setMediumInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; case 3: //インキ滴「大」 setLargeInk(Integer.valueOf(inputSplitStr[0]), Integer.valueOf(inputSplitStr[1])); break; } } int whiteNumber = 0; int mostNumber = 0; for (int i = 0; i < MATH_LENGTH; i++) { for (int j = 0; j < MATH_LENGTH; j++) { if (math[i][j] == 0) { whiteNumber++; } if (mostNumber < math[i][j]) { mostNumber = math[i][j]; } } } System.out.println(whiteNumber); System.out.println(mostNumber); } private static void setSmallInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } } private static void setMediumInk(int x, int y) { math[x][y]++; if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } private static void setLargeInk(int x, int y) { math[x][y]++; if ((x - 2) >= 0) { math[x - 2][y]++; } if (MATH_LENGTH > (x + 2)) { math[x + 2][y]++; } if ((y - 2) >= 0) { math[x][y - 2]++; } if (MATH_LENGTH > (y + 2)) { math[x][y + 2]++; } if ((x - 1) >= 0) { math[x - 1][y]++; if ((y - 1) >= 0) { math[x - 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x - 1][y + 1]++; } } if ((y - 1) >= 0) { math[x][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x][y + 1]++; } if (MATH_LENGTH > (x + 1)) { math[x + 1][y]++; if ((y - 1) >= 0) { math[x + 1][y - 1]++; } if (MATH_LENGTH > (y + 1)) { math[x + 1][y + 1]++; } } } }
Main.java:19: error: cannot find symbol string[] inputSplitStr = inputStr.split(","); ^ symbol: class string location: class Main 1 error
s873487712
p00026
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int[][] di=new int[10][10]; int max,count=0; String str; while((str=readLine())!=null){ String[] s=str.split(","); int x=Integer.parseInt(s[0]); int y=Integer.parseInt(s[1]); int s=Integer.parseInt(s[2]); drop(x,y,s,di); } for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ max=Math.max(max,di[i][j]); if(di[i][j]==0){ count++; } } } System.out.println(count); System.out.println(max); } static void drop(int x,int y,int s,int[][] di){ if(s==1||s==2||s==3){ di[x][y]++; int[] sx={1,0,-1,0}; int[] sy={0,1,0,-1}; for(int i=0;i<sx.length;i++){ if(x+sx[i]>=0&&x+sx[i]<10&&y+sy[i]>=0&&y+sy[i]<10){ di[x+sx[i]][y+sy[i]]++; } } if(s==2||s==3){ int[] mx={-1,-1,1,1}; int[] my={-1,1,-1,1}; for(int i=0;i<mx.length;i++){ if(x+mx[i]>=0&&x+mx[i]<10&&y+my[i]>=0&&y+my[i]<10){ di[x+mx[i]][y+my[i]]++; } } if(s==3){ int[] lx={-2,0,2,0}; int[] ly={0,-2,0,2}; for(int i=0;i<lx.length;i++){ if(x+lx[i]>=0&&x+lx[i]<10&&y+ly[i]>=0&&y+ly[i]<10){ di[x+lx[i]][y+ly[i]]++; } } } } } } }
Main.java:9: error: cannot find symbol while((str=readLine())!=null){ ^ symbol: method readLine() location: class Main Main.java:13: error: variable s is already defined in method main(String[]) int s=Integer.parseInt(s[2]); ^ Main.java:13: error: array required, but int found int s=Integer.parseInt(s[2]); ^ 3 errors
s871491151
p00026
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int[][] di=new int[10][10]; int max,count=0; String str; while((str=br.readLine())!=null){ String[] s=str.split(","); int x=Integer.parseInt(s[0]); int y=Integer.parseInt(s[1]); int s=Integer.parseInt(s[2]); drop(x,y,s,di); } for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ max=Math.max(max,di[i][j]); if(di[i][j]==0){ count++; } } } System.out.println(count); System.out.println(max); } static void drop(int x,int y,int s,int[][] di){ if(s==1||s==2||s==3){ di[x][y]++; int[] sx={1,0,-1,0}; int[] sy={0,1,0,-1}; for(int i=0;i<sx.length;i++){ if(x+sx[i]>=0&&x+sx[i]<10&&y+sy[i]>=0&&y+sy[i]<10){ di[x+sx[i]][y+sy[i]]++; } } if(s==2||s==3){ int[] mx={-1,-1,1,1}; int[] my={-1,1,-1,1}; for(int i=0;i<mx.length;i++){ if(x+mx[i]>=0&&x+mx[i]<10&&y+my[i]>=0&&y+my[i]<10){ di[x+mx[i]][y+my[i]]++; } } if(s==3){ int[] lx={-2,0,2,0}; int[] ly={0,-2,0,2}; for(int i=0;i<lx.length;i++){ if(x+lx[i]>=0&&x+lx[i]<10&&y+ly[i]>=0&&y+ly[i]<10){ di[x+lx[i]][y+ly[i]]++; } } } } } } }
Main.java:13: error: variable s is already defined in method main(String[]) int s=Integer.parseInt(s[2]); ^ Main.java:13: error: array required, but int found int s=Integer.parseInt(s[2]); ^ 2 errors
s502371820
p00026
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int[][] di=new int[10][10]; int max,count=0; String str; while((str=br.readLine())!=null){ String[] value=str.split(","); int x=Integer.parseInt(value[0]); int y=Integer.parseInt(value[1]); int s=Integer.parseInt(value[2]); drop(x,y,s,di); } for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ max=Math.max(max,di[i][j]); if(di[i][j]==0){ count++; } } } System.out.println(count); System.out.println(max); } static void drop(int x,int y,int s,int[][] di){ if(s==1||s==2||s==3){ di[x][y]++; int[] sx={1,0,-1,0}; int[] sy={0,1,0,-1}; for(int i=0;i<sx.length;i++){ if(x+sx[i]>=0&&x+sx[i]<10&&y+sy[i]>=0&&y+sy[i]<10){ di[x+sx[i]][y+sy[i]]++; } } if(s==2||s==3){ int[] mx={-1,-1,1,1}; int[] my={-1,1,-1,1}; for(int i=0;i<mx.length;i++){ if(x+mx[i]>=0&&x+mx[i]<10&&y+my[i]>=0&&y+my[i]<10){ di[x+mx[i]][y+my[i]]++; } } if(s==3){ int[] lx={-2,0,2,0}; int[] ly={0,-2,0,2}; for(int i=0;i<lx.length;i++){ if(x+lx[i]>=0&&x+lx[i]<10&&y+ly[i]>=0&&y+ly[i]<10){ di[x+lx[i]][y+ly[i]]++; } } } } } } }
Main.java:18: error: variable max might not have been initialized max=Math.max(max,di[i][j]); ^ Main.java:25: error: variable max might not have been initialized System.out.println(max); ^ 2 errors
s642841650
p00026
Java
import java.lang.*; import java.util.*; import java.io.*; public class check { static int array[][]= new int[10][10]; public static void main (String[] arg)throws IOException { BufferedReader input =new BufferedReader (new InputStreamReader (System.in)); String line; StringTokenizer tokenizer1,tokenizer2; int a[] = new int[3]; int max=0, sum=0; while ((line = input.readLine()) != null && !line.isEmpty()) { tokenizer1 = new StringTokenizer(line,","); for(int i=0;i<3;i++){ a[i]=Integer.parseInt(tokenizer1.nextToken()); } if(a[2]==1){ small(a[0],a[1]); } if(a[2]==2){ mid(a[0],a[1]); } if(a[2]==3){ big(a[0],a[1]); } } for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ max=Math.max(max, array[i][j]); if(array[i][j]==0){ sum++; } } } System.out.println(sum); System.out.println(max); } public static void small (int a, int b){ int a2,b2; for(int i=0;i<3;i++){ a2=a+i-1; if (a2 > -1 && a2<10 ){ array[a2][b]++; } } for(int i=0;i<3;i++){ b2=b+i-1; if (b2 > -1 && b2<10 ){ array[a][b2]++; } } array[a][b]--; } public static void mid (int a, int b){ int a2,b2; for(int i=0;i<3;i++){ a2=a+i-1; for(int j=0;j<3;j++){ b2=b+j-1; if (a2 > -1 && a2< 10 && b2 > -1 && b2 < 10){ array[a2][b2]++; } } } } public static void big (int a, int b){ mid(a,b); int i=2; int a2,b2; a2=i+a; if (a2 > -1 && a2<10){ array[a2][b]++; } a2=-i+a; if (a2 > -1 && a2<10){ array[a2][b]++; } b2=i+b; if (b2 > -1 && b2<10){ array[a][b2]++; } b2=-i+b; if (b2 > -1 && b2<10){ array[a][b2]++; } } }
Main.java:5: error: class check is public, should be declared in a file named check.java public class check ^ 1 error
s721106419
p00026
Java
public class Main { static int paper[][] = new int[10][10]; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = null; while ((str = br.readLine()) != null) { // ??\??????????????? String[] input = str.split(","); // ??????????????????????????°?????????????????? int x = Integer.parseInt(input[0]); int y = Integer.parseInt(input[1]); int size = Integer.parseInt(input[2]); // size?????§??????????????£??????????????????????????????????????? switch (size) { case 1: small(x, y); break; case 2: medium(x, y); case 3: large(x, y); } } int clear = 0; int max = 0; // ????????????????????????????????¨1??????????????????????????? for (int i = 0; i < 10; ++i) { for (int j = 0; j < 10; ++j) { // ???????????????????????????????????°?????? if (paper[i][j] == 0) { clear++; } // 1??????????????? if (paper[i][j] > max) { max = paper[i][j]; } } } System.out.println(clear); System.out.println(max); } private static void small(int x, int y) { paper[x][y]++; // ??????????????????????????¨ if (y != 0) { paper[x][y - 1]++; } // ??????????????????????????¨ if (y != 9) { paper[x][y + 1]++; } // ??????????????????????????¨ if (x != 0) { paper[x - 1][y]++; } // ??????????????????????????¨ if (x != 9) { paper[x + 1][y]++; } } private static void medium(int x, int y) { small(x, y); // ??????????????????????????? if (x >= 1 && y >= 1) { paper[x - 1][y - 1]++; } // ??????????????????????????? if (x <= 8 && y >= 1) { paper[x + 1][y - 1]++; } // ??????????????????????????? if (x >= 1 && y <= 8) { paper[x - 1][y + 1]++; } // ??????????????????????????? if (x <= 8 && y <= 8) { paper[x + 1][y + 1]++; } } private static void large(int x, int y) { small(x, y); medium(x, y); // ???????????´???2?????? if (x >= 2) { paper[x - 2][y]++; } // ???????????´???2?????? if (x <= 7) { paper[x + 2][y]++; } // ???????????´???2?????? if (y >= 2) { paper[x][y - 2]++; } // ???????????´???2?????? if (y <= 7) { paper[x][y + 2]++; } } }
Main.java:5: error: cannot find symbol public static void main(String[] args) throws IOException { ^ symbol: class IOException location: class Main Main.java:7: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:7: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:7: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 4 errors
s087068095
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static void main(String[] args){ while(scan.hasNext()){ int count = 0; int max = 0; int[][] paper = new int[10][10]; for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ paper[i][j] = 0; } } int x = scan.nextInt(); int y = scan.nextInt(); int s = scan.nextInt(); if(s == 1){ paper[x-1][y] += 1; paper[x][y-1] += 1; paper[x][y] += 1; paper[x][y+1] += 1; paper[x+1][y] += 1; } else if(s == 2){ paper[x-1][y-1] += 1; paper[x-1][y] += 1; paper[x-1][y+1] += 1; paper[x][y-1] += 1; paper[x][y] += 1; paper[x][y+1] += 1; paper[x+1][y-1] += 1; paper[x+1][y] += 1; paper[x+1][y+1] += 1; } else if(s == 3){ paper[x-2][y] += 1; paper[x-1][y-1] += 1; paper[x-1][y] += 1; paper[x-1][y+1] += 1; paper[x][y-2] += 1; paper[x][y-1] += 1; paper[x][y] += 1; paper[x][y+1] += 1; paper[x][y+2] += 1; paper[x+1][y-1] += 1; paper[x+1][y] += 1; paper[x+1][y+1] += 1; paper[x+2][y] += 1; } } for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ if(paper[i][j] == 0){ count++; } if(max < paper[i][j]){ max = paper[i][j]; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); } }
Main.java:54: error: cannot find symbol if(paper[i][j] == 0){ ^ symbol: variable paper location: class Main Main.java:55: error: cannot find symbol count++; ^ symbol: variable count location: class Main Main.java:57: error: cannot find symbol if(max < paper[i][j]){ ^ symbol: variable max location: class Main Main.java:57: error: cannot find symbol if(max < paper[i][j]){ ^ symbol: variable paper location: class Main Main.java:58: error: cannot find symbol max = paper[i][j]; ^ symbol: variable max location: class Main Main.java:58: error: cannot find symbol max = paper[i][j]; ^ symbol: variable paper location: class Main Main.java:62: error: cannot find symbol System.out.printf("%d\n", count); ^ symbol: variable count location: class Main Main.java:63: error: cannot find symbol System.out.printf("%d\n", max); ^ symbol: variable max location: class Main 8 errors
s741175601
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in) .useDelimiter("[ ,\n]"); public static void main(String[] args){ int[][] paper = new int[10][10]; int count = 0; int max = 0; for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ paper[i][j] = 0; } } while(scan.hasNext()){ String xs = scan.next(); String ys = scan.next(); String sizes = scan.next(); int x = Integer.parseInt(xs); int y = Integer.parseInt(ys); int size = Integer.parseInt(sizes); if(size == 1){ if(x-1 < 0){ } else{ paper[x-1][y] += 1; } if(x < 0 || x >= 10){ } else{ if(y-1 < 0){ } else{ paper[x][y-1] += 1; } if(y < 0 || y >= 10){ } else{ paper[x][y] += 1; } if(y+1 >= 10){ } else{ paper[x][y+1] += 1; } } if(x+1 >= 10){ } else{ paper[x+1][y] += 1; } } if(size == 2){ if(x-1 < 0){ } else{ if(y-1 < 0){ } else{ paper[x-1][y-1] += 1; } if(y < 0 || y >= 10){ } else{ paper[x-1][y] += 1; } if(y+1 >= 10){ } else{ paper[x-1][y+1] += 1; } } if(x < 0 || x >= 10){ } else{ if(y-1 < 0){ } else{ paper[x][y-1] += 1; } if(y < 0 || y >= 10){ } else{ paper[x][y] += 1; } if(y+1 >= 10){ } else{ paper[x][y+1] += 1; } } if(x+1 >= 10){ } else{ if(y-1 < 0){ } else{ paper[x+1][y-1] += 1; } if(y < 0 || y >= 10){ } else{ paper[x+1][y] += 1; } if(y+1 >= 10){ } else{ paper[x+1][y+1] += 1; } } } if(size == 3){ if(x-2 < 0){ } else{ if(y < 0 || y >= 10){ } else{ paper[x-2][y] += 1; } } if(x-1 < 0){ } else{ if(y-1 < 0){ } else{ paper[x-1][y-1] += 1; } if(y < 0 || y >= 10){ } else{ paper[x-1][y] += 1; } if(y+1 >= 10){ } else{ paper[x-1][y+1] += 1; } } if(x < 0 || x >= 10){ } else{ if(y-2 < 0){ } else{ paper[x][y-2] += 1; } if(y-1 < 0){ } else{ paper[x][y-1] += 1; } if(y < 0 || y >= 10){ } else{ papaer[x][y] += 1; } if(y+1 >= 10){ } else{ paper[x][y+1] += 1; } if(y+2 >= 10){ } else{ paper[x][y+2] += 1; } } if(x+1 >= 10){ } else{ if(y-1 < 0){ } else{ paper[x+1][y-1] += 1; } if(y < 0 || y >= 10){ } else{ paper[x+1][y] += 1; } if(y+1 >= 10){ } else{ paper[x+1][y+1] += 1; } } if(x+2 >= 10){ } else{ if(y < 0 || y >= 10){ } else{ paper[x+2][y] += 1; } } } } for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ if(paper[i][j] == 0){ count++; } if(paper[i][j] > max){ max = paper[i][j]; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); } }
Main.java:131: error: cannot find symbol papaer[x][y] += 1; ^ symbol: variable papaer location: class Main 1 error
s880816999
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static void main(String[] args){ int n = 10; int[][] map = new int[n][n]; int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m = d.length / 2; for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[x][y]++; } }
Main.java:51: error: cannot find symbol if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ ^ symbol: variable n location: class Main Main.java:51: error: cannot find symbol if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ ^ symbol: variable n location: class Main Main.java:54: error: cannot find symbol map[x][y]++; ^ symbol: variable map location: class Main Main.java:54: error: cannot find symbol map[x][y]++; ^ symbol: variable x location: class Main Main.java:54: error: cannot find symbol map[x][y]++; ^ symbol: variable y location: class Main 5 errors
s473495132
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); int n = 10; int[][] map = new int[n][n]; public static void main(String[] args){ int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m = d.length / 2; for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[x][y]++; } }
Main.java:37: error: non-static variable n cannot be referenced from a static context for(int i = 0; i < n; i++){ ^ Main.java:38: error: non-static variable n cannot be referenced from a static context for(int j = 0; j < n; j++){ ^ Main.java:39: error: non-static variable map cannot be referenced from a static context max = Math.max(max, map[i][j]); ^ Main.java:40: error: non-static variable map cannot be referenced from a static context if(map[i][j] == 0){ ^ Main.java:52: error: non-static variable n cannot be referenced from a static context if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ ^ Main.java:52: error: non-static variable n cannot be referenced from a static context if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ ^ Main.java:55: error: non-static variable map cannot be referenced from a static context map[x][y]++; ^ Main.java:55: error: cannot find symbol map[x][y]++; ^ symbol: variable x location: class Main Main.java:55: error: cannot find symbol map[x][y]++; ^ symbol: variable y location: class Main 9 errors
s938704755
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); static int n = 10; static int[][] map = new int[n][n]; public static void main(String[] args){ int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m = d.length / 2; for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[x][y]++; } }
Main.java:55: error: cannot find symbol map[x][y]++; ^ symbol: variable x location: class Main Main.java:55: error: cannot find symbol map[x][y]++; ^ symbol: variable y location: class Main 2 errors
s560864958
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); static int n = 10; static int[][] map = new int[n][n]; public static void main(String[] args){ int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m = d.length / 2; for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[xx][yy]++; } }
Main.java:27: error: variable d might not have been initialized int m = d.length / 2; ^ 1 error
s172669180
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); static int n = 10; static int[][] map = new int[n][n]; public static void main(String[] args){ int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m =(int)(d.length / 2); for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[xx][yy]++; } }
Main.java:27: error: variable d might not have been initialized int m =(int)(d.length / 2); ^ 1 error
s798551415
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); static int n = 10; static int[][] map = new int[n][n]; public static void main(String[] args){ int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m = 0; int m =(int)(d.length / 2); for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[xx][yy]++; } }
Main.java:28: error: variable m is already defined in method main(String[]) int m =(int)(d.length / 2); ^ 1 error
s517383250
p00026
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); static int n = 10; static int[][] map = new int[n][n]; public static void main(String[] args){ int[][] small = {{0, 1, 0}, {1, 1, 1}, {0, 1, 0}}; int[][] middle = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; int[][] large = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; while(scan.hasNext()){ String[] ss = scan.nextLine().split(","); int x = Integer.parseInt(ss[0]); int y = Integer.parseInt(ss[1]); int s = Integer.parseInt(ss[2]); int[][] d; if(s == 1){ d = small; } else if(s == 2){ d = middle; } else if(s == 3){ d = large; } int m = 0; m =(int)(d.length / 2); for(int i = - m; i <= m; i++){ for(int j = - m; j <= m; j++){ if(d[i + m][j + m] == 1){ drop(x + i, y + j); } } } int max = 0; int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ max = Math.max(max, map[i][j]); if(map[i][j] == 0){ count++; } } } System.out.printf("%d\n", count); System.out.printf("%d\n", max); scan.close(); } } public static void drop(int xx, int yy){ if(xx < 0 || xx >= n|| yy < 0 || yy >= n){ return; } map[xx][yy]++; } }
Main.java:28: error: variable d might not have been initialized m =(int)(d.length / 2); ^ 1 error
s075169941
p00026
Java
import java.util.Arrays; import java.util.Scanner; public class Main1 { static Scanner sc = new Scanner(System.in); private static final int MASS = 10; private static final int[] dx = {0, 0,-1, 1,-1,-1, 1, 1, 0, 0,-2, 2}; private static final int[] dy = {-1, 1, 0, 0,-1, 1,-1, 1,-2, 2, 0, 0}; public static void main(String[] args) { int map[][] = new int[MASS][MASS]; int count = 0; int max = 0; for(int $ = 0; $ < MASS; $++) { Arrays.fill(map[$], 0); } while(sc.hasNext()) { String[] text = sc.next().split(","); int x = Integer.parseInt(text[0]); int y = Integer.parseInt(text[1]); int ink = Integer.parseInt(text[2]); //???????????????????????°???????????????1???????????? map[x][y]++; //???????????????????????°???????????????1???????????? for(int $ = 0; $ < ink * 4; $++) { int mx = x + dx[$]; int my = y + dy[$]; if(mx >= 0 && mx < MASS && my >= 0 && my < MASS) { map[mx][my]++; } } } //????????¨????????¨?????????????????¨????????????????????°?????? for(int $ = 0; $ < MASS; $++) { for(int i = 0; i < MASS; i++) { if(map[$][i] == 0) { count++; } max = Math.max(max, map[$][i]); } } System.out.println(count); System.out.println(max); } }
Main.java:4: error: class Main1 is public, should be declared in a file named Main1.java public class Main1 { ^ 1 error
s525646518
p00026
Java
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static javaa.String.Math.*; public Main { int INF = 1 << 28; double EPS = 1e-10; int OFS = 2; int[][] map; void run() { Scanner sc = new Scanner(System.in); map = new int[10 + 4][10 + 4]; for(;sc.hasNext(); ) { String[] ss = sc.next().split(","); int[] vals = new int[3]; for(int i=0;i<3;i++) vals[i] = Integer.parseInt(ss[i]); if(val[2] == 1) small(val[0], val[1]); if(val[2] == 2) medium(val[0], val[1]); if(val[2] == 3) large(val[0], val[1]); } int sp = 0, max = 0; for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { if(map[y][x] != 0) max = max(max, map[y][x]); else sp++; } System.out.println(sp); System.out.println(max); } void large(int x, int y) { for(int ny=-2;ny<=2;ny++) { for(int nx=-( 2-abs(i) );nx<=2-abs(i);nx++) map[y+ny+2][x+nx+2]++; } } void medium(int x, int y) { for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { map[y+j+2][x+i+2]++; } } void small(int x, int y) { map[y-1+2][x+2]++; map[y+2][x-1+2]++; map[y+1+2][x+2]++; map[y+2][x+1+2]++; } public static void main(String[] args) { new Main().run(); } }
Main.java:7: error: class, interface, enum, or record expected public Main { ^ Main.java:9: error: unnamed classes are a preview feature and are disabled by default. double EPS = 1e-10; ^ (use --enable-preview to enable unnamed classes) Main.java:28: error: not a statement for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:28: error: illegal start of type for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:28: error: ')' expected for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:28: error: ';' expected for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:56: error: class, interface, enum, or record expected } ^ 7 errors
s034990186
p00026
Java
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static javaa.String.Math.*; public class Main { int INF = 1 << 28; double EPS = 1e-10; int OFS = 2; int[][] map; void run() { Scanner sc = new Scanner(System.in); map = new int[10 + 4][10 + 4]; for(;sc.hasNext(); ) { String[] ss = sc.next().split(","); int[] vals = new int[3]; for(int i=0;i<3;i++) vals[i] = Integer.parseInt(ss[i]); if(val[2] == 1) small(val[0], val[1]); if(val[2] == 2) medium(val[0], val[1]); if(val[2] == 3) large(val[0], val[1]); } int sp = 0, max = 0; for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { if(map[y][x] != 0) max = max(max, map[y][x]); else sp++; } System.out.println(sp); System.out.println(max); } void large(int x, int y) { for(int ny=-2;ny<=2;ny++) { for(int nx=-( 2-abs(i) );nx<=2-abs(i);nx++) map[y+ny+2][x+nx+2]++; } } void medium(int x, int y) { for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { map[y+j+2][x+i+2]++; } } void small(int x, int y) { map[y-1+2][x+2]++; map[y+2][x-1+2]++; map[y+1+2][x+2]++; map[y+2][x+1+2]++; } public static void main(String[] args) { new Main().run(); } }
Main.java:28: error: illegal start of type for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:28: error: not a statement for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:28: error: ')' expected for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ Main.java:28: error: ';' expected for(int x=2;<10+2;x++) for(int y=2;y<10+2;y++) { ^ 4 errors
s175331601
p00026
Java
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static javaa.String.Math.*; public class Main { int INF = 1 << 28; double EPS = 1e-10; int OFS = 2; int[][] map; void run() { Scanner sc = new Scanner(System.in); map = new int[10 + 4][10 + 4]; for(;sc.hasNext(); ) { String[] ss = sc.next().split(","); int[] vals = new int[3]; for(int i=0;i<3;i++) vals[i] = Integer.parseInt(ss[i]); if(val[2] == 1) small(val[0], val[1]); if(val[2] == 2) medium(val[0], val[1]); if(val[2] == 3) large(val[0], val[1]); } int sp = 0, max = 0; for(int x=2;x<10+2;x++) for(int y=2;y<10+2;y++) { if(map[y][x] != 0) max = max(max, map[y][x]); else sp++; } System.out.println(sp); System.out.println(max); } void large(int x, int y) { for(int ny=-2;ny<=2;ny++) { for(int nx=-( 2-abs(i) );nx<=2-abs(i);nx++) map[y+ny+2][x+nx+2]++; } } void medium(int x, int y) { for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { map[y+j+2][x+i+2]++; } } void small(int x, int y) { map[y-1+2][x+2]++; map[y+2][x-1+2]++; map[y+1+2][x+2]++; map[y+2][x+1+2]++; } public static void main(String[] args) { new Main().run(); } }
Main.java:5: error: package javaa.String does not exist import static javaa.String.Math.*; ^ Main.java:22: error: cannot find symbol if(val[2] == 1) small(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:22: error: cannot find symbol if(val[2] == 1) small(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:22: error: cannot find symbol if(val[2] == 1) small(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:23: error: cannot find symbol if(val[2] == 2) medium(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:23: error: cannot find symbol if(val[2] == 2) medium(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:23: error: cannot find symbol if(val[2] == 2) medium(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:24: error: cannot find symbol if(val[2] == 3) large(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:24: error: cannot find symbol if(val[2] == 3) large(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:24: error: cannot find symbol if(val[2] == 3) large(val[0], val[1]); ^ symbol: variable val location: class Main Main.java:29: error: cannot find symbol if(map[y][x] != 0) max = max(max, map[y][x]); ^ symbol: method max(int,int) location: class Main Main.java:38: error: cannot find symbol for(int nx=-( 2-abs(i) );nx<=2-abs(i);nx++) ^ symbol: variable i location: class Main Main.java:38: error: cannot find symbol for(int nx=-( 2-abs(i) );nx<=2-abs(i);nx++) ^ symbol: variable i location: class Main 13 errors
s036171062
p00026
Java
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.String.Math.*; public class Main { int INF = 1 << 28; double EPS = 1e-10; int OFS = 2; int[][] map; void run() { Scanner sc = new Scanner(System.in); map = new int[10 + 4][10 + 4]; for(;sc.hasNext(); ) { String[] ss = sc.next().split(","); int[] val = new int[3]; for(int i=0;i<3;i++) vals[i] = Integer.parseInt(ss[i]); if(val[2] == 1) small(val[0], val[1]); if(val[2] == 2) medium(val[0], val[1]); if(val[2] == 3) large(val[0], val[1]); } int sp = 0, max = 0; for(int x=2;x<10+2;x++) for(int y=2;y<10+2;y++) { if(map[y][x] != 0) max = max(max, map[y][x]); else sp++; } System.out.println(sp); System.out.println(max); } void large(int x, int y) { for(int ny=-2;ny<=2;ny++) { for(int nx=-( 2-abs(ny) );nx<=2-abs(ny);nx++) map[y+ny+2][x+nx+2]++; } } void medium(int x, int y) { for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) { map[y+j+2][x+i+2]++; } } void small(int x, int y) { map[y-1+2][x+2]++; map[y+2][x-1+2]++; map[y+1+2][x+2]++; map[y+2][x+1+2]++; } public static void main(String[] args) { new Main().run(); } }
Main.java:5: error: package java.String does not exist import static java.String.Math.*; ^ Main.java:21: error: cannot find symbol for(int i=0;i<3;i++) vals[i] = Integer.parseInt(ss[i]); ^ symbol: variable vals location: class Main Main.java:29: error: cannot find symbol if(map[y][x] != 0) max = max(max, map[y][x]); ^ symbol: method max(int,int) location: class Main Main.java:38: error: cannot find symbol for(int nx=-( 2-abs(ny) );nx<=2-abs(ny);nx++) ^ symbol: method abs(int) location: class Main Main.java:38: error: cannot find symbol for(int nx=-( 2-abs(ny) );nx<=2-abs(ny);nx++) ^ symbol: method abs(int) location: class Main 5 errors
s964743675
p00026
Java
package jimang_laurant.com; import java.util.Arrays; import java.util.Scanner; public class Main0026 { private static Scanner scan; public static void main(String[] args) { scan = new Scanner(System.in); scan.useDelimiter(",|\\s+"); int a[][] = new int[10][10]; for(int i = 0;i < 10;i++)Arrays.fill(a[i],0); while(scan.hasNext()){ int x = scan.nextInt(); int y = scan.nextInt(); int size = scan.nextInt(); if(size >= 1){ if(x - 1 >= 0)a[x-1][y]++; if(y - 1 >= 0)a[x][y-1]++; if(x + 1 >= 0)a[x+1][y]++; if(y + 1 >= 0)a[x][y+1]++; if(size >= 2){ if(x - 1 >= 0&&y - 1 >=0)a[x-1][y-1]++; if(x - 1 >= 0&&y + 1 <=9)a[x-1][y+1]++; if(x + 1 <= 9&&y - 1 >=0)a[x+1][y-1]++; if(x + 1 <= 9&&y + 1 <=9)a[x+1][y+1]++; if(size >= 3){ if(x - 2 >= 0)a[x-2][y]++; if(y - 2 >= 0)a[x][y-2]++; if(x + 2 <= 9)a[x+2][y]++; if(y + 2 <= 9)a[x][y+2]++; } } } } int n = 0,m = 0; for(int i = 0;i < 10;i++){ for(int j = 0;j < 10;j++){ if(a[i][j] == 0)n++; m = Math.max(a[i][j], m); } } System.out.println(n); System.out.println(m); System.exit(0); } }
Main.java:6: error: class Main0026 is public, should be declared in a file named Main0026.java public class Main0026 { ^ 1 error
s136103445
p00026
Java
import java.util.*; public class Main{ public static void main(String[] args){ new P0026DroppingInk().run(); } Scanner sc = new Scanner(System.in); int[][] map; int h = 10; int w = 10; int[] a = {1, 0, -1, 0, 1, -1, 1, -1, 2, 0, -2, 0}; int[] b = {0, 1, 0, -1, 1, 1, -1, -1, 0, 2, 0, -2}; int count; int max; void run(){ map = new int[h][w]; max = 0; count = h*w; while(sc.hasNext()){ String[] i = sc.next().split(","); int x = Integer.parseInt(i[0]); int y = Integer.parseInt(i[1]); int s = Integer.parseInt(i[2]); drop(x, y, s); } System.out.println(count+"\n"+max); } void drop(int x, int y, int s){ ink(x, y); for(int i=0; i<s*4; i++) ink(x+a[i], y+b[i]); } void ink(int x, int y){ if(x>=0 && y>=0 && x<10 && y<10){ map[x][y]++; if(max < map[x][y]) max = map[x][y]; if(map[x][y]==1) count--; } } }
Main.java:4: error: cannot find symbol new P0026DroppingInk().run(); ^ symbol: class P0026DroppingInk location: class Main 1 error
s839505139
p00026
C
/* / / 2014.08.26 / / */ //真っ白な紙にインクを垂らしインク絵汚れていない部分の数を出力し、汚れる回数が多いエリアを出力する。 //落とすインク液は少しならば1、中ぐらいなら2、多いならば3とする。 #include<stdio.h> void littleDrop(int,int,int *,int); void midiumDrop(int,int *,int,int); void largeDrop(int,int *,int); void showArray(int [][10]); void largeDrop(int center,int *tbl ,int round){ if(center >= 20)//二つ上に配列があるか確認 *(tbl - 20) += 1; if(round >= 2)//二つ左に配列があるか確認 *(tbl - 2) += 1; if(round <= 7)//二つ右に配列があるか確認 *(tbl + 2) += 1; if(center <= 80)//二つ下に配列がある確認 *(tbl + 20) += 1; } void midiumDrop(int center,int *tbl ,int size ,int round){ //真ん中と八方に+1// if(center > 10){ if(round != 0)//左、上に配列があるか確認 *(tbl - 11) += 1; if(round != 9)//右、上に配列があるか確認 *(tbl - 9) += 1; if(center < 90){ if(round != 0)//左、下に配列があるか確認 *(tbl + 9) += 1; if(round != 9)//右、下に配列があるか確認 *(tbl + 11) += 1; } if(size == 3) largeDrop(center,tbl,round); } void littleDrop(int x ,int y ,int *tbl,int size){ //インクを落とす場所は左上(0,0)から何番目かを求める。 int center = x + y * 10; int round = center % 10; //(0,0)から中央へと移動させる tbl = (tbl + center); //真ん中に+1 *(tbl) += 1; //上に+1 if(center >= 10)//上に配列があるか確認 *(tbl - 10) += 1; if(center <= 90)//下に配列があるか確認 *(tbl + 10) += 1; if(round != 0)//左に配列があるか確認 *(tbl - 1) += 1; if(round != 9)//右に配列があるか確認 *(tbl + 1) += 1; if(size >= 2) midiumDrop(center, tbl, size,round); } void showArray(int in[10][10]){ int i,j; for(i = 0 ; i < 10 ;i ++){ for(j = 0; j < 10; j ++){ printf("%d ",in[i][j]); } printf("\n"); } } int main(void){ int i,j,clear=0,max=0; int x,y,size; int tbl[10][10] = {0}; while(scanf("%d,%d,%d",&x ,&y ,&size) != EOF){ getchar();//改行をとることでバッファに\nがたまるのを防ぐ if(x >= 0 && y >= 0 && size >= 0 && size <= 3 && x <= 9 && y <= 9) littleDrop(x,y,*tbl,size); //showArray(tbl); } for(i = 0 ; i < 10 ;i ++){ for(j = 0; j < 10; j ++){ //printf("%d ",tbl[i][j]);//確認用 if(tbl[i][j] == 0) clear ++; else if(tbl[i][j] > max) max = tbl[i][j]; } //printf("\n"); } printf("%d\n",clear);//インクが落ちていない個所の合計 printf("%d\n",max);//一番多くインクが落ちた量 //getchar();//visual studio用 return 0; }
main.c: In function 'midiumDrop': main.c:102:1: error: expected declaration or statement at end of input 102 | } | ^
s060005791
p00026
C
#include <cstdio> using namespace std; int main() { int xy[10][10] = {'0'}; int x,y,size; xy[0][0] = 0; while(scanf("%d,%d,%d", &x,&y,&size) != EOF){ xy[y-1][x]++; xy[y][x-1]++; xy[y][x]++; xy[y][x+1]++; xy[y+1][x]++; if(size >= 2){ xy[y-1][x-1]++; xy[y-1][x+1]++; xy[y+1][x-1]++; xy[y+1][x+1]++; } if(size == 3){ xy[y-2][x]++; xy[y][x-2]++; xy[y][x+2]++; xy[y+2][x]++; } } int w=0,con = 0; for(int i=0; i < 10; i++){ for(int j=0; j < 10; j++){ if(xy[i][j] == 0)w++; if(con < xy[i][j])con = xy[i][j]; } } printf("%d\n%d\n", w, con); return (0); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s022476033
p00026
C
#include <stdio.h> #include <math.h> &#160; int p[10][10]; &#160; void drop(int x,int y){ &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; } &#160; int main(void){ &#160; &#160;&#160;&#160;&#160;int i,j,x,y,size; &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;switch(size){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case 3: &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x+2,y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x,y+2); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x-2,y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x,y-2); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case 2: &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x+1,y+1); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x+1,y-1); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x-1,y+1); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x-1,y-1); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case 1: &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x+1,y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x,y+1); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x-1,y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x,y-1); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;default: &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;drop(x,y); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;x=0;y=0; &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(p[i][j]==0)x++; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else if(p[i][j]>y)y=p[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;printf("%d\n%d\n",x,y); &#160;&#160;&#160;&#160;return 0; }
main.c:3:1: error: expected identifier or '(' before '&' token 3 | &#160; | ^ main.c:3:2: error: stray '#' in program 3 | &#160; | ^ main.c:5:1: error: expected identifier or '(' before '&' token 5 | &#160; | ^ main.c:5:2: error: stray '#' in program 5 | &#160; | ^ main.c: In function 'drop': main.c:7:2: error: stray '#' in program 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:1: error: lvalue required as unary '&' operand 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:8: error: stray '#' in program 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:7: error: lvalue required as unary '&' operand 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:14: error: stray '#' in program 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:13: error: lvalue required as unary '&' operand 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:20: error: stray '#' in program 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c:7:19: error: lvalue required as unary '&' operand 7 | &#160;&#160;&#160;&#160;if(-1<x && x<10 && -1<y && y<10)p[x][y]++; | ^ main.c: At top level: main.c:9:1: error: expected identifier or '(' before '&' token 9 | &#160; | ^ main.c:9:2: error: stray '#' in program 9 | &#160; | ^ main.c: In function 'main': main.c:11:2: error: stray '#' in program 11 | &#160; | ^ main.c:11:1: error: lvalue required as unary '&' operand 11 | &#160; | ^ main.c:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:1: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:7: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:13: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:12:19: error: lvalue required as unary '&' operand 12 | &#160;&#160;&#160;&#160;int i,j,x,y,size; | ^ main.c:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:1: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:7: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:13: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:13:19: error: lvalue required as unary '&' operand 13 | &#160;&#160;&#160;&#160;for(i=0;i<10;i++){ | ^ main.c:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:1: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:7: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:13: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:19: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:26: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:25: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:32: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:31: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:38: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:37: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:44: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:14:43: error: lvalue required as unary '&' operand 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(j=0;j<10;j++){ | ^ main.c:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:1: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:7: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:13: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:19: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:26: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:25: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:32: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:31: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:38: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:37: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:44: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:43: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:50: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:49: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:56: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:55: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:62: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:15:61: error: lvalue required as unary '&' operand 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;p[i][j]=0; | ^ main.c:
s243297173
p00026
C
#include <stdio.h> int main(void) { int a[10][10]; int i, j, x, y; int size; int max = 0, cnt = 0; for(i = 0; i < 10; i++) { for(j = 0; j < 10; j++) { a[i][j] = 0; } } while(scanf(fp, "%d,%d,%d", &x, &y, &size) && size != 0 ) { switch(size) { case 3: if(x >= 2) a[x - 2][y]++; if(y >= 2) a[x][y - 2]++; if(x <= 7) a[x + 2][y]++; if(y <= 7) a[x][y + 2]++; case 2: if((x >= 1) && (y >= 1)) a[x - 1][y - 1]++; if((x >= 1) && (y <= 8)) a[x - 1][y + 1]++; if((x <= 8) && (y >= 1)) a[x + 1][y - 1]++; if((x <= 8) && (y <= 8)) a[x + 1][y + 1]++; case 1: if(x >= 1) a[x - 1][y]++; if(y >= 1) a[x][y - 1]++; if(x <= 8) a[x + 1][y]++; if(y <= 8) a[x][y + 1]++; a[x][y]++; } } for(i = 0; i < 10; i++) { for(j = 0; j < 10; j++) { if(a[i][j] == 0) { cnt++; } else { if(a[i][j] > max) max = a[i][j]; } } } printf("%d\n", cnt); printf("%d\n", max); return 0; }
main.c: In function 'main': main.c:16:21: error: 'fp' undeclared (first use in this function) 16 | while(scanf(fp, "%d,%d,%d", &x, &y, &size) && size != 0 ) { | ^~ main.c:16:21: note: each undeclared identifier is reported only once for each function it appears in
s132011593
p00026
C
#include <stdio.h> void paint(int b[][], int x, int y, int a); int main(void) { int squares[10][10] = {0}; int i, j; int x, y, size; while( scanf("%d %d %d", &x, &y, &size) != EOF) { switch( size) { case 1: squares[y][x]++; paint( squares, x, y, 1); break; case 3: paint( squares, x, y, 2); case 2: for( i = x-1; i <= x+1; i++) for( j = y-1; j <= y+1; j++) if( (i >= 0 && i < 10) && (j >= 0 && j < 10)) squares[j][i]++; break; } } return 0; } void paint(int b[][], int x, int y, int a) { if( y - a >= 0) b[y-a][x]++; if( y + a < 10) b[y+a][y]++; if( x - a >= 0) b[y][x-a]++; if( x + a < 10) b[y][x+a]++; }
main.c:3:16: error: array type has incomplete element type 'int[]' 3 | void paint(int b[][], int x, int y, int a); | ^ main.c:3:16: note: declaration of 'b' as multidimensional array must have bounds for all dimensions except the first main.c: In function 'main': main.c:13:40: error: type of formal parameter 1 is incomplete 13 | paint( squares, x, y, 1); | ^~~~~~~ main.c:16:40: error: type of formal parameter 1 is incomplete 16 | paint( squares, x, y, 2); | ^~~~~~~ main.c: At top level: main.c:29:16: error: array type has incomplete element type 'int[]' 29 | void paint(int b[][], int x, int y, int a) { | ^ main.c:29:16: note: declaration of 'b' as multidimensional array must have bounds for all dimensions except the first
s700146350
p00026
C
#include <stdio.h> int main(void) { int i,j,x,y,s,max; int board[14][14]={0}; int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; while(scanf("%d",&x)!=EOF){ scanf("%d%d",&y,&s); for(i=0;s==1?i<5:s==2?i<9:i<13;i++){ board[x+sibuki_x[i][s]][y+sibuki_y[i][s]]++; } } for(i=0,count=0,max=0;i<10;i++){ for(j=0;j<10;j++){ if(max<board[i][j])max=board[i][j]; if(board[i][j]==0)count++; } } printf("%d\n%d\n",count,max); return 0; }
main.c: In function 'main': main.c:6:37: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:37: note: (near initialization for 'sibuki_x[0]') main.c:6:40: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:40: note: (near initialization for 'sibuki_x[0]') main.c:6:50: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:50: note: (near initialization for 'sibuki_x[1]') main.c:6:52: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:52: note: (near initialization for 'sibuki_x[1]') main.c:6:54: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:54: note: (near initialization for 'sibuki_x[1]') main.c:6:57: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:57: note: (near initialization for 'sibuki_x[1]') main.c:6:60: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:60: note: (near initialization for 'sibuki_x[1]') main.c:6:63: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:63: note: (near initialization for 'sibuki_x[1]') main.c:6:73: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:73: note: (near initialization for 'sibuki_x[2]') main.c:6:75: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:75: note: (near initialization for 'sibuki_x[2]') main.c:6:77: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:77: note: (near initialization for 'sibuki_x[2]') main.c:6:80: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:80: note: (near initialization for 'sibuki_x[2]') main.c:6:83: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:83: note: (near initialization for 'sibuki_x[2]') main.c:6:86: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:86: note: (near initialization for 'sibuki_x[2]') main.c:6:88: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:88: note: (near initialization for 'sibuki_x[2]') main.c:6:90: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:90: note: (near initialization for 'sibuki_x[2]') main.c:6:92: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:92: note: (near initialization for 'sibuki_x[2]') main.c:6:94: warning: excess elements in array initializer 6 | int sibuki_x[13][3]={{0,1,0,-1,0},{0,1,1,1,0,-1,-1,-1,0},{0,1,1,1,0,-1,-1,-1,0,0,2,0,-2}}; | ^ main.c:6:94: note: (near initialization for 'sibuki_x[2]') main.c:7:38: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:38: note: (near initialization for 'sibuki_y[0]') main.c:7:40: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:40: note: (near initialization for 'sibuki_y[0]') main.c:7:52: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:52: note: (near initialization for 'sibuki_y[1]') main.c:7:54: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:54: note: (near initialization for 'sibuki_y[1]') main.c:7:56: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:56: note: (near initialization for 'sibuki_y[1]') main.c:7:58: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:58: note: (near initialization for 'sibuki_y[1]') main.c:7:60: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:60: note: (near initialization for 'sibuki_y[1]') main.c:7:63: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:63: note: (near initialization for 'sibuki_y[1]') main.c:7:75: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:75: note: (near initialization for 'sibuki_y[2]') main.c:7:77: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:77: note: (near initialization for 'sibuki_y[2]') main.c:7:79: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:79: note: (near initialization for 'sibuki_y[2]') main.c:7:81: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:81: note: (near initialization for 'sibuki_y[2]') main.c:7:83: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:83: note: (near initialization for 'sibuki_y[2]') main.c:7:86: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:86: note: (near initialization for 'sibuki_y[2]') main.c:7:88: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; | ^ main.c:7:88: note: (near initialization for 'sibuki_y[2]') main.c:7:90: warning: excess elements in array initializer 7 | int sibuki_y[13][3]={{-1,0,1,0,0},{-1,-1,0,1,1,1,0,-1,0},{-1,-1,0,1,1,1,0,-1,0,2,0,-2,0}}; |
s990414975
p00026
C
#include <stdio.h> void color(int map[10][10], int x, int y) { if (0 <= x && x <= 9 && 0 <= y && y <= 9){ map[y][x]++; } } int main(void) { int map[10][10] = {0}; int x, y, size; int i, j; int white = 0, darkest = 0; while (scanf("%d,%d,%d", &x, &y, &size) != EOF){ map[y][x]++; if (size == 3){ color(map, x + 2, y); color(map, x - 2, y); color(map, x, y + 2); color(map, x, y - 2); } if (size >= 2){ color(map, x + 1, y + 1); color(map, x - 1, y + 1); color(map, x + 1, y - 1); color(map, x - 1, y - 1); } if (size >= 1){ color(map, x, y + 1); color(map, x, y - 1); color(map, x + 1, y); color(map, x - 1, y); } } for (i = 0; i < 10; i++){ for (j = 0; j < 10; j++){ if (map[i][j] == 0){ white++; } if (mostdark < map[i][j]){ mostdark = map[i][j]; } } } printf("%d\n%d\n", white, darkest); return (0); }
main.c: In function 'main': main.c:44:11: error: 'mostdark' undeclared (first use in this function) 44 | if (mostdark < map[i][j]){ | ^~~~~~~~ main.c:44:11: note: each undeclared identifier is reported only once for each function it appears in
s281502727
p00026
C
#include <stdio.h> void color(int map[10][10], int x, int y) { if (0 <= x && x <= 9 && 0 <= y && y <= 9){ map[y][x]++; } } int main(void) { int map[10][10] = {0}; int x, y, size; int i, j; int white = 0, darkest = 0; while (scanf("%d,%d,%d", &x, &y, &size) != EOF){ map[y][x]++; if (size == 3){ color(map, x + 2, y); color(map, x - 2, y); color(map, x, y + 2); color(map, x, y - 2); } if (size >= 2){ color(map, x + 1, y + 1); color(map, x - 1, y + 1); color(map, x + 1, y - 1); color(map, x - 1, y - 1); } if (size >= 1){ color(map, x, y + 1); color(map, x, y - 1); color(map, x + 1, y); color(map, x - 1, y); } } for (i = 0; i < 10; i++){ for (j = 0; j < 10; j++){ if (map[i][j] == 0){ white++; } if (mostdark < map[i][j]){ darkest = map[i][j]; } } } printf("%d\n%d\n", white, darkest); return (0); }
main.c: In function 'main': main.c:44:11: error: 'mostdark' undeclared (first use in this function) 44 | if (mostdark < map[i][j]){ | ^~~~~~~~ main.c:44:11: note: each undeclared identifier is reported only once for each function it appears in
s144533212
p00026
C
#include <stdio.h> int main(void) { int size; int x, y; int white, black; int i, j; int seat[10][10] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } while (1){ scanf("%d %d %d", &x, &y, &size); switch (size){ case 1: seat[y][x]++; seat[y][x - 1]++; seat[y][x + 1]++; seat[y - 1][x]++; seat[y + 1][x]++; break; case 2: seat[y][x]++; seat[y][x - 1]++; seat[y][x + 1]++; seat[y - 1][x]++; seat[y + 1][x]++; seat[y - 1][x - 1]++; seat[y - 1][x + 1]++; seat[y + 1][x - 1]++; seat[y + 1][x + 1]++; break; case 3: seat[y][x]++; seat[y][x - 1]++; seat[y][x + 1]++; seat[y - 1][x]++; seat[y + 1][x]++; seat[y - 1][x - 1]++; seat[y - 1][x + 1]++; seat[y + 1][x - 1]++; seat[y + 1][x + 1]++; seat[y - 2][x]++; seat[y + 2][x]++; seat[y][x - 2]++; seat[y][x + 2]++; break; } for (i = 0; i < 10; i++){ for (j = 0; j < 10; j++){ if (seat[i][j] == 0){ white++; } if (seat[i][j] > black){ black = seat[i][j]; } } } printf("%d\n", white); printf("%d\n", black); } return (0); }
main.c: In function 'main': main.c:22:9: error: expected ',' or ';' before 'while' 22 | while (1){ | ^~~~~
s778406314
p00026
C
#include<stdio.h> void small(int a[][10],int x,int y); void mid(int a[][10],int x,int y); void large(int a[][10],int x,int y); int main(void){ int paper[10][10]; int x,y,q,i,j,count; int max=0; for(j=0;j<10;j++){ for(i=0;i<10;i++){ paper[i][j]=0; } } while(scanf("%d,%d,%d",&x,&y,&q)!=EOF){ if(q==1){ small(paper,x,y); }else if(q==2){ mid(paper,x,y); }else{ large(paper,x,y); } } for(j=0;j<10;j++){ for(i=0;i<10;i++){ if(paper[j][i]==0){ count++; } if(map[y][x]>max){ max=paper[y][x]; } } } printf("%d\n",count); return 0; } void small(int a[][10],int x,int y){ a[x][y]++; if(y>0){ a[x][y-1]++; } if(y<9){ a[x][y+1]++; } if(x<9){ a[x+1][y]++; } if(x>0){ a[x-1][y]++; } return; } void mid(int a[][10],int x,int y){ a[y][x]++; if(x>0){ a[y][x-1]++; if(x>0&&y>0){ a[y-1][x-1]++; } if(x>0&&y<9){ a[y+1][x-1]++; } } if(x<9){ a[y][x+1]++; if(x<9&&y>0){ a[y-1][x+1]++; } if(x<9&&y<9){ a[y+1][x+1]++; } } if(y<9){ a[y+1][x]++; } if(y>0){ a[y-1][x]++; } return; } void large(int a[][10],int x,int y){ a[y][x]++; if(x>0){ a[y][x-1]++; if(x>0&&y>0){ a[y-1][x-1]++; } if(x>0&&y<9){ a[y+1][x-1]++; } if(x>1){ a[y][x-2]++; } } if(x<9){ a[y][x+1]++; if(x<9&&y>0){ a[y-1][x+1]++; } if(x<9&&y<9){ a[y+1][x+1]++; } if(x<8){ a[y][x+2]++; } } if(y<9){ a[y+1][x]++; if(x<8){ a[y+2][x]++; } } if(y>0){ a[y-1][x]++; if(y>1){ a[y-2][x]++; } } return; }
main.c: In function 'main': main.c:33:10: error: 'map' undeclared (first use in this function); did you mean 'max'? 33 | if(map[y][x]>max){ | ^~~ | max main.c:33:10: note: each undeclared identifier is reported only once for each function it appears in
s571347496
p00026
C
#include<stdio.h> int main(void){ int paper[10][10]; int x,y,q,i,j,count,a; int px,py; int max=0; int xplus[] = {0,0,-1,1,-1,-1,1,1,0,0,-2,2}; int yplus[] = {-1,1,0,0,-1,1,-1,1,-2,2,0,0}; for(j=0;j<10;j++){ for(i=0;i<10;i++){ paper[i][j]=0; } } for( scanf("%d,%d,%d",&x,&y,&q)!=EOF){ paper[y][x]++; for(i=0;i<q*4;i++){ px=x+xplus[i]; py=y+yplus[i]; if(px>=0&&px<10&&py>=0&&py<10){ paper[py][px]++; } } } for(j=0;j<10;j++){ for(i=0;i<10;i++){ if(paper[j][i]==0){ count++; } if(paper[j][i]>max){ max=paper[j][i]; } } } printf("%d\n",count); printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:18:39: error: expected ';' before ')' token 18 | for( scanf("%d,%d,%d",&x,&y,&q)!=EOF){ | ^ main.c:18:39: error: expected expression before ')' token
s361878313
p00026
C
#include<stdio.h> int main(void){ int paper[10][10]; int x,y,q,i,j,count,a; int px,py; int max=0; int xplus[] = {0,0,-1,1,-1,-1,1,1,0,0,-2,2}; int yplus[] = {-1,1,0,0,-1,1,-1,1,-2,2,0,0}; for(j=0;j<10;j++){ for(i=0;i<10;i++){ paper[i][j]=0; } } for( scanf("%d,%d,%d",&x,&y,&q)!=EOF){ paper[y][x]++; for(i=0;i<q*4;i++){ px=x+xplus[i]; py=y+yplus[i]; if(px>=0&&px<10&&py>=0&&py<10){ paper[py][px]++; } } } for(j=0;j<10;j++){ for(i=0;i<10;i++){ if(paper[j][i]==0){ count++; } if(paper[j][i]>max){ max=paper[j][i]; } } } printf("%d\n",count); printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:18:39: error: expected ';' before ')' token 18 | for( scanf("%d,%d,%d",&x,&y,&q)!=EOF){ | ^ main.c:18:39: error: expected expression before ')' token
s318498494
p00026
C
#include <stdio.h> #define rep(i,j,k) for(i = j;i <= k;i++) int paper[14][14]; rep(i,0,13){ rep(j,0,13){ paper[i][j] = 0; } } void Ink(int,int,int); int main(){ int x,y,size,i,j,count,depth; while(scanf("%d,%d,%d",&x,&y,&size) != EOF){ Ink(x+2,y+2,size); } count = 0; depth = 0; rep(i,2,11){ rep(j,2,11){ if(paper[i][j] == 0) count++; if(depth < paper[i][j]) depth = paper[i][j]; } } printf("%d\n%d\n",count,depth); return 0; } void Ink(int x,int y,int size){ if(size == 1){ paper[x+1][y]++;paper[x-1][y]++;paper[x][y+1]++;paper[x][y-1]++; } if(size == 2){ paper[x+1][y]++;paper[x-1][y]++;paper[x][y+1]++;paper[x][y-1]++; paper[x+1][y+1]++;paper[x-1][y-1]++;paper[x-1][y+1]++;paper[x+1][y-1]++; } if(size == 3){ paper[x+1][y]++;paper[x-1][y]++;paper[x][y+1]++;paper[x][y-1]++; paper[x+1][y+1]++;paper[x-1][y-1]++;paper[x-1][y+1]++;paper[x+1][y-1]++; paper[x][y+2]++;paper[x][y-2]++;paper[x+2][y]++;paper[x-2][y]++; } }
main.c:2:20: error: expected identifier or '(' before 'for' 2 | #define rep(i,j,k) for(i = j;i <= k;i++) | ^~~ main.c:5:3: note: in expansion of macro 'rep' 5 | rep(i,0,13){ | ^~~ main.c:2:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token 2 | #define rep(i,j,k) for(i = j;i <= k;i++) | ^~ main.c:5:3: note: in expansion of macro 'rep' 5 | rep(i,0,13){ | ^~~ main.c:2:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 2 | #define rep(i,j,k) for(i = j;i <= k;i++) | ^~ main.c:5:3: note: in expansion of macro 'rep' 5 | rep(i,0,13){ | ^~~
s939997337
p00026
C
#include <stdio.h> #define rep(i,j,k) for(i = j;i <= k;i++) int i,j; int paper[14][14]; rep(i,0,13){ rep(j,0,13){ paper[i][j] = 0; } } void Ink(int,int,int); int main(){ int x,y,size,i,j,count,depth; while(scanf("%d,%d,%d",&x,&y,&size) != EOF){ Ink(x+2,y+2,size); } count = 0; depth = 0; rep(i,2,11){ rep(j,2,11){ if(paper[i][j] == 0) count++; if(depth < paper[i][j]) depth = paper[i][j]; } } printf("%d\n%d\n",count,depth); return 0; } void Ink(int x,int y,int size){ if(size == 1){ paper[x+1][y]++;paper[x-1][y]++;paper[x][y+1]++;paper[x][y-1]++; } if(size == 2){ paper[x+1][y]++;paper[x-1][y]++;paper[x][y+1]++;paper[x][y-1]++; paper[x+1][y+1]++;paper[x-1][y-1]++;paper[x-1][y+1]++;paper[x+1][y-1]++; } if(size == 3){ paper[x+1][y]++;paper[x-1][y]++;paper[x][y+1]++;paper[x][y-1]++; paper[x+1][y+1]++;paper[x-1][y-1]++;paper[x-1][y+1]++;paper[x+1][y-1]++; paper[x][y+2]++;paper[x][y-2]++;paper[x+2][y]++;paper[x-2][y]++; } }
main.c:2:20: error: expected identifier or '(' before 'for' 2 | #define rep(i,j,k) for(i = j;i <= k;i++) | ^~~ main.c:5:3: note: in expansion of macro 'rep' 5 | rep(i,0,13){ | ^~~ main.c:2:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token 2 | #define rep(i,j,k) for(i = j;i <= k;i++) | ^~ main.c:5:3: note: in expansion of macro 'rep' 5 | rep(i,0,13){ | ^~~ main.c:2:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 2 | #define rep(i,j,k) for(i = j;i <= k;i++) | ^~ main.c:5:3: note: in expansion of macro 'rep' 5 | rep(i,0,13){ | ^~~
s511754159
p00026
C
#include <stdio.h> /** Problem 0026 : Dropping Ink **/ int board[10][10]; void init(void) { int i, j; for (i=0; i<10; i++) { for (j=0; j<10; j++) { board[i][j] = 0; } } } int main(void) { int i, j, ii, jj, size; init(); while (scanf("%d,%d,%d", &i, &j, &size) != EOF) { switch (size) { case 1: board[i][j] += 1; if (i-1 >= 0) board[i-1][j] += 1; if (i+1 < 10) board[i+1][j] += 1; if (j-1 >= 0) board[i][j-1] += 1; if (j+1 < 10) board[i][j+1] += 1; break; case 3: if (i-2 >= 0) board[i-2][j] += 1; if (i+2 < 10) board[i+2][j] += 1; if (j-2 >= 0) board[i][j-2] += 1; if (j+2 < 10) board[i][j+2] += 1; case 2: for (ii=i-1; ii<=i+1; ii++) { for (jj=j-1; jj<=j+1; jj++) { if (ii => 0 && ii < 10 && jj => 0 && jj < 10) board[ii][jj] += 1; } } } } int zero = 0, max = 0; for (i=0; i<10; i++) { for (j=0; j<10; j++) { if (board[i][j] == 0) zero += 1; else if (max < board[i][j]) max = board[i][j]; } } printf("%d\n%d\n", zero, max); return 0; }
main.c: In function 'main': main.c:40:57: error: expected expression before '>' token 40 | if (ii => 0 && ii < 10 && jj => 0 && jj < 10) board[ii][jj] += 1; | ^
s347725959
p00026
C
#define a(x,y) a[x][y]++ a[99][99],x,y,z,i; main() { for(;~scanf("%d,%d,%d",&x,&y,&z);) { x+=10;y+=10; a(x,y); a(x-1,y); a(x,y-1); a(x+1,y); a(x,y+1); if(z>1) a(x+1,y+1),a(x+1,y-1),a(x-1,y+1),a(x-1,y-1); if(z>2) a(x-2,y),a(x+2,y),a(x,y-2),a(x,y+2); } for(z=0,x=9;x++<20;) for(y=9;y++<20;) { a[x][y]&&z++; a[x][y]>i&&i=a[x][y]; } printf("%d\n%d\n",z,i); exit(0); }
main.c:2:1: warning: data definition has no type or storage class 2 | a[99][99],x,y,z,i; | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:2:11: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int] 2 | a[99][99],x,y,z,i; | ^ main.c:2:13: error: type defaults to 'int' in declaration of 'y' [-Wimplicit-int] 2 | a[99][99],x,y,z,i; | ^ main.c:2:15: error: type defaults to 'int' in declaration of 'z' [-Wimplicit-int] 2 | a[99][99],x,y,z,i; | ^ main.c:2:17: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 2 | a[99][99],x,y,z,i; | ^ main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main() | ^~~~ main.c: In function 'main': main.c:5:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 5 | for(;~scanf("%d,%d,%d",&x,&y,&z);) | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define a(x,y) a[x][y]++ main.c:5:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 5 | for(;~scanf("%d,%d,%d",&x,&y,&z);) | ^~~~~ main.c:5:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:23:21: error: lvalue required as left operand of assignment 23 | a[x][y]>i&&i=a[x][y]; | ^ main.c:25:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 25 | printf("%d\n%d\n",z,i); | ^~~~~~ main.c:25:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:25:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:25:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:26:3: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 26 | exit(0); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | #define a(x,y) a[x][y]++ main.c:26:3: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 26 | exit(0); | ^~~~ main.c:26:3: note: include '<stdlib.h>' or provide a declaration of 'exit'
s247777525
p00026
C
#include<stdio.h> void main(){ printf("77\n5\n); }
main.c: In function 'main': main.c:4:8: warning: missing terminating " character 4 | printf("77\n5\n); | ^ main.c:4:8: error: missing terminating " character 4 | printf("77\n5\n); | ^~~~~~~~~~ main.c:5:1: error: expected expression before '}' token 5 | } | ^ main.c:4:8: error: expected ';' before '}' token 4 | printf("77\n5\n); | ^ | ; 5 | } | ~