submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s830162022
p00009
C++
#include<stdio.h> #include<math.h> int gurobal[1000001]={0}; int main(void) { int n=0; int i=0,j=0; int heihoukon=0; int count=0; while(scanf("%d",&n)!=EOF) { count=0; gurobal[1]=0; for (i=2;i<=n;i++) { gurobal[i]=1; } (int)heihoukon=sqrt((double)n); for (i=2;i<=heihoukon;i++) { if (gurobal[i]!=0) { for (j=i*2;j<=n;j+=i) { gurobal[j]=0; } } } for (i=2;i<=n;i++) { if (gurobal[i]!=0) { count++; } } printf("%d\n",count); } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: lvalue required as left operand of assignment 18 | (int)heihoukon=sqrt((double)n); | ^~~~~~~~~~~~~~
s967665288
p00009
C++
#include<stdio.h> #include<math.h> int gurobal[1000001]={0}; int main(void) { int n=0; int i=0,j=0; int heihoukon=0; int count=0; while(scanf("%d",&n)!=EOF) { count=0; gurobal[1]=0; for (i=2;i<=n;i++) { gurobal[i]=1; } (int)heihoukon=sqrt((double)n); for (i=2;i<=heihoukon;i++) { if (gurobal[i]!=0) { for (j=i*2;j<=n;j+=i) { gurobal[j]=0; } } } for (i=2;i<=n;i++) { if (gurobal[i]!=0) { count++; } } printf("%d\n",count); } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: lvalue required as left operand of assignment 18 | (int)heihoukon=sqrt((double)n); | ^~~~~~~~~~~~~~
s692520195
p00009
C++
#include<stdio.h> #include<math.h> int gurobal[100000001]={0}; int main(void) { int n=0; int i=0,j=0; int heihoukon=0; int count=0; while(scanf("%d",&n)!=EOF) { count=0; gurobal[1]=0; for (i=2;i<=n;i++) { gurobal[i]=1; } (int)heihoukon=sqrt((double)n); for (i=2;i<=heihoukon;i++) { if (gurobal[i]!=0) { for (j=i*2;j<=n;j+=i) { gurobal[j]=0; } } } for (i=2;i<=n;i++) { if (gurobal[i]!=0) { count++; } } printf("%d\n",count); } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: lvalue required as left operand of assignment 18 | (int)heihoukon=sqrt((double)n); | ^~~~~~~~~~~~~~
s963614887
p00009
C++
package util; import java.util.Scanner; public class Main{ boolean isPrime[]; void run(){ isPrime = new boolean[1000000]; for(int i=0;i<1000000;i++) isPrime[i] = true; isPrime[0] = false; isPrime[1] = false; for(int i=2;i<=1000000;i++){ if(!isPrime[i]) continue; for(int j=i+i;j<=1000000;j+=i){ isPrime[j] = false; } } Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); int count = 0; for(int i=0;i<=n;i++){ if(isPrime[i]) count++; } System.out.println(count); } } public static void main(String[] args){ new Main().run(); } }
a.cc:1:1: error: 'package' does not name a type 1 | package util; | ^~~~~~~ a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main{ | ^~~~~~
s233107041
p00009
C++
#include <iostream> using namespace std; void solve(int n); int main() { int n; while (cin >> n) { if (n<=1) cout << 0 << endl; solve(n); } return 0; } void solve(int n) { int prime[n]; int i=0;j=0; for (i=2; i<=n; i++) { prime[j] = i; j++; } int p; for (i=0; i<n; i++) { p = prime[i]; if (p == -1) continue; for (int k=i+1; k<n; k++) { if (prime[k]%p == 0) prime[k] = -1; } } int count = 0; for (int i=0; i<n; i++) if (prime[i] != -1) count++; cout << count << endl; }
a.cc: In function 'void solve(int)': a.cc:15:17: error: 'j' was not declared in this scope 15 | int i=0;j=0; | ^
s511885932
p00009
C++
#include<iostream> int a,n[40],c[40]; int main (){ for(int i=2;i<31;i++){ n[i]=1; for(int j=2;j<i;j++){ if(i%j==0){ n[i]=0; j=i; } } } for(int i=1;i<31;i++){ c[i]=c[i-1]+n[i]; } while(scanf("%d"a)^){ printf("%d",c[a]); } }
a.cc: In function 'int main()': a.cc:18:21: error: unable to find string literal operator 'operator""a' with 'const char [3]', 'long unsigned int' arguments 18 | while(scanf("%d"a)^){ | ^~~~~ a.cc:18:28: error: expected primary-expression before ')' token 18 | while(scanf("%d"a)^){ | ^
s176758368
p00009
C++
#include<iostream> #include<vector> #define LIM 1000000 using namespace std; void prime(); vector<int> prime_map; int main(){ int num, i=0,j=0; vector<int> count; prime(); cout<<"plese"<<endl; while(cin){ cin>>num; i=0; while(prime_map[i]<=num){ i=i+1; } count.push_back(i); j++; } i=0; while(i<j){ cout<< count[i]<<endl; i++; } } void prime(){ bool judge; for(int i = 2; i <= LIM;i++){ judge=1; for(int j= 2; j < i/2; j++){ if(i%j == 0)judge = 0 break; } if(judge == 1)prime_map.push_back(i); } }
a.cc: In function 'void prime()': a.cc:38:28: error: expected ';' before 'break' 38 | if(i%j == 0)judge = 0 break; | ^~~~~~ | ;
s849866048
p00009
C++
#include<iostream> #define LIM 1000000 using namespace std; int main(){ bool num_map[LIM]; int in_num,prime_count; for(int i=0;i<LIM;i++){ num_map[i]=1; } for(int i=2;i<LIM;i++){ if(num_map[i]==1) for(int j=i*2;j<LIM;j+=i){ num_map[j]=cout<<in_num<<endl<<endl; for(int i=2;i<=in_num;i++){ if(num_map[i]==1) prime_count++; } cout<<prime_count<<endl; } }
a.cc: In function 'int main()': a.cc:16:38: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'bool' in assignment 16 | num_map[j]=cout<<in_num<<endl<<endl; | ~~~~~~~~~~~~~~~~~~^~~~~~ | | | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} In file included 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/basic_ios.h:121:16: note: explicit conversion function was not considered 121 | explicit operator bool() const | ^~~~~~~~ a.cc:24:2: error: expected '}' at end of input 24 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s012423112
p00009
C++
#include <iostream> #include <algorithm> using namespace std; vector<int> prime; void init(){ for(int i=2;i<999999;i++){ bool isprime=true; for(vector::iterator p(prime.begin());p!=prime.end();p++){ if(i%*p==0){ isprime=false; break; } } if(isprime){ prime.push_back(i); } } } int main(){ int n; init(); while(cin>>n){ cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl; } return 0; }
a.cc:4:1: error: 'vector' does not name a type 4 | vector<int> prime; | ^~~~~~ a.cc: In function 'void init()': a.cc:8:21: error: 'vector' has not been declared 8 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^~~~~~ a.cc:8:55: error: 'p' was not declared in this scope 8 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^ a.cc:8:58: error: 'prime' was not declared in this scope; did you mean 'isprime'? 8 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^~~~~ | isprime a.cc:15:25: error: 'prime' was not declared in this scope; did you mean 'isprime'? 15 | prime.push_back(i); | ^~~~~ | isprime a.cc: In function 'int main()': a.cc:23:35: error: 'prime' was not declared in this scope 23 | cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl; | ^~~~~
s461682773
p00009
C++
#include <vector> #include <iostream> #include <algorithm> using namespace std; vector<int> prime; void init(){ for(int i=2;i<999999;i++){ bool isprime=true; for(vector::iterator p(prime.begin());p!=prime.end();p++){ if(i%*p==0){ isprime=false; break; } } if(isprime){ prime.push_back(i); } } } int main(){ int n; init(); while(cin>>n){ cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl; } return 0; }
a.cc: In function 'void init()': a.cc:9:38: error: qualified-id in declaration before 'p' 9 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^ a.cc:9:37: error: expected ';' before 'p' 9 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^~ | ; a.cc:9:38: error: 'p' was not declared in this scope 9 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^ a.cc:9:69: error: expected ')' before ';' token 9 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ~ ^ | ) a.cc:9:70: error: 'p' was not declared in this scope 9 | for(vector::iterator p(prime.begin());p!=prime.end();p++){ | ^
s022497586
p00009
C++
#include <vector> #include <iostream> #include <algorithm> using namespace std; vector<int> prime; void init(){ for(int i=2;i<999999;i++){ bool isprime=true; for(vector<int>::iterator p(prime.begin());p!=prime.end();p++){ if(p*p>i)break; if(i%*p==0){ isprime=false; break; } } if(isprime){ prime.push_back(i); } } } int main(){ int n; init(); while(cin>>n){ cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl; } return 0; }
a.cc: In function 'void init()': a.cc:10:29: error: no match for 'operator*' (operand types are 'std::vector<int>::iterator' and 'std::vector<int>::iterator') 10 | if(p*p>i)break; | ~^~ | | | | | __normal_iterator<[...],[...]> | __normal_iterator<[...],[...]> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/vector:62, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:1090:7: note: candidate: '__gnu_cxx::__normal_iterator<_Iterator, _Container>::reference __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*() const [with _Iterator = int*; _Container = std::vector<int>; reference = int&]' 1090 | operator*() const _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1090:7: note: candidate expects 0 arguments, 1 provided
s385491361
p00009
C++
def generate (n) $P = Array.new(n, false) i = 3 until i > n $P[i] = true i += 2 end i = 3 $P[2] = true until i > n if ! $P[i] i += 2 next end j = i + i until j > n do $P[j] = false j += i end i += 2 end end def is_prime (n) return $P[n] ? 1 : 0 end def solve (n) return ->() { res = 0 (n+1).times {|v| res += is_prime(v) } res }.call end generate 1000000 while s = gets do n = s.to_i p solve n end
a.cc:2:1: error: 'def' does not name a type 2 | def generate (n) | ^~~ a.cc:34:6: error: expected unqualified-id before '.' token 34 | }.call | ^
s882835718
p00009
C++
#include <iostream> using namespace std; #define thefor(i,end) for (i=0;i<end;i++) bool isprime(int n) { if(n==1)return false; if(n==2)return true; for (int i=3;i<n;i++) { if (n%i==0)return false; } if (i==n) return true; else return false; } int main() { bool prime[1000010]; memset(prime,1,1000010); prime[0]=prime[1]=0; int i,j,n,sum; for (i=2;i<1000000;i++) { if (prime[i]) { for (j=2;i*j<1000000;j++) { prime[i*j]=false; } } } while(cin>>n) { sum=0; for(i=2;i<=n;i++) { sum+=prime[i]; } cout<<sum<<endl; } return 0; }
a.cc: In function 'bool isprime(int)': a.cc:12:13: error: 'i' was not declared in this scope 12 | if (i==n) | ^ a.cc: In function 'int main()': a.cc:20:9: error: 'memset' was not declared in this scope 20 | memset(prime,1,1000010); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std; a.cc: In function 'bool isprime(int)': a.cc:16:1: warning: control reaches end of non-void function [-Wreturn-type] 16 | } | ^
s497746703
p00009
C++
#include <iostream> using namespace std; int main() { bool prime[1000010]; memset(prime,1,1000010); prime[0]=prime[1]=0; int i,j,n,sum; for (i=2;i<1000000;i++) { if (prime[i]) { for (j=2;i*j<1000000;j++) { prime[i*j]=false; } } } while(cin>>n) { sum=0; for(i=2;i<=n;i++) { sum+=prime[i]; } cout<<sum<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'memset' was not declared in this scope 6 | memset(prime,1,1000010); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s231777588
p00009
C++
#include<iostream> using namespace std; main(){ while(cin>>n){ cout<<n<<endl; } }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:4:20: error: 'n' was not declared in this scope 4 | while(cin>>n){ | ^
s089248703
p00009
C++
#include <iostream> int main() { bool *table = new bool[1000000]; while (true) { int n; std::cin >> n; if (std::cin.eof()) break; memset(table, 1, sizeof(bool) * (n + 1)); for (int i = 2; i * i <= n; ++i) for (int j = 2; i * j <= n; ++j) table[i * j] = false; int cnt = 0; for (int i = 2; i <= n; ++i) cnt += table[i]; std::cout << cnt << std::endl; } delete[] table; }
a.cc: In function 'int main()': a.cc:11:9: error: 'memset' was not declared in this scope 11 | memset(table, 1, sizeof(bool) * (n + 1)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 |
s404329477
p00009
C++
#include<iostream> #include<math.h> using namespace std; int main(){ int n,i,j,buf,cnt; bool flag; while(cin >> n){ if(n == 1){ cout << "0" << endl; continue; } cnt = 1; for(i=3;i<=n;i+=2){ flag = false; buf = (int)sqrt((double)i); for(j=3;j<=buf;j+=2){ if((i % j) == 0){ flag = true; break; } } if(flag == false;){ cnt++; } } cout << cnt << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:42: error: expected primary-expression before ')' token 29 | if(flag == false;){ | ^
s989602450
p00009
C++
#include<stdio.h> #include<math.h> int gurobal[1000001]={0}; int main(void) { int n=0; int i=0,j=0; int heihoukon=0; int count=0; while(scanf("%d",&n)!=EOF) { count=0; gurobal[1]=0; for (i=2;i<=n;i++) { gurobal[i]=1; } (int)heihoukon=sqrt((double)n); for (i=2;i<=heihoukon;i++) { if (gurobal[i]!=0) { for (j=i*2;j<=n;j+=i) { gurobal[j]=0; } } } for (i=2;i<=n;i++) { if (gurobal[i]!=0) { count++; } } printf("%d\n",count); } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: lvalue required as left operand of assignment 18 | (int)heihoukon=sqrt((double)n); | ^~~~~~~~~~~~~~
s593428611
p00009
C++
#include<stdio.h> #include<math.h> int gurobal[999999]={0}; int main(void) { int n=0; int i=0,j=0; int heihoukon=0; int count=0; while(scanf("%d",&n)!=EOF) { count=0; gurobal[1]=0; for (i=2;i<=n;i++) { gurobal[i]=1; } (int)heihoukon=sqrt((double)n); for (i=2;i<=heihoukon;i++) { if (gurobal[i]!=0) { for (j=i*2;j<=n;j+=i) { gurobal[j]=0; } } } for (i=2;i<=n;i++) { if (gurobal[i]!=0) { count++; } } printf("%d\n",count); } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: lvalue required as left operand of assignment 18 | (int)heihoukon=sqrt((double)n); | ^~~~~~~~~~~~~~
s069671462
p00009
C++
#include <iostream> #include <bitset> #include <cmath> using namespace std; int main() { int count=0,n; prime[0]=1; prime[1]=1; while(cin>>n) { int prime[1000001]={0}; for(int i=2;i<=sqrt(n);i++) if(prime[i]==0) for(int j=i+1;j<=n;j++) if(i%j==0) prime[j]=1; for(int i=2;i<=n;i++) if(prime[i]==0) count++; cout<<count<<endl; count=0; } }
a.cc: In function 'int main()': a.cc:9:9: error: 'prime' was not declared in this scope 9 | prime[0]=1; | ^~~~~
s200869412
p00009
C++
#include<iostream> using namespace std; int main() { bool is_prime[1000000]; memset(is_prime,false,sizeof(is_prime)); for(int i=2;i<1000000;i++){ if(!is_prime[i]){ // cout<<i<<endl; for(int m=i*2;m<1000000;m+=i){ is_prime[m]=true; } } } int n; while(cin>>n){ int ans=0; for(int i=2;i<=n;i++){ if(!is_prime[i]) ans++; } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:7:9: error: 'memset' was not declared in this scope 7 | memset(is_prime,false,sizeof(is_prime)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s174733821
p00009
C++
#include <stdio.h> #include <string.h> int main(void){ int n=999999,a,b,c; char x[1000000]; memset(x,0,sizeof(x)); for(a=2,c=0;a<=n;a++){ if(x[a]){x[a]=c;continue;} x[a]=++c; for(b=a*2;b<=n;b+=a)x[b]=-1; } while(~scanf("%d",&n)){ printf("%d\n",x[n]); } return 0;
a.cc: In function 'int main()': a.cc:15:14: error: expected '}' at end of input 15 | return 0; | ^ a.cc:3:15: note: to match this '{' 3 | int main(void){ | ^
s008171309
p00009
C++
#include <iostream> #define N 100000 #define rep(i,n) for(int i=0;i<n;i++) int main(void) { bool a[N+1]; int prime[N], n; rep(i,N) { a[i] = true; } a[0] = a[1] = false; for(int i=2;i*i<=N;i++) { if(a[i]) { prime[i] = prime[i-1] + 1; for(int j=i*i;j<N;j+=i) a[j] = false; } else prime[i] = prime[i-1]; } while(cin >> n) cout << prime[n] << endl; return 0; }
a.cc: In function 'int main()': a.cc:26:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 26 | while(cin >> n) | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:27:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 27 | cout << prime[n] << 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:27:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 27 | cout << prime[n] << 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) | ^~~~
s089041858
p00009
C++
#include <iostream> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; const int N = 100000 int main(void) { bool a[N+1]; int prime[N], n; rep(i,N+1) { a[i] = true; } a[0] = a[1] = false; for(int i=2;i*i<=N;i++) { if(a[i]) { prime[i] = prime[i-1] + 1; for(int j=i*i;j<N;j+=i) a[j] = false; } else prime[i] = prime[i-1]; } while(cin >> n) cout << prime[n] << endl; return 0; }
a.cc:7:1: error: expected ',' or ';' before 'int' 7 | int main(void) | ^~~
s525044811
p00009
C++
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef vector <int> vi; vi primes; int get_primes(int max){ int n = (max+1)/2; int root = (int)(pow(n, 0.5)); vector <bool> numbers(n, true); numbers[0]=false; if (max>1) primes.push_back(2); for (int i=1; i<root; i++){ int tmp = i*2+1; if (numbers[i]){ primes.push_back(tmp); for (int j=i+tmp; j<n+1; j+=tmp){ numbers[j]=false; } } } for (int i=root; i<n+1; i++){ if(numbers[i]){ primes.push_back(2*i+1); } } return 0; } int main(void){ vi n; int nmax=0; while (true){ int tmp; cin>>tmp; if (cin.eof()) break; n.push_back(tmp); if (tmp>nmax) nmax=tmp; } get_primes(nmax); for (int i=0; i<n.size(); i++){ cout<<upper_bound(primes.begin(), primes.end(), n[i]) - primes.begin()<<endl; } return 0; }
a.cc: In function 'int get_primes(int)': a.cc:10:26: error: 'pow' was not declared in this scope 10 | int root = (int)(pow(n, 0.5)); | ^~~
s373159891
p00009
C++
using System; using System.Collections; class main { static void Main(String[] args) { while (true) { string s = Console.ReadLine(); if (s != null) { int c = 0; int f = 0; int n = int.Parse(s); int r = (int)Math.Sqrt(n); ArrayList p = new ArrayList(); if (n > 1) { for (int a = 2; a <= n; a++) { p.Add(a); } while (true) { f = (int)p[0]; c++; for (int i = 0; i < n; i++) { p.Remove(f * i); } if (f > r) { break; } } Console.WriteLine("{0}",c+p.Count); } if (n <= 1) { Console.WriteLine(0); } } if (s == null) { break; } } Console.ReadKey(); } }
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; | ^~~~~~ a.cc:6:22: error: 'String' has not been declared 6 | static void Main(String[] args) | ^~~~~~ a.cc:6:31: error: expected ',' or '...' before 'args' 6 | static void Main(String[] args) | ^~~~ a.cc:51:2: error: expected ';' after class definition 51 | } | ^ | ; a.cc: In static member function 'static void main::Main(int*)': a.cc:10:13: error: 'string' was not declared in this scope 10 | string s = Console.ReadLine(); | ^~~~~~ a.cc:11:17: error: 's' was not declared in this scope 11 | if (s != null) | ^ a.cc:11:22: error: 'null' was not declared in this scope 11 | if (s != null) | ^~~~ a.cc:15:25: error: expected primary-expression before 'int' 15 | int n = int.Parse(s); | ^~~ a.cc:16:30: error: 'Math' was not declared in this scope 16 | int r = (int)Math.Sqrt(n); | ^~~~ a.cc:17:17: error: 'ArrayList' was not declared in this scope 17 | ArrayList p = new ArrayList(); | ^~~~~~~~~ a.cc:22:25: error: 'p' was not declared in this scope 22 | p.Add(a); | ^ a.cc:26:34: error: 'p' was not declared in this scope 26 | f = (int)p[0]; | ^ a.cc:37:21: error: 'Console' was not declared in this scope 37 | Console.WriteLine("{0}",c+p.Count); | ^~~~~~~ a.cc:37:47: error: 'p' was not declared in this scope 37 | Console.WriteLine("{0}",c+p.Count); | ^ a.cc:41:21: error: 'Console' was not declared in this scope 41 | Console.WriteLine(0); | ^~~~~~~ a.cc:44:17: error: 's' was not declared in this scope 44 | if (s == null) | ^ a.cc:44:22: error: 'null' was not declared in this scope 44 | if (s == null) | ^~~~ a.cc:49:9: error: 'Console' was not declared in this scope 49 | Console.ReadKey(); | ^~~~~~~
s718575861
p00009
C++
#include <iostream> using namespace std; bool isprime(int &num) { static int i; i = 2; for(;i< num; i++) if(num%i==0) return false; return true; } int countprime(int &num) { static int i; static int count; count = 0; i = 2; for(;i<=num;i++) if(isprime(i)) count++; return count; } int main() { int num[30]; for(int i = 0; i < 30; i++) cin >> num[i]; for(int i = 0; i < 30; i++) cout << countprime(int num[i]) << endl; }
a.cc: In function 'int main()': a.cc:31:28: error: expected primary-expression before 'int' 31 | cout << countprime(int num[i]) << endl; | ^~~
s571218236
p00009
C++
#include <iostream> using namespace std; int main(){ const int N_MAX=1000000; int i,j,n[32],ni,soi,max; int so[N_MAX],count[N_MAX]; for(i=0;i<N_MAX;i++) count[i]=so[i]=0; ni=0; max=0; while(cin>>n[ni]) if(n[ni++]>max) max=n[ni-1]; int sq_max = (int)sqrt(max); so[0]=so[1]=1; for(soi=0,i=2;i<=sq_max;i++){ if(so[i]>0)continue; for(j=i*2;j<=max;j+=i) so[j]=1; } for(i=2;i<=max;i++){ count[i] = count[i-1]+1-so[i]; } for(i=0;i<ni;i++) cout << count[n[i]] << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:27: error: 'sqrt' was not declared in this scope 17 | int sq_max = (int)sqrt(max); | ^~~~
s939877509
p00009
C++
#include <iostream> using namespace std; int main(){ const int N_MAX=100000; int i,j,n[32],ni,soi,max; int so[N_MAX],count[N_MAX]; for(i=0;i<N_MAX;i++) count[i]=so[i]=0; ni=0; max=0; while(cin>>n[ni]) if(n[ni++]>max) max=n[ni-1]; int sq_max = (int)sqrt(max); so[0]=so[1]=1; for(soi=0,i=2;i<=sq_max;i++){ if(so[i]>0)continue; for(j=i*2;j<=max;j+=i) so[j]=1; } for(i=2;i<=max;i++){ count[i] = count[i-1]+1-so[i]; } for(i=0;i<ni;i++) cout << count[n[i]] << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:27: error: 'sqrt' was not declared in this scope 17 | int sq_max = (int)sqrt(max); | ^~~~
s929464925
p00009
C++
#include <iostream> using namespace std; int main(){ const int N_MAX=100; int i,j,n[32],ni,soi,max; int so[N_MAX],count[N_MAX]; for(i=0;i<N_MAX;i++) count[i]=so[i]=0; ni=0; max=0; while(cin>>n[ni]) if(n[ni++]>max) max=n[ni-1]; int sq_max = (int)sqrt(max); so[0]=so[1]=1; for(soi=0,i=2;i<=sq_max;i++){ if(so[i]>0)continue; for(j=i*2;j<=max;j+=i) so[j]=1; } for(i=2;i<=max;i++){ count[i] = count[i-1]+1-so[i]; } for(i=0;i<ni;i++) cout << count[n[i]] << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:27: error: 'sqrt' was not declared in this scope 17 | int sq_max = (int)sqrt(max); | ^~~~
s836170805
p00009
C++
#include <iostream> using namespace std; int main(){ const int N_MAX=1000000; int i,j,n[32],ni,max; int count[N_MAX]; bool so[N_MAX]; for(i=0;i<N_MAX;i++) so[i]=true; ni=0; max=0; while(cin>>n[ni]) if(n[ni++]>max) max=n[ni-1]; so[0]=so[1]=0; for(soi=0,i=2;i<=1000;i++){ if(so[i]==0)continue; for(j=i*2;j<=max;j+=i) so[j]=false; } for(i=2;i<=max;i++){ count[i] = count[i-1]+so[i]; } for(i=0;i<ni;i++) cout << count[n[i]] << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:13: error: 'soi' was not declared in this scope; did you mean 'so'? 19 | for(soi=0,i=2;i<=1000;i++){ | ^~~ | so
s242753323
p00009
C++
#include<iostream> #include<conio.h> #include<cmath> using namespace std; int main() { int n; cin>>n; for (int i=2; i<n; i++) for (int j=2; j*j<=i; j++) { if (i % j == 0) break; else if (j+1 > sqrt(i)) { cout << i << endl; } } return 0; }
a.cc:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s887020277
p00009
C++
int main(void) { int data,i,j,k=0,l=0,kai[100]={0},s[100000]={0}; while(scanf("%d",&data) != EOF) { if(data<=1) kai[k]=0; else { for(i=2;i<=data;i++)s[i]=i; i=2; while(i*2<data) { if(s[i] != 0) { j=2; while(j*i<=data) { s[j*i]=0; j+=1; } } i+=1; } for(i=2;i<=data;i++) { if(s[i]!=0) { kai[k]+=1; } } } k+=1; } for(j=0;j<k;j++) printf("%d\n",kai[j]); return 0; }
a.cc: In function 'int main()': a.cc:5:15: error: 'scanf' was not declared in this scope 5 | while(scanf("%d",&data) != EOF) | ^~~~~ a.cc:5:36: error: 'EOF' was not declared in this scope 5 | while(scanf("%d",&data) != EOF) | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main(void) a.cc:41:5: error: 'printf' was not declared in this scope 41 | printf("%d\n",kai[j]); | ^~~~~~ a.cc:41:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s779666746
p00009
C++
#include<stdio.h> int main(void) { int data,i,j,k=0,l=0,kai=0,s[100000]={0}; while(scanf("%d",&data) != EOF) { if(data<=1) kai[k]=0; else { for(i=2;i<=data;i++)s[i]=i; i=2; while(i*2<data) { if(s[i] != 0) { j=2; while(j*i<=data) { s[j*i]=0; j+=1; } } i+=1; } for(i=2;i<=data;i++) { if(s[i]!=0) { kai+=1; } } } printf("%d",kai); kai=0; } return 0; }
a.cc: In function 'int main()': a.cc:10:23: error: invalid types 'int[int]' for array subscript 10 | kai[k]=0; | ^
s214486380
p00009
C++
#include<stdio.h> int main(void) { int data=1,i,j,s[1000000],x; while((scanf("%d\n",&data)) != EOF) { for(i=0;i<=data;i++){ s[i]=1;} x=0; if(data<=1){ printf("%d\n",0);} else { for(i=2;i<=data/2;i++){ if(s[i]!=0){ for(j=i*2;j<data;j+=i) s[j]=0; } for(i=0;i<data;i++) x+=s[i]; printf("%d\n",x); } } return 0; }
a.cc: In function 'int main()': a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s591268049
p00009
C++
int main(void) { int d=2,i,j,s[10000],x; while(scanf("%d",d)!=EOF) { for(i=0;i<=d;i++){ s[i]=1;} x=0; if(d<=1){ printf("%d\n",0);} else { for(i=2;i<=d/2;i++){ if(s[i]!=0){ for(j=i*2;j<d;j+=i) s[j]=0; } } for(i=0;i<d;i++) x+=s[i]; printf("%d\n",x); } } return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: 'scanf' was not declared in this scope 6 | while(scanf("%d",d)!=EOF) | ^~~~~ a.cc:6:30: error: 'EOF' was not declared in this scope 6 | while(scanf("%d",d)!=EOF) | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a.cc:12:25: error: 'printf' was not declared in this scope 12 | printf("%d\n",0);} | ^~~~~~ a.cc:12:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' a.cc:23:17: error: 'printf' was not declared in this scope 23 | printf("%d\n",x); | ^~~~~~ a.cc:23:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s726802358
p00009
C++
#include <stdio.h> #include <math.h> int judgeprime(long num){ int primeflag=1,i; if(num%2==0){primeflag=0;} else for(i=3;i<sqrt(num);i+=2){ if( num%i==0 ){ primeflag=0; break; } } if(num==0||num==1||num==4){primeflag=0;} else if(num==2){primeflag=1;} return primeflag; } int main(void){ long i,num; int much; while( scanf("%ld",&num) != -1 ){ much=0; for(i=1;i<=num;i++){ much+=judgeprime(i); } printf("%d\n",much); } return 0; } 04:57:02 ~/programming/AOJ $
a.cc:42:1: error: expected unqualified-id before numeric constant 42 | 04:57:02 ~/programming/AOJ | ^~
s288548663
p00009
C++
#include <stdio.h> #include <math.h> int judgeprime(long num){ int primeflag=1,i; if(num%2==0){primeflag=0;} else for(i=3;i<sqrt(num);i+=2){ if( num%i==0 ){ primeflag=0; break; } } if(num==0||num==1||num==4){primeflag=0;} else if(num==2){primeflag=1;} return primeflag; } int main(void){ long i,num; int much; while( scanf("%ld",&num) != -1 ){ much=0; for(i=1;i<=num;i++){ much+=judgeprime(i); } printf("%d\n",much); } return 0; } 04:57:02 ~/programming/AOJ $
a.cc:42:1: error: expected unqualified-id before numeric constant 42 | 04:57:02 ~/programming/AOJ | ^~
s792688792
p00009
C++
#include <stdio.h> int main(void){ int n; while(scanf("%d",&n)!=EOF){ int count=0; for(int m=1;m<=n;m++){ bool check=true; for(int i=2;i<m;i++){ if(i!=m && m%i==0){ chack=false; } } if(check==true){ count++; } } } return 0; }
a.cc: In function 'int main()': a.cc:11:1: error: 'chack' was not declared in this scope; did you mean 'check'? 11 | chack=false; | ^~~~~ | check
s377732965
p00009
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int MAX_N = 1000000; vector<int> init(void){ vector<int> prime; bool is_prime[MAX_N]; memset(is_prime, true, MAX_N); is_prime[0] = is_prime[1] = false; for(int i=2; i<MAX_N; i++){ if(is_prime[i]){ prime.push_back(i); for(int j=2*i; j<MAX_N; j+=i) is_prime[j] = false; } } return prime; } int main(int argc, const char * argv[]) { int n; vector<int> prime = init(); while(cin>>n){ cout << upper_bound(prime.begin(), prime.end(), n)-prime.begin() << endl; } return 0; }
a.cc: In function 'std::vector<int> init()': a.cc:11:5: error: 'memset' was not declared in this scope 11 | memset(is_prime, true, MAX_N); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s224398831
p00009
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; const int MAX_N = 1000000; vector<int> init(void){ vector<int> prime; bool is_prime[MAX_N]; memset(is_prime, true, MAX_N); is_prime[0] = is_prime[1] = false; for(int i=2; i<MAX_N; i++){ if(is_prime[i]){ prime.push_back(i); for(int j=2*i; j<MAX_N; j+=i) is_prime[j] = false; } } return prime; } int main(int argc, const char * argv[]) { int n; vector<int> prime = init(); while(cin>>n){ cout << upper_bound(prime.begin(), prime.end(), n)-prime.begin() << endl; } return 0; }
a.cc: In function 'std::vector<int> init()': a.cc:12:5: error: 'memset' was not declared in this scope 12 | memset(is_prime, true, MAX_N); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | #include <string>
s819029124
p00009
C++
#include <iostream> using namespace std; int main(){ int prime[999999]; bool is_prime[1000000]; int p =0; int n ; int i; while(cin >> n){ for(i=0;i<=n;i++) is_prime[i] = true; is_prime[0] = is_prime[1] = false; for(i=2;i<=n;i++){ if(is_prime[i]){ prime[p++] = i; for(int j=2*i;j<=n;j+=i) is_prime[j] = false; } } cout << p << endl; p = 0; } return 0; } [tebora@tebora cpp]$ cat pr.cpp #include <iostream> using namespace std; int main(){ int prime[999999]; bool is_prime[1000000]; int p =0; int n ; int i; while(cin >> n){ for(i=0;i<=n;i++) is_prime[i] = true; is_prime[0] = is_prime[1] = false; for(i=2;i<=n;i++){ if(is_prime[i]){ prime[p++] = i; for(int j=2*i;j<=n;j+=i) is_prime[j] = false; } } cout << p << endl; p = 0; } return 0; }
a.cc:24:8: error: stray '@' in program 24 | [tebora@tebora cpp]$ cat pr.cpp | ^ a.cc:24:1: error: expected unqualified-id before '[' token 24 | [tebora@tebora cpp]$ cat pr.cpp | ^ a.cc:28:5: error: redefinition of 'int main()' 28 | int main(){ | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main(){ | ^~~~
s034349980
p00009
C++
import sys def prime_list(n): l = range(2,n+1) i = 2 while i * i <= n: l = filter(lambda x: x == i or x % i != 0, l) i = i + 1 return l if __name__ == '__main__': l = prime_list(999999) for line in sys.stdin: n = int(line) print len([x for x in l if x <= n])
a.cc:11:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 11 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s625780843
p00009
C++
#include<iostream> #include<vector> using namespace std; int main(){ int n; vector<int> a; while(cin << n){ a.push_back(n); } for(int i=0;i<a.size();i++){ int k = 0; for(int j=2;j<a[i];j++){ if(a[i]%j == 0 ) k++; } cout << k ; } }
a.cc: In function 'int main()': a.cc:8:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | while(cin << n){ | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:8:13: note: candidate: 'operator<<(int, int)' (built-in) 8 | while(cin << n){ | ~~~~^~~~ a.cc:8:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:8:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 8 | while(cin << n){ | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:8:16: required from here 8 | while(cin << n){ | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~
s542974646
p00009
C++
#include<iostream> #include<vector> using namespace std; int main(){ int n; vector<int> a; while(cin < n){ a.push_back(n); } for(int i=0;i<a.size();i++){ int k = 0; for(int j=2;j<a[i];j++){ if(a[i]%j == 0 ) k++; } cout << k ; } }
a.cc: In function 'int main()': a.cc:8:13: error: no match for 'operator<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | while(cin < n){ | ~~~ ^ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:8:13: note: candidate: 'operator<(int, int)' (built-in) 8 | while(cin < n){ | ~~~~^~~ a.cc:8:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, 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_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | while(cin < n){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | while(cin < n){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | while(cin < n){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | while(cin < n){ | ^ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 8 | while(cin < n){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | while(cin < n){ | ^ /usr/include/c++/14/string_view:680: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> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | while(cin < n){ | ^ /usr/include/c++/14/string_view:688: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>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 8 | while(cin < n){ | ^ /usr/include/c++/14/bits/basic_string.h:3874: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>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | while(cin < n){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | while(cin < n){ | ^ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 8 | while(cin < n){ | ^ 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:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 8 | while(cin < n){ | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::vector<_Tp, _Alloc>' 8 | while(cin < n){ | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s739580358
p00009
C++
int main() { int num, i, j; cout<<"Enter an Integer:"<<endl; cin>>num; for(i=0; i<=num; i++) { for(j=2; j<=i; j++) { if(i%j == 0) { break; } else if (i == j+1) { cout<<i<<endl; } } } }
a.cc: In function 'int main()': a.cc:5:6: error: 'cout' was not declared in this scope 5 | cout<<"Enter an Integer:"<<endl; | ^~~~ a.cc:5:33: error: 'endl' was not declared in this scope 5 | cout<<"Enter an Integer:"<<endl; | ^~~~ a.cc:6:19: error: 'cin' was not declared in this scope 6 | cin>>num; | ^~~
s353402230
p00009
C++
#include <iostream> using namespace std; int main(void) { int input; while(cin >> input) { bool isPrime[input]; // if the index 0 do not count as the prime number isPrime[0] = false; /// if the index 1 do not count as the prime number isPrime[1] = false; // if the index 2 count as the prime number isPrime[2] = true; for(int i = 3; i <= input; i += 2) isPrime[i] = true; for(int i = 3; i * i <= input; i += 2) for(int j = i * i; j <= n; j += i) isPrime[j] = false; for(int i = 4; i <= n; i += 2) isPrime[i] = false; int count = 0; for(int i = 0; i <= input; i++) if(isPrime[i]) { count++; } cout << count << endl; } }
a.cc: In function 'int main()': a.cc:22:42: error: 'n' was not declared in this scope 22 | for(int j = i * i; j <= n; j += i) | ^ a.cc:24:38: error: 'n' was not declared in this scope 24 | for(int i = 4; i <= n; i += 2) | ^
s897207174
p00009
C++
#define MAX 100 main(){ int in_num; int i, put, j, k = 0, l; int count = 0; int res; int pres[MAX], flag = 0; while(1){ res = scanf("%d", &in_num); if(res == EOF) break; for(i = 1 ; i <= in_num ; i++){ /* iが現在まで判明している素数の倍数でないかを調べる */ for(l = 0 ; pres[l] != NULL ; l++){ if(i % pres[l] != 0){ flag = 1; } } /* そうでなかったら以下を実行 */ if(flag == 1){ for(j = 2 ; j <= i ; j++){ put = i % j; if(put == 0 && i != j) break; if(put == 0){ if(k < MAX){ /* kが最高格納数以下なら素数を保存 */ pres[k] = i; k++; } printf("%d\n", i); count++; break; } } } } printf("%d\n", count); count = 0; } return 0; }
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:13:9: error: 'scanf' was not declared in this scope 13 | res = scanf("%d", &in_num); | ^~~~~ a.cc:15:13: error: 'EOF' was not declared in this scope 15 | if(res == EOF) break; | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a.cc:19:28: error: 'NULL' was not declared in this scope 19 | for(l = 0 ; pres[l] != NULL ; l++){ | ^~~~ a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | a.cc:37:11: error: 'printf' was not declared in this scope 37 | printf("%d\n", i); | ^~~~~~ a.cc:37:11: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' a.cc:45:3: error: 'printf' was not declared in this scope 45 | printf("%d\n", count); | ^~~~~~ a.cc:45:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s924250577
p00009
C++
#include <stdio.h> int main(){ int e[30]; int k = 0; while( scanf( "%d",&e[k] ) != EOF )k++; for( int i = 0;i < k;i++ ){ int n = 1; int k = 0; while( true ){ if( e[k] => n ){ k++; n *= 10; } else { break; } } printf( "%d\n",k ); } return 0; }
a.cc: In function 'int main()': a.cc:13:23: error: expected primary-expression before '>' token 13 | if( e[k] => n ){ | ^
s690816555
p00009
C++
#include <deque> #include <algorithm> #include <iostream> #include <functional> using namespace std; int main(){ int N,t,f,ans=0,s; while(cin>>N){ for(int j=0;j<N;j++){ int cnt=0; for(int k=2;k<N;k++){ if(N%k==0){ cnt=1; } } if(data[j]==2){ cnt=0; } else if(data[j]==1){ cnt=1; } if(cnt==0)ans++; } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:24: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 16 | if(data[j]==2){ | ^ a.cc:19:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 19 | else if(data[j]==1){ | ^
s829295764
p00009
C++
#include<iostream> using namespace std; int main(){ int n; int *prime,i,j; int count; bool flag; //for(i=1;i<1000000;i++)n[i]=1; while((cin >> n)!= NULL){ count = 0; prime = new int[(int)sqrt(n)+1]; for(i = 3; i <= n; i+=2){ flag = true; for(j = 0; j < count; j++){ if(i % prime[j] == 0){ flag = false; break; } } if(flag == true){ prime[count++] = i; } } if(n > 1) count++; //2 cout << count << endl; delete prime; } // while(1); return 0; }
a.cc: In function 'int main()': a.cc:11:25: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'long int') 11 | while((cin >> n)!= NULL){ | ^ a.cc:11:25: note: candidate: 'operator!=(int, long int)' (built-in) a.cc:11:25: 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:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: In file included from /usr/include/stdio.h:34, 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:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 11 | while((cin >> n)!= NULL){ | ^~~~ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 11 | while((cin >> n)!= NULL){ | ^~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | while((cin >> n)!= NULL){ | ^~~~ 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:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | while((cin >> n)!= NULL){ | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/string_view:658: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> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/string_view:666: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>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:11:28: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long int' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/bits/basic_string.h:3833: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>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:11:28: 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 >> n)!= NULL){ | ^~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:11:28: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 11 | while((cin >> n)!= NULL){ | ^~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:11:28: 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 >> n)!= NULL){ | ^~~~ 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:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:11:28: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | while((cin >> n)!= NULL){ | ^~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48,
s752067554
p00009
C++
#include <iostream> #include <list> #include <algorithm> using namespace std; int main() { int n; while(!cin.eof()) { cin >> n; list<int> search_list(n-1); list<int> prime_number; while(n!=1) { search_list.push_front(n); n--; } while(!search_list.empty()) { int m = search_list.front(); prime_number.push_back(m); search_list.pop_front(); list<int>::iterator it = search_list.begin(); while(it!=search_list.end()) { if((*it % m) == 0){ it = search_list.erase(it); continue; } it++; } } cout << prime_number.size()-1 << endl; prime_number.erase(); search_list.erase(); } }
a.cc: In function 'int main()': a.cc:32:23: error: no matching function for call to 'std::__cxx11::list<int>::erase()' 32 | prime_number.erase(); | ~~~~~~~~~~~~~~~~~~^~ In file included from /usr/include/c++/14/list:66, from a.cc:2: /usr/include/c++/14/bits/list.tcc:150:5: note: candidate: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::__cxx11::list<int>::iterator; const_iterator = std::__cxx11::list<int>::const_iterator]' 150 | list<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/list.tcc:150:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/list:65: /usr/include/c++/14/bits/stl_list.h:1559:7: note: candidate: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::__cxx11::list<int>::iterator; const_iterator = std::__cxx11::list<int>::const_iterator]' 1559 | erase(const_iterator __first, const_iterator __last) noexcept | ^~~~~ /usr/include/c++/14/bits/stl_list.h:1559:7: note: candidate expects 2 arguments, 0 provided a.cc:33:22: error: no matching function for call to 'std::__cxx11::list<int>::erase()' 33 | search_list.erase(); | ~~~~~~~~~~~~~~~~~^~ /usr/include/c++/14/bits/list.tcc:150:5: note: candidate: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::__cxx11::list<int>::iterator; const_iterator = std::__cxx11::list<int>::const_iterator]' 150 | list<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/list.tcc:150:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_list.h:1559:7: note: candidate: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::__cxx11::list<int>::iterator; const_iterator = std::__cxx11::list<int>::const_iterator]' 1559 | erase(const_iterator __first, const_iterator __last) noexcept | ^~~~~ /usr/include/c++/14/bits/stl_list.h:1559:7: note: candidate expects 2 arguments, 0 provided
s656224221
p00010
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); for(int i = 0; i < n; i++) { double x1 = s.nextDouble(); double y1 = s.nextDouble(); double x2 = s.nextDouble(); double y2 = s.nextDouble(); double x3 = s.nextDouble(); double y3 = s.nextDouble(); double a1 = 2.0 * (x2 - x1); double b1 = 2.0 * (y2 - y1); double c1 = (x1 * x1) - (x2 * x2) + (y1 * y1) - (y2 * y2); double a2 = 2.0 * (x3 - x1); double b2 = 2.0 * (y3 - y1); double c2 = (x1 * x1) - (x3 * x3) + (y1 + y1) - (y3 * y3); double x = (b1*c2 - b2*c1)/(a1*b2 - a2*b1); double y = (c1*a2 - c2*a1)/(a1*b2 - a2*b1); double l = Math.hypot(x-x1, y-y1) x *= 1000; y *= 1000; l *= 1000; long xt = Math.round(x); long yt = Math.round(y); long lt = Math.round(l); x = (double)xt / 1000; y = (double)yt / 1000; l = (double)lt / 1000; System.out.printf("%.3f %.3f %.3f\n",x,y,l); } } }
Main.java:25: error: ';' expected double l = Math.hypot(x-x1, y-y1) ^ 1 error
s071236342
p00010
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; &#160; public class Main{ &#160; &#160;&#160;&#160;&#160;private static final String BLANK = " "; &#160; &#160;&#160;&#160;&#160;public static void main(String[] args) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { try{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i < count; i++) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 円の方程式を計算 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double[][] equation = solve(in.readLine().split(BLANK)); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double x = equation[0][3] / 2; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double y = equation[1][3] / 2; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double n = equation[2][3]; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;StringBuilder result = new StringBuilder(); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;result.append( &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP)) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.append(BLANK); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;result.append( &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP)) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.append(BLANK); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;result.append(new BigDecimal(Math.sqrt(x * x + y * y - n * n)) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.setScale(3, BigDecimal.ROUND_HALF_UP)); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.out.println(result.toString()); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} } catch(Exception e) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e.printStackTrace(); } &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} catch (IOException e) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e.printStackTrace(); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} finally { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;in.close(); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} catch (IOException e) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e.printStackTrace(); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;private static double[][] solve(String[] data) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double[][] equation = prepare(data); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 方程式の計算 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i < equation.length; i++) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double target = equation[i][i]; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 対象値が0ならば入れ替え &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (target == 0.0) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;boolean judge = false; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int j = i + 1; j < equation.length; j++) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double nextTarget = equation[j][i]; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (nextTarget != 0.0) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;change(equation, i, j); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;target = nextTarget; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;judge = true; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 万が一解なしだった場合にすべて0の値を出力して終了 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (!judge) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[0][3] = 0.0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[1][3] = 0.0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[2][3] = 0.0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 対象列の値を割り算 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int k = 0; k < equation[i].length; k++) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[i][k] = equation[i][k] / target; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 各列の値の整理 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int l = 0; l < equation.length; l++) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 対象列ならばスキップ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (l == i) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;continue; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double num = equation[l][i]; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[l][0] = equation[l][0] - equation[i][0] * num; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[l][1] = equation[l][1] - equation[i][1] * num; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[l][2] = equation[l][2] - equation[i][2] * num; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[l][3] = equation[l][3] - equation[i][3] * num; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return equation; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;private static double[][] prepare(String[] data) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double[][] equation = new double[data.length / 2][data.length / 2 + 1]; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int i = 0; i < data.length; i += 2) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int secNum = i / 2; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// x軸設定 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double x = Double.valueOf(data[i]); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// y軸設定 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double y = Double.valueOf(data[i + 1]); &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// 配列に設定 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[secNum][0] = x; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[secNum][1] = y; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[secNum][2] = 1.0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[secNum][3] = x * x + y * y; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return equation; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;private static void change(double[][] equation, int i, int j) { &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (int k = 0; k < equation[i].length; k++) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double temp = equation[i][k]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[i][k] = equation[j][k]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;equation[j][k] = temp; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;} }
Main.java:5: error: class, interface, enum, or record expected &#160; ^ Main.java:5: error: illegal character: '#' &#160; ^ Main.java:7: error: illegal start of type &#160; ^ Main.java:7: error: illegal character: '#' &#160; ^ Main.java:8: error: illegal start of type &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal start of type &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal start of type &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal start of type &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;private static final String BLANK = " "; ^ Main.java:9: error: illegal start of type &#160; ^ Main.java:9: error: illegal character: '#' &#160; ^ Main.java:10: error: illegal start of type &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal character: '#' &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal start of type &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal character: '#' &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal start of type &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal character: '#' &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal start of type &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:10: error: illegal character: '#' &#160;&#160;&#160;&#160;public static void main(String[] args) { ^ Main.java:11: error: illegal start of expression &#160; ^ Main.java:11: error: illegal character: '#' &#160; ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:12: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ^ Main.java:13: error: illegal start of expression &#160; ^ Main.java:13: error: illegal character: '#' &#160; ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:14: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try { ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.readLine()); ^ Main.java:16: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int count = Integer.valueOf(in.re
s226914434
p00010
Java
package judge.aidu.volume0; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; public class CircumscribedCircleOfATriangle { private static final String BLANK = " "; public static void main(String[] args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); try { try{ int count = Integer.valueOf(in.readLine()); for (int i = 0; i < count; i++) { // 円の方程式を計算 double[][] equation = solve(in.readLine().split(BLANK)); double x = equation[0][3] / 2; double y = equation[1][3] / 2; double n = equation[2][3]; StringBuilder result = new StringBuilder(); result.append( new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP)) .append(BLANK); result.append( new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP)) .append(BLANK); result.append(new BigDecimal(Math.sqrt(x * x + y * y - n * n)) .setScale(3, BigDecimal.ROUND_HALF_UP)); System.out.println(result.toString()); } }catch(Exception re) { re.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } private static double[][] solve(String[] data) { double[][] equation = prepare(data); // 方程式の計算 for (int i = 0; i < equation.length; i++) { double target = equation[i][i]; // 対象値が0ならば入れ替え if (target == 0.0) { boolean judge = false; for (int j = i + 1; j < equation.length; j++) { double nextTarget = equation[j][i]; if (nextTarget != 0.0) { change(equation, i, j); target = nextTarget; judge = true; break; } } // 万が一解なしだった場合にすべて0の値を出力して終了 if (!judge) { equation[0][3] = 0.0; equation[1][3] = 0.0; equation[2][3] = 0.0; break; } } // 対象列の値を割り算 for (int k = 0; k < equation[i].length; k++) { equation[i][k] = equation[i][k] / target; } // 各列の値の整理 for (int l = 0; l < equation.length; l++) { // 対象列ならばスキップ if (l == i) { continue; } double num = equation[l][i]; equation[l][0] = equation[l][0] - equation[i][0] * num; equation[l][1] = equation[l][1] - equation[i][1] * num; equation[l][2] = equation[l][2] - equation[i][2] * num; equation[l][3] = equation[l][3] - equation[i][3] * num; } } return equation; } private static double[][] prepare(String[] data) { double[][] equation = new double[data.length / 2][data.length / 2 + 1]; for (int i = 0; i < data.length; i += 2) { int secNum = i / 2; // x軸設定 double x = Double.valueOf(data[i]); // y軸設定 double y = Double.valueOf(data[i + 1]); // 配列に設定 equation[secNum][0] = x; equation[secNum][1] = y; equation[secNum][2] = 1.0; equation[secNum][3] = x * x + y * y; } return equation; } private static void change(double[][] equation, int i, int j) { for (int k = 0; k < equation[i].length; k++) { double temp = equation[i][k]; equation[i][k] = equation[j][k]; equation[j][k] = temp; } } }
Main.java:8: error: class CircumscribedCircleOfATriangle is public, should be declared in a file named CircumscribedCircleOfATriangle.java public class CircumscribedCircleOfATriangle { ^ Note: Main.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
s686938922
p00010
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; public class Main{ private static final String BLANK = " "; public static void main(String[] args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); try { try{ int count = Integer.valueOf(in.readLine()); for (int i = 0; i < count; i++) { // 円の方程式を計算 double[][] equation = solve(in.readLine().split(BLANK)); double x = equation[0][3] / 2; double y = equation[1][3] / 2; double n = equation[2][3]; StringBuilder result = new StringBuilder(); result.append( new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP)) .append(BLANK); result.append( new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP)) .append(BLANK); result.append(new BigDecimal(Math.sqrt(x * x + y * y - n * n)) .setScale(3, BigDecimal.ROUND_HALF_UP)); System.out.println(result.toString()); } }catch(Exception re) { re.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } private static double[][] solve(String[] data) { double[][] equation = prepare(data); // 方程式の計算 for (int i = 0; i < equation.length; i++) { double target = equation[i][i]; // 対象値が0ならば入れ替え if (target == 0.0) { boolean judge = false; for (int j = i + 1; j < equation.length; j++) { double nextTarget = equation[j][i]; if (nextTarget != 0.0) { change(equation, i, j); target = nextTarget; judge = true; break; } } // 万が一解なしだった場合にすべて0の値を出力して終了 if (!judge) { equation[0][3] = 0.0; equation[1][3] = 0.0; equation[2][3] = 0.0; break; } } // 対象列の値を割り算 for (int k = 0; k < equation[i].length; k++) { equation[i][k] = equation[i][k] / target; } // 各列の値の整理 for (int l = 0; l < equation.length; l++) { // 対象列ならばスキップ if (l == i) { continue; } double num = equation[l][i]; equation[l][0] = equation[l][0] - equation[i][0] * num; equation[l][1] = equation[l][1] - equation[i][1] * num; equation[l][2] = equation[l][2] - equation[i][2] * num; equation[l][3] = equation[l][3] - equation[i][3] * num; } } return equation; } private static double[][] prepare(String[] data) { double[][] equation = new double[data.length / 2][data.length / 2 + 1]; for (int i = 0; i < data.length; i += 2) { int secNum = i / 2; // x軸設定 double x = Double.valueOf(data[i]); // y軸設定 double y = Double.valueOf(data[i + 1]); // 配列に設定 equation[secNum][0] = x; equation[secNum][1] = y; equation[secNum][2] = 1.0; equation[secNum][3] = x * x + y * y; } return equation; } private static void change(double[][] equation, int i, int j) { for (int k = 0; k < equation[i].length; k++) { double temp = equation[i][k]; equation[i][k] = equation[j][k]; equation[j][k] = temp; } } }
Main.java:43: error: exception IOException is never thrown in body of corresponding try statement } catch (IOException e) { ^ Note: Main.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
s164395687
p00010
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int i=0;i<n;i++){ int x1,y1,x2,y2,x3,y3; x1=sc.nextInt(); y1=sc.nextInt(); x2=sc.nextInt(); y2=sc.nextInt(); x3=sc.nextInt(); y3=sc.nextInt(); int a=(x1*x1-x2*x2)*(y2-y3)-(x2*x2-x3*x3)-(y1-y2)*(y2-y3)*(y3-y1); int b=2*(x1-x2)*(y2-y3)-2*(x2-x3)*(y1-y2); int px=a/b; int py=(px-x2/2-x3/2)*(x3-x2)/(y2-y3)+(y2+y3)/2; int r=Math.hypot(px-x1,py-y1); System.out.printf("%d %d %d\n",px,py,r); } } }
Main.java:19: error: incompatible types: possible lossy conversion from double to int int r=Math.hypot(px-x1,py-y1); ^ 1 error
s980782813
p00010
Java
import java.util.*; public class Main{ static final Scanner sc = new Scanner(System.in); public static void main(String[] args) { double x1,x2,x3,y1,y2,y3; int n = stdin.nextInt(); while( n-- > 0 ){ x1 = sc.nextDouble(); y1 = sc.nextDouble(); x2 = sc.nextDouble(); y2 = sc.nextDouble(); x3 = sc.nextDouble(); y3 = sc.nextDouble(); double[] ans = solve( 2*(x1-x2), 2*(y1-y2), x1*x1+y1*y1-(x2*x2+y2*y2), 2*(x1-x3), 2*(y1-y3), x1*x1+y1*y1-(x3*x3+y3*y3)); System.out.printf("%.3f %.3f %.3f\n", ans[0], ans[1], Math.sqrt( Math.pow(ans[0]-x1, 2) + Math.pow(ans[1]-y1, 2) ) ); } } static double[] solve(double a, double b, double c, double d, double e, double f){ double[] ans = new double[2]; ans[0] = (c*e - b*f) / (a*e - b*d) + 0.0; ans[1] = (a*f - c*d) / (a*e - b*d) + 0.0; return ans; } }
Main.java:7: error: cannot find symbol int n = stdin.nextInt(); ^ symbol: variable stdin location: class Main 1 error
s881985897
p00010
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.RoundingMode; public class Main { /** * 空白区切りの6つの数字を受け取り、 * その6つの数字を3点とする三角形の外心および外接円の半径を取得する。 * * @param args */ public static void main(String[] args) throws IOException { // 入力値をリストで受け取る BigDecimal[][] triangleList = readTriangleList(); for (BigDecimal[] trianglePoints : triangleList) { // 三角形クラスに値を設定する Triangle triangle = new Triangle(trianglePoints); // 外接円を求める CircumscribedCircle circumscribedCircle = triangle .calculateCircumscribedCircle(); // 外接円の中心座標と半径を出力する printCircumscribedCircle(circumscribedCircle); } } /** * 標準入力から空白区切りの数値を取得し、三角形を表す数値の2次元配列として返却する。 * * @return 三角形を表す整数の2次元配列(6×データ数) */ protected static BigDecimal[][] readTriangleList() throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); // 最初にデータの個数を取得する int numberOfLine = Integer.parseInt(reader.readLine()); // 1行につき、6データずつ取り込む final int NUMBER_OF_ELEMENT = 6; BigDecimal[][] triangleList = new BigDecimal[numberOfLine][NUMBER_OF_ELEMENT]; for (int i = 0; i < triangleList.length; i++) { String[] lengthArray = reader.readLine().split(" "); for (int j = 0; j < lengthArray.length; j++) { triangleList[i][j] = new BigDecimal(lengthArray[j]); } } if (reader != null) { reader.close(); } return triangleList; } /** * 外接円の中心座標と半径を表示する。 * * @param circumscribedCircle * 外接円 */ protected static void printCircumscribedCircle( final CircumscribedCircle circumscribedCircle) { System.out.print(getScaledString(circumscribedCircle.getCenter().getX())); System.out.print(" "); System.out.print(getScaledString(circumscribedCircle.getCenter().getY())); System.out.print(" "); System.out.print(getScaledString(circumscribedCircle.getRadius())); System.out.println(); } /** * 数値を表示用に丸めて文字列にして返す。 * * @param value 数値 * @return 小数点以下3桁で丸めた文字列 */ protected static String getScaledString(BigDecimal value) { return value.setScale(3, RoundingMode.HALF_UP).toPlainString(); } /** * 外接円を表すクラス * */ class CircumscribedCircle { /** 外心 */ private Point center; /** 半径 */ private BigDecimal radius; /** * コンストラクタ * * @param center * @param radius */ public CircumscribedCircle(final Point center, final BigDecimal radius) { this.center = center; this.radius = radius; } public Point getCenter() { return center; } public void setCenter(Point center) { this.center = center; } public BigDecimal getRadius() { return radius; } public void setRadius(BigDecimal radius) { this.radius = radius; } } /** * 三角形を表すクラス * */ class Triangle { /** 点A */ private Point a; /** 点B */ private Point b; /** 点C */ private Point c; /** * コンストラクタ * * @param points * 座標を表す数値配列 */ public Triangle(final BigDecimal[] points) { a = new Point(points[0], points[1]); b = new Point(points[2], points[3]); c = new Point(points[4], points[5]); } /** * 外接円を求める。 * * @return 外接円 */ public CircumscribedCircle calculateCircumscribedCircle() { // 外心を求める // 垂直二等分線を2つ求めて、連立方程式を解く final BigDecimal[][] simultaneousEquation = new BigDecimal[2][3]; simultaneousEquation[0] = a.calculateMidperpendicular(b); // AB simultaneousEquation[1] = a.calculateMidperpendicular(c); // AC BigDecimal[] answer = calculateSimultaneousEquation(simultaneousEquation); Point center = new Point(answer[0], answer[1]); // 外接円の半径を求める BigDecimal radius = center.calculateDistance(a); return new CircumscribedCircle(center, radius); } public Point getA() { return a; } public void setA(Point a) { this.a = a; } public Point getB() { return b; } public void setB(Point b) { this.b = b; } public Point getC() { return c; } public void setC(Point c) { this.c = c; } } /** * 平面座標を表すクラス * */ class Point { /** x座標 */ private BigDecimal x; /** y座標 */ private BigDecimal y; /** * コンストラクタ * * @param x * x座標 * @param y * y座標 */ public Point(final BigDecimal x, final BigDecimal y) { this.x = x; this.y = y; } /** * 引数で渡された座標と自分を結ぶ直線の傾きを求める。 * * @param opponent * 傾きを求める相手の座標 * @return 傾き */ public BigDecimal calculateTilt(final Point opponent) { final BigDecimal distanceX = x.subtract(opponent.getX()); final BigDecimal distanceY = y.subtract(opponent.getY()); // 傾きが無限大の場合は null を返す if (distanceX.compareTo(BigDecimal.ZERO) == 0) { return null; } return distanceY.divide(distanceX); } /** * 引数で渡された座標と自分との距離を求める。 * * @param opponent * 距離を求める相手の座標 * @return 距離 */ public BigDecimal calculateDistance(final Point opponent) { final BigDecimal distanceX = x.subtract(opponent.getX()); final BigDecimal distanceY = y.subtract(opponent.getY()); return sqrt(distanceX.pow(2).add(distanceY.pow(2))); } /** * 引数で渡された座標と自分との垂直二等分線を求める。 * 方程式を ax + by = c という形式にした際の、a, b, c のリストを返す。 * * @param opponent * 垂直二等分線を求める相手の座標 * @return 垂直二等分線を表す方程式の係数リスト */ public BigDecimal[] calculateMidperpendicular(final Point opponent) { final BigDecimal tilt = calculateTilt(opponent); final Point middle = calculateMiddlePoint(opponent); final BigDecimal[] equation = new BigDecimal[3]; if (tilt == null){ // 傾きが無限大の場合は、y = c の形で方程式を作る equation[0] = BigDecimal.ZERO; equation[1] = BigDecimal.ONE; equation[2] = middle.getY(); } else if (tilt.compareTo(BigDecimal.ZERO) == 0) { // 傾きが0の場合は、x = c の形で方程式を作る equation[0] = BigDecimal.ONE; equation[1] = BigDecimal.ZERO; equation[2] = middle.getX(); } else { // ax + y = c の形で方程式を作る equation[0] = BigDecimal.ONE.divide(tilt); equation[1] = BigDecimal.ONE; equation[2] = equation[0].multiply(middle.getX()).add(middle.getY()); } return equation; } /** * 引数で渡された座標と自分との中点を求める。 * * @param opponent * 中点を求める相手の座標 * @return 中点 */ public Point calculateMiddlePoint(final Point opponent) { final BigDecimal TWO = BigDecimal.valueOf(2); final BigDecimal middleX = x.add(opponent.getX()).divide(TWO); final BigDecimal middleY = y.add(opponent.getY()).divide(TWO); return new Point(middleX, middleY); } public BigDecimal getX() { return x; } public void setX(BigDecimal x) { this.x = x; } public BigDecimal getY() { return y; } public void setY(BigDecimal y) { this.y = y; } @Override public String toString() { return "Point [x=" + x + ", y=" + y + "]"; } } /** * 指定された連立方程式の解を求める。 解が1意に定まる前提でロジックを構築している。 * * ax + by = c * dx + ey = f * * @param target * 連立方程式を表す整数配列 * @return 解となる x と y */ protected static BigDecimal[] calculateSimultaneousEquation( final BigDecimal[][] target) { final BigDecimal a = target[0][0]; final BigDecimal b = target[0][1]; final BigDecimal c = target[0][2]; final BigDecimal d = target[1][0]; final BigDecimal e = target[1][1]; final BigDecimal f = target[1][2]; BigDecimal[] answers = new BigDecimal[2]; // (a * e - b * d) BigDecimal divisor = a.multiply(e).subtract(b.multiply(d)); // x = (c * e - f * b) / divisor answers[0] = c.multiply(e).subtract(f.multiply(b)).divide(divisor); // y = (a * f - c * d) / divisor answers[1] = a.multiply(f).subtract(c.multiply(d)).divide(divisor); return answers; } /** * 平方根を求める。(BigDecimal用) * * @param a * 入力値 * @return 入力値の平方根 */ protected static BigDecimal sqrt(final BigDecimal a) { // 0 の場合は計算を行わない if (a.compareTo(BigDecimal.ZERO) == 0) { return a; } // Math.sqrt() と同じ精度とする final int DEFAULT_SCALE = 16; final BigDecimal TWO = BigDecimal.valueOf(2); // ニュートン法を用いて算出する BigDecimal x = a; for (int i = 1; i < DEFAULT_SCALE; i *= 2) { // x = x - (x * x - a) / (2 * x); x = x.subtract(x .multiply(x) .subtract(a) .divide(x.multiply(TWO), DEFAULT_SCALE, BigDecimal.ROUND_HALF_EVEN)); } return x; } }
Main.java:22: error: non-static variable this cannot be referenced from a static context Triangle triangle = new Triangle(trianglePoints); ^ Note: Main.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
s666289887
p00010
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.MathContext; public class AOJ0010 { public static void main(String[] args) throws IOException { //input BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; str = br.readLine(); int N = Integer.parseInt(str); int scale = 3; for (int i = 0; i < N; i++) { str = br.readLine(); //Get point String[] num = str.split(" ", 0); point P = new point(num[0], num[1]); point Q = new point(num[2], num[3]); point R = new point(num[4], num[5]); //Get vector vector PQ = new vector(P, Q); vector PR = new vector(P, R); BigDecimal half_length = new BigDecimal(vector_length(PQ).toPlainString()); half_length = half_length.divide(new BigDecimal("2"), BigDecimal.ROUND_HALF_UP); //Get unit_vector unit_vector uPQ = new unit_vector(PQ); unit_vector uPR = new unit_vector(PR); //Get center from PQ BigDecimal temp_x = new BigDecimal(coefficient(PQ, PR).multiply(uPQ.unit_vy).toPlainString()); BigDecimal temp_y = new BigDecimal(coefficient(PQ, PR).multiply(uPQ.unit_vx).toPlainString()); point O = new point(uPQ.unit_vx.multiply(half_length).add(temp_x), uPQ.unit_vy.multiply(half_length).subtract(temp_y)); //Get radius vector OP = new vector(O, P); BigDecimal rad = new BigDecimal(vector_length(OP).toPlainString()); rad = rad.setScale(3, BigDecimal.ROUND_HALF_UP); /* //Get normal_vector vector nPQ = new vector(uPQ.unit_vy, new BigDecimal("0").subtract(uPQ.unit_vx)); vector nPR = new vector(uPR.unit_vy, new BigDecimal("0").subtract(uPR.unit_vx)); //Get dot BigDecimal dot = new BigDecimal(dot_vector(PQ, PR).toPlainString()); */ System.out.println(O.x.setScale(3, BigDecimal.ROUND_HALF_UP) + " " + O.y.setScale(3, BigDecimal.ROUND_HALF_UP) + " " + rad); } /* while ((str = br.readLine()) != null){ String[] num = str.split(" ", 0); //varieties BigDecimal x1 = new BigDecimal(num[0]); BigDecimal y1 = new BigDecimal(num[1]); BigDecimal x2 = new BigDecimal(num[2]); BigDecimal y2 = new BigDecimal(num[3]); BigDecimal x3 = new BigDecimal(num[4]); BigDecimal y3 = new BigDecimal(num[5]); //calculation BigDecimal x0 = new BigDecimal(x1.toPlainString()); x0 = x0.add(x2); x0 = x0.add(x3); x0 = x0.divide(new BigDecimal("3.000"), 3, BigDecimal.ROUND_HALF_UP); BigDecimal y0 = new BigDecimal(y1.toPlainString()); y0 = y0.add(y2); y0 = y0.add(y3); y0 = y0.divide(new BigDecimal("3.000"), 3, BigDecimal.ROUND_HALF_UP); BigDecimal rad_x = new BigDecimal(x0.toPlainString()); rad_x = rad_x.subtract(x1); rad_x = rad_x.multiply(rad_x); BigDecimal rad_y = new BigDecimal(y0.toPlainString()); rad_y = rad_y.subtract(y1); rad_y = rad_y.multiply(rad_y); BigDecimal rad = new BigDecimal(rad_x.toPlainString()); rad = rad.add(rad_y); rad = rad_sqrt(rad); rad = rad.setScale(scale, BigDecimal.ROUND_HALF_UP); //Output System.out.println(x0 + " " + y0 + " " + rad); } */ } static BigDecimal dot_vector (vector a, vector b) { BigDecimal dot = new BigDecimal(a.vx.toPlainString()); dot = dot.multiply(b.vx); BigDecimal tmp = new BigDecimal(a.vy.toPlainString()); tmp = tmp.multiply(b.vy); dot = dot.add(tmp); return dot; } static BigDecimal vector_length (vector a) { BigDecimal length_x = new BigDecimal(a.vx.multiply(a.vx).toPlainString()); BigDecimal length_y = new BigDecimal(a.vy.multiply(a.vy).toPlainString()); BigDecimal length_2 = new BigDecimal(length_x.add(length_y).toPlainString()); BigDecimal length = new BigDecimal(Math.sqrt(length_2.doubleValue()), MathContext.DECIMAL64); return length; } static BigDecimal coefficient (vector a, vector b) { BigDecimal XaXb = new BigDecimal(a.vx.multiply(b.vx).toPlainString()); BigDecimal YaYb = new BigDecimal(a.vy.multiply(b.vy).toPlainString()); BigDecimal Xb2 = new BigDecimal(b.vx.multiply(b.vx).toPlainString()); BigDecimal Yb2 = new BigDecimal(b.vy.multiply(b.vy).toPlainString()); BigDecimal XaYb = new BigDecimal(a.vx.multiply(b.vy).toPlainString()); BigDecimal XbYa = new BigDecimal(b.vx.multiply(a.vy).toPlainString()); BigDecimal tmp = new BigDecimal(XaYb.subtract(XbYa).toPlainString()); BigDecimal co = new BigDecimal(XaXb.add(YaYb).toPlainString()); co = co.subtract(Xb2); co = co.subtract(Yb2); co = co.divide(tmp, 5, BigDecimal.ROUND_HALF_UP); return co; } } //Definition of point class point { BigDecimal x; BigDecimal y; public point (String a, String b) { this.x = new BigDecimal(a); this.y = new BigDecimal(b); } public point (BigDecimal a, BigDecimal b) { this.x = new BigDecimal(a.toPlainString()); this.y = new BigDecimal(b.toPlainString()); } } //Definition of vector class vector { BigDecimal vx; BigDecimal vy; public vector (point a, point b) { this.vx = new BigDecimal(b.x.toPlainString()); vx = vx.subtract(a.x); this.vy = new BigDecimal(b.y.toPlainString()); vy = vy.subtract(a.y); } public vector (BigDecimal p, BigDecimal q) { this.vx = new BigDecimal(p.toPlainString()); this.vy = new BigDecimal(q.toPlainString()); } } class unit_vector { BigDecimal unit_vx; BigDecimal unit_vy; public unit_vector (vector a) { BigDecimal length_x = new BigDecimal(a.vx.multiply(a.vx).toPlainString()); BigDecimal length_y = new BigDecimal(a.vy.multiply(a.vy).toPlainString()); BigDecimal length_2 = new BigDecimal(length_x.add(length_y).toPlainString()); BigDecimal length = new BigDecimal(Math.sqrt(length_2.doubleValue()), MathContext.DECIMAL64); this.unit_vx = a.vx.divide(length, 5, BigDecimal.ROUND_HALF_UP); this.unit_vy = a.vy.divide(length, 5, BigDecimal.ROUND_HALF_UP); } }
Main.java:9: error: class AOJ0010 is public, should be declared in a file named AOJ0010.java public class AOJ0010 { ^ Note: Main.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
s738775993
p00010
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static double[] getLine(double x1, double y1, double x2, double y2){ double[] ans = new double[3]; double mid_x = (x1 + x2) / 2; double mid_y = (y1 + y2) / 2; ans[0] = y1 - y2; ans[1] = x1 - x2; ans[2] = - mid_y * (y1 - y2) - mid_x * (x1 - x2); return ans; } public static void main(String[] args){ int n = scan.nextInt(); double[] pt = new double[6]; for(int i = 0; i < n; i++){ for(int j = 0; j < pt.length; j++){ pt[j] = scan.nextDouble(); } double[] l1 = getLine(pt[0], pt[1], pt[2], pt[3]); double[] l2 = getLine(pt[0], pt[1], pt[4], pt[5]); double x = (l1[0] * l2[2] - l1[2] * l2[0] / (l1[1] * l2[0] - l1[0] * l2[1]); double y; if(l1[0] != 0){ y = (l1[1] * x + l1[2]) / - l1[0]; } else{ y = (l2[1] * x + l2[2]) / - l2[0]; } double r = Math.sqrt(Math.pow(x - pt[0], 2) + Math.pow(y - pt[1], 2)); System.out.printf("%.3f %.3f %.3f\n", x, y, r); } } }
Main.java:27: error: ')' expected (l1[1] * l2[0] - l1[0] * l2[1]); ^ 1 error
s269861440
p00010
Java
import java.util.*; public class Vol0_10{ private static final Scanner scan = new Scanner(System.in); public static double[] getLine(double x1, double y1, double x2, double y2){ double[] ans = new double[3]; double mid_x = (x1 + x2) / 2; double mid_y = (y1 + y2) / 2; ans[0] = y1 - y2; ans[1] = x1 - x2; ans[2] = - mid_y * (y1 - y2) - mid_x * (x1 - x2); return ans; } public static void main(String[] args){ List<Double> listX = new ArrayList<Double>(); List<Double> listY = new ArrayList<Double>(); List<Double> listR = new ArrayList<Double>(); int n = scan.nextInt(); double[] pt = new double[6]; for(int i = 0; i < n; i++){ for(int j = 0; j < pt.length; j++){ pt[j] = scan.nextDouble(); } double[] l1 = getLine(pt[0], pt[1], pt[2], pt[3]); double[] l2 = getLine(pt[0], pt[1], pt[4], pt[5]); double x = (l1[0] * l2[2] - l1[2] * l2[0]) / (l1[1] * l2[0] - l1[0] * l2[1]); double y; if(l1[0] != 0){ y = (l1[1] * x + l1[2]) / - l1[0]; } else{ y = (l2[1] * x + l2[2]) / - l2[0]; } double r = Math.sqrt(Math.pow(x - pt[0], 2) + Math.pow(y - pt[1], 2)); listX.add(x); listY.add(y); listR.add(r); } Iterator<Double> itX = listX.iterator(); Iterator<Double> itY = listY.iterator(); Iterator<Double> itR = listR.iterator(); while(itX.hasNext()){ double x = itX.next(); double y = itY.next(); double r = itR.next(); System.out.printf("%.3f %.3f %.3f\n", x, y, r); } } }
Main.java:3: error: class Vol0_10 is public, should be declared in a file named Vol0_10.java public class Vol0_10{ ^ 1 error
s076934859
p00010
Java
class Main { double x, y; Main( double x, double y ) { this.x = x; this.y = y; } public static void main( String[] args ) { new Circle(); } static class Circle { Circle() { java.util.Scanner sc = new java.util.Scanner( System.in ); point a = new point( sc.nextDouble(), sc.nextDouble() ); point b = new point( sc.nextDouble(), sc.nextDouble() ); point c = new point( sc.nextDouble(), sc.nextDouble() ); double ax_2 = a.x*a.x; double ay_2 = a.y*a.y; double bx_2 = b.x*b.x; double by_2 = b.y*b.y; double cx_2 = c.x*c.x; double cy_2 = c.y*c.y; double p1 = (a.y - c.y)*(ay_2 - by_2 + ax_2 - bx_2)+(a.y - b.y)*(ay_2 - cy_2 + ax_2 - cx_2); double p2 = 2*(a.y - c.y)*(a.x - b.x)-2*(a.y - b.y)*(a.x - c.x); double q1 = (a.x - c.x)*(ax_2 - bx_2 + ay_2 - by_2)-(a.x - b.x)*(ax_2 - cx_2 + ay_2 - cy_2); double q2 = 2*(a.x - c.x)*(a.y - b.y)-2*(a.x - b.x)*(a.y - c.y); double p = (p1/p2)/0.001/1000; double q = (q1/q2)/0.001/1000; double d = Math.sqrt((p-a.x)*(p-a.x)+(q-a.y)*(q-a.y)); System.out.printf( "%.3f %.3f %.3f\n" , p, q, d ); } } }
Main.java:18: error: cannot find symbol point a = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Circle Main.java:18: error: cannot find symbol point a = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Circle Main.java:19: error: cannot find symbol point b = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Circle Main.java:19: error: cannot find symbol point b = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Circle Main.java:20: error: cannot find symbol point c = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Circle Main.java:20: error: cannot find symbol point c = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Circle 6 errors
s737075326
p00010
Java
class Main { double x, y; Main( double x, double y ) { this.x = x; this.y = y; } public static void main( String[] args ) { java.util.Scanner sc = new java.util.Scanner( System.in ); point a = new point( sc.nextDouble(), sc.nextDouble() ); point b = new point( sc.nextDouble(), sc.nextDouble() ); point c = new point( sc.nextDouble(), sc.nextDouble() ); double ax_2 = a.x*a.x; double ay_2 = a.y*a.y; double bx_2 = b.x*b.x; double by_2 = b.y*b.y; double cx_2 = c.x*c.x; double cy_2 = c.y*c.y; double p1 = (a.y - c.y)*(ay_2 - by_2 + ax_2 - bx_2)+(a.y - b.y)*(ay_2 - cy_2 + ax_2 - cx_2); double p2 = 2*(a.y - c.y)*(a.x - b.x)-2*(a.y - b.y)*(a.x - c.x); double q1 = (a.x - c.x)*(ax_2 - bx_2 + ay_2 - by_2)-(a.x - b.x)*(ax_2 - cx_2 + ay_2 - cy_2); double q2 = 2*(a.x - c.x)*(a.y - b.y)-2*(a.x - b.x)*(a.y - c.y); double p = (p1/p2)/0.001/1000; double q = (q1/q2)/0.001/1000; double d = Math.sqrt((p-a.x)*(p-a.x)+(q-a.y)*(q-a.y)); System.out.printf( "%.3f %.3f %.3f\n" , p, q, d ); } }
Main.java:12: error: cannot find symbol point a = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Main Main.java:12: error: cannot find symbol point a = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Main Main.java:13: error: cannot find symbol point b = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Main Main.java:13: error: cannot find symbol point b = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Main Main.java:14: error: cannot find symbol point c = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Main Main.java:14: error: cannot find symbol point c = new point( sc.nextDouble(), sc.nextDouble() ); ^ symbol: class point location: class Main 6 errors
s869575449
p00010
Java
import java.util.Scanner; public class CircumscribedCircleofaTriangle2 { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { String[] vertexStrList = scan.nextLine().split(" "); double[] vertexList = new double[6]; for (int i = 0; i < 6; i++) { vertexList[i] = Double.parseDouble(vertexStrList[i]); } double ax = vertexList[0]; double ay = vertexList[1]; double bx = vertexList[2]; double by = vertexList[3]; double cx = vertexList[4]; double cy = vertexList[5]; double abDX = bx - ax; double abDY = by - ay; double acDX = cx - ax; double acDY = cy - ay; double[] in = { abDX, abDY, getB(ax, ay, bx, by), acDX, acDY, getB(ax, ay, cx, cy) }; double[] pXY = getXY(in); double r = Math.sqrt(Math.pow(ax - pXY[0], 2) + Math.pow(ay - pXY[1], 2)); System.out.println(pXY[0] + " " + pXY[1] + " " + String.format("%.3f", r)); } catch (Exception e) { System.exit(0); } } private static double[] getXY(double[] in) { double deno = (in[1] * in[3] - in[0] * in[4]); double[] xy = new double[2]; xy[0] = (in[1] * in[5] - in[2] * in[4]) / deno; xy[1] = (in[0] * in[5] - in[2] * in[3]) / (deno * -1); return xy; } private static double getB(double ax, double ay, double bx, double by) { return (Math.pow(by, 2) - Math.pow(ay, 2) + Math.pow(bx, 2) - Math.pow(ax, 2)) / 2; } }
Main.java:3: error: class CircumscribedCircleofaTriangle2 is public, should be declared in a file named CircumscribedCircleofaTriangle2.java public class CircumscribedCircleofaTriangle2 { ^ 1 error
s780642072
p00010
Java
/** * A GaussJordan object holds a two dimensional array representing a matrix * containing a system of equations. Contains methods for performing a * Gauss-Jordan Elimination and putting a matrix into Reduced Row Echelon Form * * @author Thomas Coe * @version 1.0 October 8th, 2013 */ class GaussJordan{ private double[][] augmentedMatrix; /** * Constructor for a GaussJordan object. Takes in a two dimensional double * array holding the matrix. * * @param matrix A double[][] containing the augmented matrix */ public GaussJordan(double[][] matrix) { augmentedMatrix = matrix; } /** * Runs a Gauss-Jordan elimination on the augmented matrix in order to put * it into reduced row echelon form * */ public void eliminate() { int startColumn = 0; for (int row=0; row<augmentedMatrix.length; row++) { //if the number in the start column is 0, try to switch with another while (augmentedMatrix[row][startColumn]==0.0){ boolean switched = false; int i=row; while (!switched && i<augmentedMatrix.length) { if(augmentedMatrix[i][startColumn]!=0.0){ double[] temp = augmentedMatrix[i]; augmentedMatrix[i]=augmentedMatrix[row]; augmentedMatrix[row]=temp; switched = true; } i++; } //if after trying to switch, it is still 0, increase column if (augmentedMatrix[row][startColumn]==0.0) { startColumn++; } } //if the number isn't one, reduce to one if(augmentedMatrix[row][startColumn]!=1.0) { double divisor = augmentedMatrix[row][startColumn]; for (int i=startColumn; i<augmentedMatrix[row].length; i++) { augmentedMatrix[row][i] = augmentedMatrix[row][i]/divisor; } } //make sure the number in the start column of all other rows is 0 for (int i=0; i<augmentedMatrix.length; i++) { if (i!=row && augmentedMatrix[i][startColumn]!=0) { double multiple = 0-augmentedMatrix[i][startColumn]; for (int j=startColumn; j<augmentedMatrix[row].length; j++){ augmentedMatrix[i][j] += multiple*augmentedMatrix[row][j]; } } } startColumn++; } } /** * Returns a String with the contents of the augmented matrix. * * @return A String representation of the augmented matrix */ public String toString() { String text = ""; for (int i=0; i<augmentedMatrix.length; i++) { for (int j=0; j<augmentedMatrix[i].length; j++) { text+=augmentedMatrix[i][j] + ", "; } text+="\n"; } return text; } } class Point implements Comparable{ public double x; public double y; public Point(double x, double y) { this.x = x; this.y = y; } @Override public int compareTo(Object o) { Point p = (Point) o; if (this.x != p.x) return (int)(this.x - p.x); return (int)(p.y - this.y); } } class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 0; i < n; i++) { ArrayList<Point> points = new ArrayList<Point>(); for (int j = 0; j < 3; j++) { double x = in.nextDouble(); double y = in.nextDouble(); points.add(new Point(x,y)); } solve(points); } } public static double calcXY(double x1, double x2) { return x1 + (x2 - x1) / 2.0; } public static double calcAdash(double x1, double x2, double y1, double y2) { return -1.0 * (x2 - x1) / (y2 - y1); } public static double calcB(double y, double adash, double x) { return y - adash * x; } static double EPS = 1e-9; public static boolean EQ(double d1, double d2) { return (Math.abs(d1 - d2) < EPS); } public static List<Double> genRow(double x1, double x2, double y1, double y2) { double x = calcXY(x1, x2); double y = calcXY(y1, y2); List<Double> row = new ArrayList<>(); if(EQ(y2, y1)) { row.add(0.0); row.add(1.0); row.add(x); } else if(EQ(x2, x1)) { row.add(1.0); row.add(0.0); row.add(y); } else { double adash = calcAdash(x1, x2, y1, y2); row.add(1.0); row.add(-adash); row.add(calcB(y, adash, x)); } // ???????????? row.add(0.0); row.add(0.0); return row; } public static void solve(ArrayList<Point> p) { double x1 = p.get(0).x; double y1 = p.get(0).y; double x2 = p.get(1).x; double y2 = p.get(1).y; double x3 = p.get(2).x; double y3 = p.get(2).y; List<List<Double>> A = new ArrayList<List<Double>>(); A.add(genRow(x1, x2, y1, y2)); A.add(genRow(x1, x3, y1, y3)); double[][] arrays = { {A.get(0).get(0), A.get(0).get(1), A.get(0).get(2)}, {A.get(1).get(0), A.get(1).get(1), A.get(1).get(2)} }; GaussJordan g = new GaussJordan(arrays); g.eliminate(); double px = arrays[0][2] + 0.0; double py = arrays[1][2] + 0.0; assert(Double.isNaN(px) == false); assert(Double.isNaN(py) == false); assert(Double.isInfinite(px) == false); assert(Double.isInfinite(py) == false); double R = Math.sqrt(Math.pow(px-x1, 2.0) + Math.pow(py-y1, 2.0)); System.out.println(String.format("%.3f %.3f %.3f", px, py, R)); } }
Main.java:136: error: cannot find symbol public static List<Double> genRow(double x1, double x2, double y1, double y2) { ^ symbol: class List location: class Main Main.java:161: error: cannot find symbol public static void solve(ArrayList<Point> p) { ^ symbol: class ArrayList location: class Main Main.java:106: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:106: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:109: error: cannot find symbol ArrayList<Point> points = new ArrayList<Point>(); ^ symbol: class ArrayList location: class Main Main.java:109: error: cannot find symbol ArrayList<Point> points = new ArrayList<Point>(); ^ symbol: class ArrayList location: class Main Main.java:139: error: cannot find symbol List<Double> row = new ArrayList<>(); ^ symbol: class List location: class Main Main.java:139: error: cannot find symbol List<Double> row = new ArrayList<>(); ^ symbol: class ArrayList location: class Main Main.java:169: error: cannot find symbol List<List<Double>> A = new ArrayList<List<Double>>(); ^ symbol: class List location: class Main Main.java:169: error: cannot find symbol List<List<Double>> A = new ArrayList<List<Double>>(); ^ symbol: class List location: class Main Main.java:169: error: cannot find symbol List<List<Double>> A = new ArrayList<List<Double>>(); ^ symbol: class ArrayList location: class Main Main.java:169: error: cannot find symbol List<List<Double>> A = new ArrayList<List<Double>>(); ^ symbol: class List location: class Main 12 errors
s364629855
p00010
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); double[] points = new double[6]; double ep = 0.0001; double l,m; for(int i=0 ; i<n ; i++) { for(int j=0 ; j<6 ; j++) points[j] = s.next(); for(int j=1 ; j<3 ; j++) { points[2*j] -= points[0]; points[2*j+1] -= points[1]; } l = (points[3]*points[3]+points[4]*points[4])*(points[3]-points[5])/(points[2]*points[5]-points[4]*points[3]); m = -(points[4]*points[4]+points[5]*points[5]+l*points[4])/points[5]; System.out.println(points[0]-l/2 + " " + points[1]-m/2 + " " + (l*l+m*m)/4); } } }
Main.java:12: error: incompatible types: String cannot be converted to double points[j] = s.next(); ^ Main.java:20: error: bad operand types for binary operator '-' System.out.println(points[0]-l/2 + " " + points[1]-m/2 + " " + (l*l+m*m)/4); ^ first type: String second type: double 2 errors
s065472922
p00010
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); double[] points = new double[6]; double ep = 0.0001; double l,m; for(int i=0 ; i<n ; i++) { for(int j=0 ; j<6 ; j++) points[j] = s.nextDouble(); for(int j=1 ; j<3 ; j++) { points[2*j] -= points[0]; points[2*j+1] -= points[1]; } l = (points[3]*points[3]+points[4]*points[4])*(points[3]-points[5])/(points[2]*points[5]-points[4]*points[3]); m = -(points[4]*points[4]+points[5]*points[5]+l*points[4])/points[5]; System.out.println(points[0]-l/2 + " " + points[1]-m/2 + " " + (l*l+m*m)/4); } } }
Main.java:20: error: bad operand types for binary operator '-' System.out.println(points[0]-l/2 + " " + points[1]-m/2 + " " + (l*l+m*m)/4); ^ first type: String second type: double 1 error
s531135860
p00010
Java
import java.util.*; public class Main { static double[] solve(double a, double b, double c, double d, double e, double f){ double det = a*e-b*d; double[] ans = new double[2]; ans[0] = (c*e-b*f)/det; ans[1] = (a*f-c*d)/det; for(int i=0; i<2; i++) if(ans[i]==-0) ans[i] = 0; return ans; } public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); for(int i=0; i<n; i++){ double x1 = stdIn.nextDouble(); double y1 = stdIn.nextDouble(); double x2 = stdIn.nextDouble(); double y2 = stdIn.nextDouble(); double x3 = stdIn.nextDouble(); double y3 = stdIn.nextDouble(); double[] ans = solve(x1-x2,y1-y2,x1*(x1-x2)+y1*(y1-y2),x3-x2,y3-y2,x3*(x3-x2)+y3*(y3-y2)); double xp,yp,r; xp = (x2 + ans[0])/2.0; yp = (y2 + ans[1])/2.0; r = Math.sqrt((xp-x2)*(xp-x2)+(yp-x2)*(yp-x2)); System.out.printf("%.3f %.3f %.3f",xp,yp,r); System.out.println(); } }
Main.java:34: error: reached end of file while parsing } ^ 1 error
s289433172
p00010
Java
1 0.0 0.0 2.0 0.0 2.0 2.0import java.util.*; public class Main { public static void main (String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for (int i = 0; i < n; i++) { double x1 = scanner.nextDouble(); double y1 = scanner.nextDouble(); double x2 = scanner.nextDouble(); double y2 = scanner.nextDouble(); double x3 = scanner.nextDouble(); double y3 = scanner.nextDouble(); double px = ((y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3)); double py = ((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*1 -x3*x3 +y1*y1 -y3*y3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3)); double a = Math.sqrt(Math.pow(x1-x2,2) + Math.pow(y1-y2,2)); double b = Math.sqrt(Math.pow(x2-x3,2) + Math.pow(y2-y3,2)); double c = Math.sqrt(Math.pow(x3-x1,2) + Math.pow(y3-y1,2)); double r = (a * b * c) / (Math.sqrt((a+b+c) * (-a+b+c) * (a-b+c) * (a+b-c))); System.out.printf("%.3f %.3f %.3f\n", px, py, r); } } }
Main.java:1: error: class, interface, enum, or record expected 1 ^ 1 error
s612046752
p00010
Java
import java.io.*; import static java.lang.Math.*; public class CircumscribedCircleOfATriangle { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); for(int i=0;i<n;i++)calc(in.readLine()); } private static void calc(String arr){ String[] points = arr.split(" ", 0); double x1 = Double.parseDouble(points[0]); double y1 = Double.parseDouble(points[1]); double x2 = Double.parseDouble(points[2]); double y2 = Double.parseDouble(points[3]); double x3 = Double.parseDouble(points[4]); double y3 = Double.parseDouble(points[5]); double A1 = 2*(x2-x1); double B1 = 2*(y2-y1); double C1 = pow(x1,2)-pow(x2,2)+pow(y1,2)-pow(y2,2); double A2 = 2*(x3-x1); double B2 = 2*(y3-y1); double C2 = pow(x1,2)-pow(x3,2)+pow(y1,2)-pow(y3,2); double x = (B1*C2-B2*C1)/(A1*B2-A2*B1); double y = (C1*A2-C2*A1)/(A1*B2-A2*B1); double r = sqrt(pow(x-x1,2)+pow(x-x1,2)); System.out.printf("%.3f %.3f %.3f", x,y,r); } }
Main.java:4: error: class CircumscribedCircleOfATriangle is public, should be declared in a file named CircumscribedCircleOfATriangle.java public class CircumscribedCircleOfATriangle { ^ 1 error
s294744373
p00010
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double x1, x2, x3, y1, y2, y3, a, b, c, x, y, r; while (sc.hasNext()) { x1 = sc.nextDouble(); y1 = sc.nextDouble(); x2 = sc.nextDouble(); y2 = sc.nextDouble(); x3 = sc.nextDouble(); y3 = sc.nextDouble(); a = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); b = Math.sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)); c = Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)); x = ((y1 - y3) * (y1 * y1 - y2 * y2 + x1 * x1 - x2 * x2) - (y1 - y2) * (y1 * y1 - y3 * y3 + x1 * x1 - x3 * x3)) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3)); y = ((x1 - x3) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2) - (x1 - x2) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3)) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3)); r = (Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1))); System.out.printf("%.3f %.3f %.3f", x, y, R); } } }
Main.java:24: error: cannot find symbol System.out.printf("%.3f %.3f %.3f", x, y, R); ^ symbol: variable R location: class Main 1 error
s051170149
p00010
Java
import java.io.*; class Main { public static void main(String args[])throws IOException { BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(input.readLine()); for(int i=0;i<n;i++) { String str=input.readLine(); String str_ary[]=str.split(" "); Double x[]=new Double[3]; Double y[]=new Double[3]; x[0]=Double.parseDouble(str_ary[0]); y[0]=Double.parseDouble(str_ary[0]); for(int j=1;j<3;j++) { x[j]=Double.parseDouble(str_ary[j*2]); y[j]=Double.parseDouble(str_ary[j*2+1]); } Double max1=x[0],max2=y[0],min1=x[0],min2=y[0],then=0; for(int j=0;j<3;j++) { if(x[j]>max1) { max1=x[j]; then=y[j]; } if(y[j]>max2)max2=y[j]; if(x[j]<min1)min1=x[j]; if(y[j]<min2)min2=y[j]; } Double ans1=0d,ans2=0d,ans3=0d; ans1=(max1+min1)/2; ans2=(max2+min2)/2; ans3=Math.sqrt(Math.pow(max1-ans1,2)+Math.pow(then,2)); if(ans1%1.0000>=0.0005)ans1+=0.001; if(ans2%1.0000>=0.0005)ans2+=0.001; if(ans3%1.0000>=0.0005)ans3+=0.001; System.out.printf("%.3f %.3f %.3f\n",ans1,ans2,ans3); } } }
Main.java:21: error: incompatible types: int cannot be converted to Double Double max1=x[0],max2=y[0],min1=x[0],min2=y[0],then=0; ^ 1 error
s116120255
p00010
Java
import std.stdio; import std.string; import std.conv; import std.math; int main() { int n; readf("%f",&n); foreach(int i;0..n) { double x1,y1,x2,y2,x3,y3; readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); double a1 = 2*(x2 - x1); double b1 = 2*(y2 - y1); double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2; double a2 = 2*(x3 -x1); double b2 = 2*(y3 - y1); double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3; double x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1); double y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1); double r_2 = (x1 - x)*(x1 - x) + (y1 - y)*(y1 - y); double r = sqrt(r_2); printf("%.3lf %.3lf %.3lf\n",x,y,r); } return 0; }
Main.java:11: error: not a statement foreach(int i;0..n) ^ Main.java:11: error: not a statement foreach(int i;0..n) ^ Main.java:6: error: unnamed classes are a preview feature and are disabled by default. int main() ^ (use --enable-preview to enable unnamed classes) Main.java:9: error: illegal start of expression readf("%f",&n); ^ Main.java:11: error: ';' expected foreach(int i;0..n) ^ Main.java:14: error: illegal start of expression readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); ^ Main.java:14: error: illegal start of expression readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); ^ Main.java:14: error: illegal start of expression readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); ^ Main.java:14: error: illegal start of expression readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); ^ Main.java:14: error: illegal start of expression readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); ^ Main.java:14: error: illegal start of expression readf("%f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3); ^ 11 errors
s975212343
p00010
Java
import java.util.*; import java.math.BigDecimal; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for(int i=0; i<n; i++) { double a1 = in.nextDouble(); double a2 = in.nextDouble(); double b1 = in.nextDouble(); double b2 = in.nextDouble(); double c1 = in.nextDouble(); double c2 = in.nextDouble(); double A = (Math.pow(b1,2)+Math.pow(b2,2)-Math.pow(a1,2)-Math.pow(a2,2))*(c2-a2); double B = (Math.pow(c1,2)+Math.pow(c2,2)-Math.pow(a1,2)-Math.pow(a2,2))*(b2-a2); double C = (b1-a1)*(c2-a2)-(c1-a1)*(b2-a2); double p = Math.abs((A-B)/2/C); double AA = (Math.pow(b1,2)+Math.pow(b2,2)-Math.pow(a1,2)-Math.pow(a2,2))*(c1-a1); double BB = (Math.pow(c2,2)+Math.pow(c1,2)-Math.pow(a2,2)-Math.pow(a1,2))*(b2-a1); double CC = (b2-a2)*(c1-a1)-(c2-a2)*(b1-a1); double q = Math.abs((AA-BB)/2/CC); double r = Math.sqrt(Math.pow(a1-p,2) + Math.pow(a2-q,2)); System.out.println(new BigDecimal(p).setScale(3, BigDecimal.ROUND_HALF_UP)+" "+new BigDecimal(q).setScale(3, BigDecimal.ROUND_HALF_UP)+" "+new BigDecimal(r).setScale(3, BigDecimal.ROUND_HALF_UP)); }
Main.java:25: error: reached end of file while parsing } ^ 1 error
s918402079
p00010
C
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { int n; double x1, x2, x3; double y1, y2, y3; cin >> n; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double px, py, r; double A = (x2 - x1)*(y3 - y2) - (y2 - y1)*(x3 - x2); px = 0.5*((y3 - y2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) - (y2 - y1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A; py = 0.5*(-(x3 - x2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) + (x2 - x1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A; double a = px - x1; double b = py - y1; double r0 = (a*a + b*b); double r1 = sqrt(r0); cout << fixed << setprecision(10) << px << " " << py << " " << r1 << endl; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s706243551
p00010
C
#include<stdio.h> #include<math.h> double x1,y1,x2,y2,x3,y3; double px, py,r; int main() { int n; scanf("%d",&n); while(n--) { scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3); double A1 =(x2*x2+y2*y2-x1*x1-y1*y1)*(y3-y1); double B1 =(x3*x3+y3*y3-x1*x1-y1*y1)*(y2-y1); double A2 =(x3*x3+y3*y3-x1*x1-y1*y1)*(x2-x1); double B2 =(x2*x2+y2*y2-x1*x1-y1*y1)*(x3-x1); double D = (x2-x1)*(y3-y1)-(y2-y1)*(x3-x1); px=(A1-B1)/D/2; py=(A2-B2)/D/2; r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1)); printf("%.3f %.3f %.3f\n",px,py,r); } return 0; }
main.c:3:11: error: 'y1' redeclared as different kind of symbol 3 | double x1,y1,x2,y2,x3,y3; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration of 'y1' with type 'double(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~
s277129121
p00010
C
#include <stdio.h> #include <math.h> typedef struct { double x; double y; } point_t; // result[0]: px // result[1]: py // result[2]: r void alg ( point_t* data, double* result ) { double a = sqrt( pow( data[0].x - data[1].x ) + pow( data[0].y - data[1].y ) ); double b = sqrt( pow( data[0].x - data[2].x ) + pow( data[0].y - data[2].y ) ); double c = sqrt( pow( data[1].x - data[2].x ) + pow( data[1].y - data[2].y ) ); double s = fabs( ( ( data[1].x - data[0].x ) * ( data[2].y - data[0].y ) - ( data[2].x - data[0].x ) * ( data[1].y - data[0].y ) ) / 2 ); result[0] = ( pow(a,2) * ( pow(b,2) + pow(c,2) - pow(a,2) ) * data[0].x + pow(b,2) * ( pow(c,2) + pow(a,2) - pow(b,2) ) * data[1].x + pow(c,2) * ( pow(a,2) + pow(b,2) - pow(c,2) ) * data[2].x ) / ( 16 * pow(s,2) ); result[1] = ( pow(a,2) * ( pow(b,2) + pow(c,2) - pow(a,2) ) * data[0].y + pow(b,2) * ( pow(c,2) + pow(a,2) - pow(b,2) ) * data[1].y + pow(c,2) * ( pow(a,2) + pow(b,2) - pow(c,2) ) * data[2].y ) / ( 16 * pow(s,2) ); result[2] = ( a * b * c ) / sqrt( ( a + b + c ) * ( - a + b + c ) * ( a - b + c ) * ( a + b - c ) ); } double round_d ( double input ) { if ( input >= 0.0 ) { return floor( input * 1000 + 0.5 ) / 1000; } else { return floor( fabs( input ) * 1000 + 0.5 ) / 1000 * -1.0; } } int main ( void ) { int i, linenum = 0; double result[3]; point_t points[3]; scanf( "%d", &linenum ); for ( i = 0; i < linenum; i++ ) { if ( scanf( "%lf %lf %lf %lf %lf %lf", &points[0].x, &points[0].y, &points[1].x, &points[1].y, &points[2].x, &points[2].y ) == EOF ) { fputs( "Syntax Error", stderr ); return 1; } alg( points, result ); printf( "%.3lf %.3lf %.3lf\n", round_d(result[0]), round_d(result[1]), round_d(result[2]) ); } return 0; }
main.c: In function 'alg': main.c:14:22: error: too few arguments to function 'pow' 14 | double a = sqrt( pow( data[0].x - data[1].x ) + pow( data[0].y - data[1].y ) ); | ^~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:14:53: error: too few arguments to function 'pow' 14 | double a = sqrt( pow( data[0].x - data[1].x ) + pow( data[0].y - data[1].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:15:22: error: too few arguments to function 'pow' 15 | double b = sqrt( pow( data[0].x - data[2].x ) + pow( data[0].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:15:53: error: too few arguments to function 'pow' 15 | double b = sqrt( pow( data[0].x - data[2].x ) + pow( data[0].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:16:22: error: too few arguments to function 'pow' 16 | double c = sqrt( pow( data[1].x - data[2].x ) + pow( data[1].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:16:53: error: too few arguments to function 'pow' 16 | double c = sqrt( pow( data[1].x - data[2].x ) + pow( data[1].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~
s775921704
p00010
C
#include <stdio.h> #include <math.h> typedef struct { double x; double y; } point_t; // result[0]: px // result[1]: py // result[2]: r void alg ( point_t* data, double* result ) { double a = sqrt( pow( data[0].x - data[1].x ) + pow( data[0].y - data[1].y ) ); double b = sqrt( pow( data[0].x - data[2].x ) + pow( data[0].y - data[2].y ) ); double c = sqrt( pow( data[1].x - data[2].x ) + pow( data[1].y - data[2].y ) ); double s = fabs( ( ( data[1].x - data[0].x ) * ( data[2].y - data[0].y ) - ( data[2].x - data[0].x ) * ( data[1].y - data[0].y ) ) / 2 ); result[0] = ( pow(a,2) * ( pow(b,2) + pow(c,2) - pow(a,2) ) * data[0].x + pow(b,2) * ( pow(c,2) + pow(a,2) - pow(b,2) ) * data[1].x + pow(c,2) * ( pow(a,2) + pow(b,2) - pow(c,2) ) * data[2].x ) / ( 16 * pow(s,2) ); result[1] = ( pow(a,2) * ( pow(b,2) + pow(c,2) - pow(a,2) ) * data[0].y + pow(b,2) * ( pow(c,2) + pow(a,2) - pow(b,2) ) * data[1].y + pow(c,2) * ( pow(a,2) + pow(b,2) - pow(c,2) ) * data[2].y ) / ( 16 * pow(s,2) ); result[2] = ( a * b * c ) / sqrt( ( a + b + c ) * ( - a + b + c ) * ( a - b + c ) * ( a + b - c ) ); } double round_d ( double input ) { if ( input >= 0.0 ) { return floor( input * 1000 + 0.5 ) / 1000; } else { return floor( fabs( input ) * 1000 + 0.5 ) / 1000 * -1.0; } } int main ( void ) { int i, linenum = 0; double result[3]; point_t points[3]; scanf( "%d", &linenum ); for ( i = 0; i < linenum; i++ ) { if ( scanf( "%lf %lf %lf %lf %lf %lf", &points[0].x, &points[0].y, &points[1].x, &points[1].y, &points[2].x, &points[2].y ) == EOF ) { fputs( "Syntax Error", stderr ); return 1; } alg( points, result ); printf( "%.3lf %.3lf %.3lf\n", round_d(result[0]), round_d(result[1]), round_d(result[2]) ); } return 0; }
main.c: In function 'alg': main.c:14:22: error: too few arguments to function 'pow' 14 | double a = sqrt( pow( data[0].x - data[1].x ) + pow( data[0].y - data[1].y ) ); | ^~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:14:53: error: too few arguments to function 'pow' 14 | double a = sqrt( pow( data[0].x - data[1].x ) + pow( data[0].y - data[1].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:15:22: error: too few arguments to function 'pow' 15 | double b = sqrt( pow( data[0].x - data[2].x ) + pow( data[0].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:15:53: error: too few arguments to function 'pow' 15 | double b = sqrt( pow( data[0].x - data[2].x ) + pow( data[0].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:16:22: error: too few arguments to function 'pow' 16 | double c = sqrt( pow( data[1].x - data[2].x ) + pow( data[1].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ main.c:16:53: error: too few arguments to function 'pow' 16 | double c = sqrt( pow( data[1].x - data[2].x ) + pow( data[1].y - data[2].y ) ); | ^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: declared here 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~
s208668259
p00010
C
#include<stdio.h> #include<math.h> int main(void){ int n,i; double x1,x2,x3,y1,y2,y3; double A1,B1,C1,A2,B2,C2,X,Y; double r; double a,b,c,a1,b1,c1; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%3lf %3lf %3lf %3lf %3lf %3lf",&x1,&y1,&x2,&y2,&x3,&y3); A1 = 2 * (x2 - x1); B1 = 2 * (y2 - y1); C1 = pow(x1,2) - pow(x2,2) + pow(y1,2) - pow(y2,2); A2 = 2 * (x3 - x1); B2 = 2 * (y3 - y1); C2 = pow(x1,2) - pow(x3,2) + pow(y1,2) - pow(y3,2); X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1); Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1); b = (pow(x2,2) - pow(x1,2)) + (pow(y2,2) - pow(y1,2)); b1 = sqrt(b); c = (pow(x3,2) - pow(x2,2)) + (pow(y3,2) - pow(y2,2)); c1 = sqrt(c); a = (pow(x3,2) - pow(x1,2)) + (pow(y3,2) - pow(y1,2)); a1 = sqrt(a); r = (a1 * b1 * c1)/sqrt((a1 + b1 + c1) * (-a1 + b1 + c1) * (a1 - b1 + c1) * (a1 + b1 - c1)); printf("%.3f %.3f %.3f\n",X,Y,r); }
main.c: In function 'main': main.c:34:3: error: expected declaration or statement at end of input 34 | } | ^
s292284261
p00010
C
#include<stdio.h> #include<math.h> int main(void){ int n; double x1,x2,x3,y1,y2,y3; double A1,B1,C1,A2,B2,C2,X,Y; double r; double a,b,c,a1,b1,c1; scanf("%d",&n); while( n != 0){ scanf("%3lf %3lf %3lf %3lf %3lf %3lf",&x1,&y1,&x2,&y2,&x3,&y3); A1 = 2 * (x2 - x1); B1 = 2 * (y2 - y1); C1 = pow(x1,2) - pow(x2,2) + pow(y1,2) - pow(y2,2); A2 = 2 * (x3 - x1); B2 = 2 * (y3 - y1); C2 = pow(x1,2) - pow(x3,2) + pow(y1,2) - pow(y3,2); X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1); Y =anf("%d",&n); while( n != 0){ scanf("%3lf %3lf %3lf %3lf %3lf %3lf",&x1,&y1,&x2,&y2,&x3,&y3); A1 = 2 * (x2 - x1); B1 = 2 * (y2 - y1); C1 = pow(x1,2) - pow(x2,2) + pow(y1,2) - pow(y2,2); A2 = 2 * (x3 - x1); B2 = 2 * (y3 - y1); C2 = pow(x1,2) - pow(x3,2) + pow(y1,2) - pow(y3,2); X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1); Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1); b = (pow(x2,2) - pow(x1,2)) + (pow(y2,2) - pow(y1,2)); b1 = sqrt(b); c = (pow(x3,2) - pow(x2,2)) + (pow(y3,2) - pow(y2,2)); c1 = sqrt(c); a = (pow(x3,2) - pow(x1,2)) + (pow(y3,2) - pow(y1,2)); a1 = sqrt(a); r = (a1 * b1 * c1)/sqrt((a1 + b1 + c1) * (-a1 + b1 + c1) * (a1 - b1 + c1) * (a1 + b1 - c1)); printf("%.3f %.3f %.3f\n",X,Y,r); n--; } return 0; }
main.c: In function 'main': main.c:24:8: error: implicit declaration of function 'anf'; did you mean 'ynf'? [-Wimplicit-function-declaration] 24 | Y =anf("%d",&n); | ^~~ | ynf main.c:49:2: error: expected declaration or statement at end of input 49 | } | ^
s495903920
p00010
C
#include<stdio.h> #include<math.h> int main(void) { double x1 , x2 , x3 , y1 , y2 , y3 , x, y , r , a ; while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&x2,&x3,&y1,&y2,&y3)!=EOF){ a = (x1*x1+x2*x2-x3*x3) / 2*x1*x2 ; r = x3 / (2*sin(double a)); x = ((y1-y3)*(y1*y1-y2*y2+x1*x1-x2*x2)-(y1-y2)*(y1*y1-y3*y3+x1*x1-x3*x3))/(2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3)); y = ((x1-x3)*(y1*y1-y2*y2+x1*x1-x2*x2)-(x1-x2)*(y1*y1-y3*y3+x1*x1-x3*x3))/(2*(y1-y2)*(x1-x3)-2*(y1-y3)*(x1-x2)); printf("%.3f %.3f %.3f",x,y,r); } return 0 ; }
main.c: In function 'main': main.c:10:27: error: expected expression before 'double' 10 | r = x3 / (2*sin(double a)); | ^~~~~~
s232352108
p00010
C
#include <iostream> #include <complex> #include <cmath> using namespace std; // ?????§?¨?????????¨?????? typedef complex<double> P; // ??????????? #define PI 3.1415926535898 // ?¨±????????????????? #define EPS (1e-10) //XY??§?¨? #define X real() #define Y imag() //?????????double????????°??????????????????????????? bool equal(double a, double b) { return (abs(a - b) < EPS) ? true : false; } // ????§???¢????????? class Triangle { private: //????§???¢??????????????§?¨? P a, b, c; //????§???¢?????????????????? double edgeA, edgeB, edgeC; //????§???¢???????§??????§??????(????????¢???) double angleA, angleB, angleC; //????????????????????????????§????????±?????????¢??° double LawOfCosines(double a, double b, double c) { return acos((b*b + c*c - a*a) / (2.0*b*c)); } public: //?????????????????????(??????????????¨?????¨?§????????????????) Triangle(P p1, P p2, P p3) { a = p1; b = p2; c = p3; edgeB = abs(c - a); edgeA = abs(b - c); edgeC = abs(a - b); angleA = LawOfCosines(edgeA, edgeB, edgeC); angleB = LawOfCosines(edgeB, edgeC, edgeA); angleC = LawOfCosines(edgeC, edgeA, edgeB); } double getAngleC() {//?§?C????§???????????????? return angleC; } }; int main() { double x1, x2, x3, y1, y2, y3, xp, yp, angle; while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) { P a(x1, y1); P b(x2, y2); P c(x3, y3); P p(xp, yp); Triangle Tr1(a, b, p); Triangle Tr2(b, c, p); Triangle Tr3(c, a, p); angle = Tr1.getAngleC() + Tr2.getAngleC() + Tr3.getAngleC(); (equal(2.0*PI, angle)) ? cout << "YES" : cout << "NO"; cout << endl; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s727646528
p00010
C
#include <iostream> #include <complex> #include <cmath> using namespace std; // ?????§?¨?????????¨?????? typedef complex<double> P; // ??????????? #define PI 3.1415926535898 // ?¨±????????????????? #define EPS (1e-10) //XY??§?¨? #define X real() #define Y imag() //?????????double????????°??????????????????????????? bool equal(double a, double b) { return (abs(a - b) < EPS) ? true : false; } // ????§???¢????????? class Triangle { private: //????§???¢??????????????§?¨? P a, b, c; //????§???¢?????????????????? double edgeA, edgeB, edgeC; //????§???¢???????§??????§??????(????????¢???) double angleA, angleB, angleC; //????????????????????????????§????????±?????????¢??° double LawOfCosines(double a, double b, double c) { return acos((b*b + c*c - a*a) / (2.0*b*c)); } public: //?????????????????????(??????????????¨?????¨?§????????????????) Triangle(P p1, P p2, P p3) { a = p1; b = p2; c = p3; edgeB = abs(c - a); edgeA = abs(b - c); edgeC = abs(a - b); angleA = LawOfCosines(edgeA, edgeB, edgeC); angleB = LawOfCosines(edgeB, edgeC, edgeA); angleC = LawOfCosines(edgeC, edgeA, edgeB); } double getAngleC() {//?§?C????§???????????????? return angleC; } }; int main() { double x1, x2, x3, y1, y2, y3, xp, yp, angle; while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) { P a(x1, y1); P b(x2, y2); P c(x3, y3); P p(xp, yp); Triangle Tr1(a, b, p); Triangle Tr2(b, c, p); Triangle Tr3(c, a, p); angle = Tr1.getAngleC() + Tr2.getAngleC() + Tr3.getAngleC(); (equal(2.0*PI, angle)) ? cout << "YES" : cout << "NO"; cout << endl; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s051507623
p00010
C
#include<stdio.h> #include<math.h> int main(); double sq(double); int main(){ double x1,x2,x3,y1,y2,y3,a1,b1,c1,a2,b2,c2,x,y,r; int n; scanf("%d\n", &n); for(int i = 0;i < n;i++){ scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); a1 = 2 * (x2 - x1); b1 = 2 * (y2 - y1); c1 = sq(x1) - sq(x2) + sq(y1) - sq(y2); a2 = 2 * (x3 - x1); b2 = 2 * (y3 - y1); c2 = sq(x1) - sq(x3) + sq(y1) - sq(y3); x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); r = hypot(fabs(x - x1), fabs(y - y1)); printf("%.3lf %.3lf %.3lf", x, y, r); } return 0; } double sq(double x){ return pow(x, 2); }
/usr/bin/ld: /tmp/ccjfcf6f.o: in function `main': main.c:(.text+0x281): undefined reference to `hypot' /usr/bin/ld: /tmp/ccjfcf6f.o: in function `sq': main.c:(.text+0x2fe): undefined reference to `pow' collect2: error: ld returned 1 exit status
s201393106
p00010
C
#include <stdio.h> #include <math.h> int main() { int i, n; double x1, x2, x3, y1, y2, y3; double a, b, c, d, e, f; double X1, Y1, r; scanf("%d", &n); for (i = 0; i < n; i++){ scanf("%lf %lf %lf %lf %lf %lf",&x1, &y1, &x2, &y2, &x3, &y3); a = 2 * (x2 - x1); b = 2 * (y2 - y1); c = x1*x1 - x2*x2 + y1*y1 - y2*y2; d = 2 * (x3 - x1); e = 2 * (y3 - y1); f = x1*x1 - x3*x3 + y1*y1 - y3*y3; X1 = (b*f - e*c) / (a*e - d*b); Y1 = (c*d - f*a) / (a*d - d*b); r = sqrt((X1-x1)*(X1-x1) + (Y1-y1)*(Y1-y1)); X1 *= 1000; Y1 *= 1000; r *= 1000; px = round(px); py = round(py); r = round(r); px = px / 1000; py = py / 1000; r = r / 1000; if(fabs(px) < 1e-6) px = 0; if(fabs(py) < 1e-6) py = 0; if(fabs(r) < 1e-6) r = 0; printf("%.3f %.3f %.3f\n", X1, Y1, r); } return 0; }
main.c: In function 'main': main.c:29:9: error: 'px' undeclared (first use in this function) 29 | px = round(px); | ^~ main.c:29:9: note: each undeclared identifier is reported only once for each function it appears in main.c:30:9: error: 'py' undeclared (first use in this function) 30 | py = round(py); | ^~
s340871840
p00010
C
#include <stdio.h> #include <math.h> int main() { int n; int i; double x1, x2, x3, y1, y2, y3, px, py, r; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3); px = ((y2 - y1) * (y2 - y1) * (y3 - y2) + x1 * (x2 - x1) - x2 * (x3 - x2) * (y2 - y1)) / ((y3 - y2) * (x2 - x1) - (y2 - y1) * (x3 - x2)); py = ((x2 - x1) / (y2 - y1)) * px + (y1 * (y2 - y1) - x1 * (x2 - x1)) / (y2 - y1); r = sqrt((px - x1) * (px - x1) + (py - y1) * (py - y1)) printf("%lf %lf %lf", px, py, r); } }
main.c: In function 'main': main.c:18:60: error: expected ';' before 'printf' 18 | r = sqrt((px - x1) * (px - x1) + (py - y1) * (py - y1)) | ^ | ; 19 | 20 | printf("%lf %lf %lf", px, py, r); | ~~~~~~
s228963392
p00010
C
#include <stdio.h> #include <math.h> int main() { int n; int i; double x1, x2, x3, y1, y2, y3, px, py, r; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); px = ((y2 - y3)*(x1*x1 + y1*y1) + (y3 - y1)*(x2*x2 + y2*y2) + (y1 - y2)*(x3*x3 + y3*y3))/(2*(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2))); py = ((x2 - x3)*(x1*x1 + y1*y1) + (x3 - x1)*(x2*x2 + y2*y2) + (x1 - x2)*(x3*x3 + y3*y3))/(2*(y1*(x2 - x3) + y2*(x3 - x1) + y3*(x1 - x2))); r = sqrt(pow((px - x1), 2), pow((py - y1), 2)); printf("%.3lf %.3lf %.3lf", px, py, r); } }
main.c: In function 'main': main.c:19:9: error: too many arguments to function 'sqrt' 19 | r = sqrt(pow((px - x1), 2), pow((py - y1), 2)); | ^~~~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: declared here 176 | __MATHCALL (sqrt,, (_Mdouble_ __x)); | ^~~~~~~~~~
s433261318
p00010
C
#include<stdio.h> #include <math.h> double ceil2(double dIn, int nLen) { double dOut; dOut = dIn * pow(10.0, nLen); dOut = (double)(int)(dOut + 0.9); return dOut * pow(10.0, -nLen); } int main(void) { double x1[20], x2[20], x3[20], y1[20], y2[20], y3[20]; double distance_12[20],distance_23[20],distance_31[20]; int n = 0,i=0; double cosA,sinA,r,p,q; do { scanf("%d",&n); } while (n > 20); do { scanf_s("%lf%lf%lf%lf%lf%lf",&x1[i],&y1[i],&x2[i],&y2[i],&x3[i],&y3[i]); i++; } while ((-100 <= (x1[i], x2[i], x3[i], y1[i], y2[i], y3[i]) && 100 >= (x1[i], x2[i], x3[i], y1[i], y2[i], y3[i])) && i < n); for (i = 0; i < n; i++) { distance_12[i] = sqrt(pow(x1[i] - x2[i], 2) + pow(y1[i] - y2[i], 2)); distance_23[i] = sqrt(pow(x2[i] - x3[i], 2) + pow(y2[i] - y3[i], 2)); distance_31[i] = sqrt(pow(x3[i] - x1[i], 2) + pow(y3[i] - y1[i], 2)); } for (i = 0; i < n; i++) { p = ((y1[i] - y3[i])*(pow(y1[i],2) - pow(y2[i],2) + pow(x1[i],2) - pow(x2[i],2)) - (y1[i] - y2[i])*(pow(y1[i],2) - pow(y3[i],2) + pow(x1[i],2) - pow(x3[i],2))) / (2*(y1[i] - y3[i])*(x1[i] - x2[i]) - 2*(y1[i] - y2[i])*(x1[i] - x3[i])); q = ((x1[i] - x3[i])*(pow(x1[i],2) - pow(x2[i],2) + pow(y1[i],2) - pow(y2[i],2)) - (x1[i] - x2[i])*(pow(x1[i], 2) - pow(x3[i], 2) + pow(y1[i], 2) - pow(y3[i], 2))) / (2 * (x1[i] - x3[i])*(y1[i] - y2[i]) - 2 * (x1[i] - x2[i])*(y1[i] - y3[i])); cosA = (pow(distance_23[i], 2) + pow(distance_31[i], 2) - pow(distance_12[i], 2))/(2*distance_23[i]*distance_31[i]); sinA = sqrt(1 - pow(cosA, 2)); r = distance_12[i] / (sinA * 2); printf("%.3lf %.3lf %.3lf\n",ceil2(p,4),ceil2(q,4),ceil2(r,4)); } return 0; }
main.c: In function 'main': main.c:26:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 26 | scanf_s("%lf%lf%lf%lf%lf%lf",&x1[i],&y1[i],&x2[i],&y2[i],&x3[i],&y3[i]); | ^~~~~~~ | scanf
s143758283
p00010
C
#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> #include <string> #include <cctype> #include <stack> #include <queue> #include <vector> #include <cstdlib> #include <list> #define _USE_MATH_DEFINES #include <math.h> using namespace std; int main() { int n; double x1, x2, x3, y1, y2, y3; double X, Y, R; double a, b, c, d, e, f; cin >> n; for (int i = 0; i < n; i++) { //cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); a = -x2 + x3; b = -x1*x1 + x2*x2 - y1*y1 + y2*y2; c = x1 - x2; d = -x2*x2 + x3*x3 - y2*y2 + y3*y3; e = -c * 2 * (y2 - y3); f = a * 2 * (y1 - y2); Y = (a*b + c*d) / (e - f); X = (b+2*Y*(y1-y2))/(-2*c); R = sqrt((X - x1)*(X - x1) + (Y-y1)*(Y-y1)); if (X > 0) X = (int)(X * 1000 + 0.5) ; else X = (int)(X * 1000 - 0.5) ; if (Y>0) Y = (int)(Y * 1000 + 0.5) ; else Y = (int)(Y * 1000 - 0.5) ; if (R > 0) R = (int)(R * 1000 + 0.5); else R = (int)(R * 1000 - 0.5); printf("%.3f %.3f %.3f\n", X/1000, Y/1000, R/1000); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s383138205
p00010
C
#include<stdio.h> #include<math.h> struct Zahyou { float x, y; }; int main() { int n; Zahyou de[4]; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 1; j < 4; j++) { scanf("%f %f", &de[j].x, &de[j].y); } de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); de[0].y = ((de[1].x - de[3].x)*(pow(de[1].x, 2) - pow(de[2].x, 2) + pow(de[1].y, 2) - pow(de[2].y, 2)) + (de[1].x - de[2].y)*(pow(de[1].x, 2) - pow(de[3].x, 2) + pow(de[1].y, 2) - pow(de[3].y, 2))) / (2 * (de[1].x - de[3].x)*(de[1].y - de[2].y) + 2 * (de[1].x - de[2].x)*(de[1].y - de[3].y)); printf("%.3f %.3f %.3f\n",de[0].x,de[0].y,sqrt(de[0].x+de[0].y)); } return 0; }
main.c: In function 'main': main.c:12:9: error: unknown type name 'Zahyou'; use 'struct' keyword to refer to the type 12 | Zahyou de[4]; | ^~~~~~ | struct main.c:19:46: error: request for member 'x' in something not a structure or union 19 | scanf("%f %f", &de[j].x, &de[j].y); | ^ main.c:19:56: error: request for member 'y' in something not a structure or union 19 | scanf("%f %f", &de[j].x, &de[j].y); | ^ main.c:21:22: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:34: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:44: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:58: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:76: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:94: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:112: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:128: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:138: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:152: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:170: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:188: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:206: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:228: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:238: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:248: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:258: error: request for member 'x' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x)); | ^ main.c:21:274: error: request for member 'y' in something not a structure or union 21 | de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2)
s744264155
p00010
C
#include <stdio.h> #include <math.h> int main(void) { int n; int i; double x1, y1, x2, y2, x3, y3; double a, b, c, d, e, f; double px, py, r; scanf("%d",&n); for(int i=0; i<n; i++) { scanf("%lf%lf%lf%lf%lf%lf",&x1, &y1, &x2, &y2, &x3, &y3); a = 2 * (x1 -x2); b = 2 * (y1 -y2); c = 2 * (x1 -x3); d = 2 * (y1 -y3); e = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; f = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3; px = (d * e - b * f) / (a * d - b * c); py = (a * f - c * e) / (a * d - b * c); r = sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py)); printf("%.3f %.3f %.3f\n", px, py, r); } return 0; }
/usr/bin/ld: /tmp/ccs8FBPB.o: in function `main': main.c:(.text+0x22b): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
s677445629
p00010
C
#include <stdio.h> #include <math.h> int main(void) { int n; int i; double x1, y1, x2, y2, x3, y3; double a, b, c, d, e, f; double px, py, r; scanf("%d",&n); for(int i=0; i<n; i++) { scanf("%lf%lf%lf%lf%lf%lf",&x1, &y1, &x2, &y2, &x3, &y3); a = 2 * (x1 -x2); b = 2 * (y1 -y2); c = 2 * (x1 -x3); d = 2 * (y1 -y3); e = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; f = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3; px = (d * e - b * f) / (a * d - b * c); py = (a * f - c * e) / (a * d - b * c); r = sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py)); printf("%.3f %.3f %.3f\n", px, py, r); } return 0; }
/usr/bin/ld: /tmp/cccXuRB2.o: in function `main': main.c:(.text+0x22b): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
s410975642
p00010
C
#include<iostream> #include<cstdio> #include<cmath> using namespace std; int main(){ double a,b,c,d,e,f,x,y,A,B,C,s,r; int n; cin >> n ; for(int i=0;i<n;i++){ cin >> a >> b >> c >> d >> e >> f; C = (a-c)*(a-c)+(b-d)*(b-d); A = (c-e)*(c-e)+(d-f)*(d-f); B = (e-a)*(e-a)+(f-b)*(f-b); s = 2*(A*B+B*C+C*A)-(A*A+B*B+C*C); x = (A*(B+C-A)*a+B*(C+A-B)*c+C*(A+B-C)*e)/s; y = (A*(B+C-A)*b+B*(C+A-B)*d+C*(A+B-C)*f)/s; A = sqrt(A); B = sqrt(B); C = sqrt(C); r = A*B*C/sqrt((A+B+C)*(B+C-A)*(A-B+C)*(A+B-C)); printf("%.3lf %.3lf %.3lf\n",x,y,r); } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s458028865
p00010
C
#include<stdio.h> #include<math.h> int main(void){ int n, i; double minx, miny, xy1, xy2, xy3, x1, x2, x3, y1, y2, y3, X, Y, r; scanf("%d", &n); for ( i = 0; i < n; i++ ) { scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); minx = x1; miny = y1; if ( x2 < minx ) minx = x2; if ( x3 < minx ) minx = x3; if ( y2 < miny ) miny = y2; if ( y3 < miny ) miny = y2; minx *= 100000; miny *= 100000; x1 *= 100000; x2 *= 100000; x3 *= 100000; y1 *= 100000; y2 *= 100000; y3 *= 100000; while ( 1 ) { X = minx * 100000; Y = miny * 100000; xy1 = ( X - x1 ) * ( X - x1 ) + ( Y - y1 ) * ( Y - y1 ); xy2 = ( X - x2 ) * ( X - x2 ) + ( Y - y2 ) * ( Y - y2 ); xy3 = ( X - x3 ) * ( X - x3 ) + ( Y - y3 ) * ( Y - y3 ); r = sqrt(xy1); if ( xy1 == xy2 && xy2 == xy3 && xy3 == xy1) { printf("%.3lf %.3lf %.3lf\n", X / 100000, Y / 100000, r); break; } X++; Y++ } } return 0; }
main.c: In function 'main': main.c:35:13: error: expected ';' before '}' token 35 | Y++ | ^ | ; 36 | } | ~
s589137415
p00010
C
#include <stdio.h> #include <math.h> int main(void){ double Px,Py,r; double x1,y1,x2,y2,x3,y3; double a1,b1,c1,a2,b2,c2; int n,i; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3); a1=2*(x1-x2); b1=2*(y1-y2); c1=(x1*x1*)-(x2*x2)+(y1*y1)-(y2*y2); a2=2*(x1-x3); b2=2*(y1-y3); c2=(x1*x1*)-(x3*x3)+(y1*y1)-(y3*y3); Px=((b2*c1)-(b1*c2))/((a1*b2)-(a2*b1)); Py=((a1*c2)-(a2*c1))/((a1*b2)-(a2*b1)); r=sqrt((x1-Px)*(x1-Px)+(y1-Py)*(y1-Py)); printf("%lf %lf %lf\n",Px,Py,r); Px=(int)(Px*1000+0.5); Py=(int)(Py*1000+0.5); r=(int)(r*1000+0.5); printf("%.3lf %.3lf %.3lf\n",((double)Px)/1000,((double)Py)/1000,((double)r)/1000); } return 0; }
main.c: In function 'main': main.c:16:18: error: expected expression before ')' token 16 | c1=(x1*x1*)-(x2*x2)+(y1*y1)-(y2*y2); | ^ main.c:19:18: error: expected expression before ')' token 19 | c2=(x1*x1*)-(x3*x3)+(y1*y1)-(y3*y3); | ^
s141925855
p00010
C
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 0; i < n; i++) { double x1 = sc.nextDouble(); double y1 = sc.nextDouble(); double x2 = sc.nextDouble(); double y2 = sc.nextDouble(); double x3 = sc.nextDouble(); double y3 = sc.nextDouble(); double a = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); double b = Math.sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)); double c = Math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)); double s = (a+b+c)/2; double r = a*b*c / (4*Math.sqrt(s*(s-a)*(s-b)*(s-c))); double A1 = 2*(x2-x1); double B1 = 2*(y2-y1); double C1 = (x1*x1)-(x2*x2)+(y1*y1)-(y2*y2); double A2 = 2*(x3-x1); double B2 = 2*(y3-y1); double C2 = (x1*x1)-(x3*x3)+(y1*y1)-(y3*y3); double X = (B1*C2-B2*C1)/(A1*B2-A2*B1); double Y = (C1*A2-C2*A1)/(A1*B2-A2*B1); System.out.printf("%.3f %.3f %.3f\n",X,Y,r); } } public static double sr(double a) { a = a*10000; if(a%10 >= 5) { a += 10-a%10; } else { a -= a%10; } int b = (int)a; return (b/10000.0); } }
main.c:1:1: error: unknown type name 'import' 1 | import java.util.Scanner; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.util.Scanner; | ^ main.c:3:1: error: unknown type name 'public' 3 | public class Main { | ^~~~~~ main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main' 3 | public class Main { | ^~~~
s672591750
p00010
C
#include <iostream> #include <iomanip> #include <cmath> #include <vector> using namespace std; #define N 10000 #define INF 200000000 int main() { int n; vector<double> x(3), y(3), x2(3), y2(3); cin >> n; for(int p=0; p<n; p++) { cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2]; for(int i=0; i<3; i++) { x2[i] = x[i]*x[i]; y2[i] = y[i]*y[i]; } double a, b, c, a2, b2, c2; a2 = abs((x[2]-x[1])*(x[2]-x[1]) + (y[2]-y[1])*(y[2]-y[1])); b2 = abs((x[0]-x[2])*(x[0]-x[2]) + (y[0]-y[2])*(y[0]-y[2])); c2 = abs((x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0])); a = sqrt(a2); b = sqrt(b2); c = sqrt(c2); double s, S2; s = (a + b + c) / 2; S2 = s * (s-a) * (s-b) * (s-c); double cx, cy; cx = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2); cy = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2); cout << setprecision(3) << fixed << cx << " " << cy << " " << sqrt(abs((cx-x[0])*(cx-x[0])+(cy-y[0])*(cy-y[0]))) << endl; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s217252806
p00010
C
#include<complex> #define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c) void main(){typedef double D;int n;D d,e,f,g,h,i;for(scanf("%d",&n);n--;){scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);std::complex<D> a(d,g),b(e,h),c(f,i);D A=abs(b-c),B=abs(c-a),C=abs(a-b),L=F(A,B,C),s=sin(2*L),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(L)/2);}}
main.c:1:9: fatal error: complex: No such file or directory 1 | #include<complex> | ^~~~~~~~~ compilation terminated.
s577080487
p00010
C
#include<complex> #include<stdio.h> #define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c) int main(){typedef double D;int n;D d,e,f,g,h,i;for(scanf("%d",&n);n--;){scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);std::complex<D> a(d,g),b(e,h),c(f,i);D A=abs(b-c),B=abs(c-a),C=abs(a-b),L=F(A,B,C),s=sin(2*L),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(L)/2);}}
main.c:1:9: fatal error: complex: No such file or directory 1 | #include<complex> | ^~~~~~~~~ compilation terminated.