submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s990548050
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
#include <stdlib>
using namespace std;
double get_num(double x){
x = x * 1000;
if(x >= 0){
x = (int)(x + 0.5);
return ((double)x / 1000);
} else {
x = (int)(x - 0.5);
return ((double)x / 1000);
}
}
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++){
double x1, y1;
double x2, y2;
double x3, y3;
double m12x, m12y;
double m13x, m13y;
double dx12, dy12;
double dx13, dy13;
double c12, c13;
double xp, yp;
double r;
cin >> x1 >> y1 >> x2
>> y2 >> x3 >> y3;
m12x = (x1 + x2) / 2;
m12y = (y1 + y2) / 2;
m13x = (x1 + x3) / 2;
m13y = (y1 + y3) / 2;
dx12 = x2 - x1;
dy12 = y2 - y1;
dx13 = x3 - x1;
dy13 = y3 - y1;
c12 = m12x * dx12 + m12y * dy12;
c13 = m13x * dx13 + m13y * dy13;
yp = (c12 * dx13 - c13 * dx12) / (dy12 * dx13 - dy13 * dx12);
if(dx12 == 0){
xp = (c13 - (dy13 * yp)) / dx13;
}else{
xp = (c12 - (dy12 * yp)) / dx12;
}
r = sqrt((xp - x1) * (xp - x1) + ((yp - y1) * (yp - y1)));
xp = get_num(xp);
yp = get_num(yp);
r = get_num(r);
cout << fixed << setprecision(3) << xp << " " << yp << " " << r << endl;
}
return 0;
}
|
a.cc:3:10: fatal error: stdlib: No such file or directory
3 | #include <stdlib>
| ^~~~~~~~
compilation terminated.
|
s891051649
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
using namespace std;
double get_num(double x){
x = x * 1000;
if(x >= 0){
x = (int)(x + 0.5);
return ((double)x / 1000);
} else {
x = (int)(x - 0.5);
return ((double)x / 1000);
}
}
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++){
double x1, y1;
double x2, y2;
double x3, y3;
double m12x, m12y;
double m13x, m13y;
double dx12, dy12;
double dx13, dy13;
double c12, c13;
double xp, yp;
double r;
cin >> x1 >> y1 >> x2
>> y2 >> x3 >> y3;
m12x = (x1 + x2) / 2;
m12y = (y1 + y2) / 2;
m13x = (x1 + x3) / 2;
m13y = (y1 + y3) / 2;
dx12 = x2 - x1;
dy12 = y2 - y1;
dx13 = x3 - x1;
dy13 = y3 - y1;
c12 = m12x * dx12 + m12y * dy12;
c13 = m13x * dx13 + m13y * dy13;
yp = (c12 * dx13 - c13 * dx12) / (dy12 * dx13 - dy13 * dx12);
if(dx12 == 0){
xp = (c13 - (dy13 * yp)) / dx13;
}else{
xp = (c12 - (dy12 * yp)) / dx12;
}
r = sqrt((xp - x1) * (xp - x1) + ((yp - y1) * (yp - y1)));
xp = get_num(xp);
yp = get_num(yp);
r = get_num(r);
cout << fixed << setprecision(3) << xp << " " << yp << " " << r << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:49:21: error: 'sqrt' was not declared in this scope
49 | r = sqrt((xp - x1) * (xp - x1) + ((yp - y1) * (yp - y1)));
| ^~~~
|
s777198687
|
p00010
|
C++
|
#include <iostream>
#include <cstdlib>
#include <numeric>
#include <iomanip>
using namespace std;
double get_num(double x){
x = x * 1000;
if(x >= 0){
x = (int)(x + 0.5);
return ((double)x / 1000);
} else {
x = (int)(x - 0.5);
return ((double)x / 1000);
}
};
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++){
double x1, y1;
double x2, y2;
double x3, y3;
double m12x, m12y;
double m13x, m13y;
double dx12, dy12;
double dx13, dy13;
double c12, c13;
double xp, yp;
double r;
cin >> x1 >> y1 >> x2
>> y2 >> x3 >> y3;
m12x = (x1 + x2) / 2;
m12y = (y1 + y2) / 2;
m13x = (x1 + x3) / 2;
m13y = (y1 + y3) / 2;
dx12 = x2 - x1;
dy12 = y2 - y1;
dx13 = x3 - x1;
dy13 = y3 - y1;
c12 = m12x * dx12 + m12y * dy12;
c13 = m13x * dx13 + m13y * dy13;
yp = (c12 * dx13 - c13 * dx12) / (dy12 * dx13 - dy13 * dx12);
if(dx12 == 0){
xp = (c13 - (dy13 * yp)) / dx13;
}else{
xp = (c12 - (dy12 * yp)) / dx12;
}
r = sqrt((xp - x1) * (xp - x1) + ((yp - y1) * (yp - y1)));
xp = get_num(xp);
yp = get_num(yp);
r = get_num(r);
cout << fixed << setprecision(3) << xp << " " << yp << " " << r << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:51:21: error: 'sqrt' was not declared in this scope
51 | r = sqrt((xp - x1) * (xp - x1) + ((yp - y1) * (yp - y1)));
| ^~~~
|
s232000456
|
p00010
|
C++
|
#define EPS 1e-10
using namespace std;
typedef complex<double> P;
double cross(P a, P b){
return (a.real()*b.imag() - a.imag()*b.real());
}
int main()
{
int i,j;
int n;
P point[3],ans;
cin >> n;
for(i=0;i<n;i++){
for(j=0;j<3;j++){
cin >> point[j].real() >> point[j].imag();
}
P p01 = point[0] + point[1];
P p12 = point[1] + point[2];
P h01 = P(p01.real()/2 , p01.imag()/2);
P h12 = P(p12.real()/2 , p12.imag()/2);
P n1 = (point[0] - h01) * P(0,1) + h01;
P n2 = (point[1] - h12) * P(0,1) + h12;
ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
}
return 0;
}
|
a.cc:4:9: error: 'complex' does not name a type
4 | typedef complex<double> P;
| ^~~~~~~
a.cc:6:14: error: 'P' was not declared in this scope
6 | double cross(P a, P b){
| ^
a.cc:6:19: error: 'P' was not declared in this scope
6 | double cross(P a, P b){
| ^
a.cc:6:22: error: expression list treated as compound expression in initializer [-fpermissive]
6 | double cross(P a, P b){
| ^
a.cc: In function 'int main()':
a.cc:14:3: error: 'P' was not declared in this scope
14 | P point[3],ans;
| ^
a.cc:16:3: error: 'cin' was not declared in this scope
16 | cin >> n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #define EPS 1e-10
a.cc:20:14: error: 'point' was not declared in this scope; did you mean 'int'?
20 | cin >> point[j].real() >> point[j].imag();
| ^~~~~
| int
a.cc:23:6: error: expected ';' before 'p01'
23 | P p01 = point[0] + point[1];
| ^~~~
| ;
a.cc:24:6: error: expected ';' before 'p12'
24 | P p12 = point[1] + point[2];
| ^~~~
| ;
a.cc:25:6: error: expected ';' before 'h01'
25 | P h01 = P(p01.real()/2 , p01.imag()/2);
| ^~~~
| ;
a.cc:26:6: error: expected ';' before 'h12'
26 | P h12 = P(p12.real()/2 , p12.imag()/2);
| ^~~~
| ;
a.cc:27:6: error: expected ';' before 'n1'
27 | P n1 = (point[0] - h01) * P(0,1) + h01;
| ^~~
| ;
a.cc:28:6: error: expected ';' before 'n2'
28 | P n2 = (point[1] - h12) * P(0,1) + h12;
| ^~~
| ;
a.cc:30:5: error: 'ans' was not declared in this scope
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^~~
a.cc:30:11: error: 'n1' was not declared in this scope; did you mean 'n'?
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^~
| n
a.cc:30:17: error: 'h01' was not declared in this scope
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^~~
a.cc:30:33: error: 'h12' was not declared in this scope
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^~~
a.cc:30:37: error: 'n2' was not declared in this scope; did you mean 'n'?
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^~
| n
a.cc:30:45: error: 'cross' cannot be used as a function
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^
a.cc:30:68: error: 'cross' cannot be used as a function
30 | ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);
| ^
a.cc:33:34: error: 'real' was not declared in this scope
33 | printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
| ^~~~
a.cc:33:50: error: 'imag' was not declared in this scope
33 | printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
| ^~~~
a.cc:33:70: error: 'point' was not declared in this scope; did you mean 'int'?
33 | printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
| ^~~~~
| int
a.cc:33:66: error: 'abs' was not declared in this scope
33 | printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
| ^~~
a.cc:33:5: error: 'printf' was not declared in this scope
33 | printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define EPS 1e-10
|
s833341701
|
p00010
|
C++
|
#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;
#define EPS 1.0e-6
const double EPS = 1e-7;
typedef complex<double> P; /* _ */
struct L { /* üª */
P p, q;
L(P p, P q) : p(p), q(q) {}
};
double cross(P a, P b) { return imag(conj(a)*b); }
// ¼üaƼübÌð_ðvZ·éDæÉð·»èªK{D
P crossPointLL(L a, L b){
double A = cross(a.q-a.p, b.q-b.p);
double B = cross(a.q-a.p, a.q-b.p);
return b.p + B/A * (b.q-b.p);
}
// _pÆ_q̼ñªüðÔ·
L pointBisector(P p, P q) {
P cen = (p+q)*0.5;
return L(cen, cen+(q-p)*P(0,1));
}
int main(){
int n;
cin>>n;
double x1, y1, x2, y2, x3, y3;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3){
// Cuè@
P p1 = P(x1, y1);
P p2 = P(x2, y2);
P p3 = P(x3, y3);
L l1 = pointBisector(p1, p2);
L l2 = pointBisector(p2, p3);
P cen = crossPointLL(l1, l2);
double r = abs(p1-cen);
// Êè@
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 cx = (b1*c2-b2*c1)/(a1*b2-a2*b1);
double cy = (c1*a2-c2*a1)/(a1*b2-a2*b1);
P cen2 = P(cx, cy);
double r2 = abs(p1-cen2);
// ÜÆß
int x1000 = 1000*cen2.real()+0.5;
int y1000 = 1000*cen2.imag()+0.5;
int r1000 = 1000*r2+0.5;
printf("%.3f %.3f %.3f", 1.0*x1000/1000+EPS, 1.0*y1000/1000+EPS, 1.0*r1000/1000+EPS);
cout<<endl;
}
return 0;
}
|
a.cc:8:13: error: expected unqualified-id before numeric constant
8 | #define EPS 1.0e-6
| ^~~~~~
a.cc:10:14: note: in expansion of macro 'EPS'
10 | const double EPS = 1e-7;
| ^~~
|
s344408154
|
p00010
|
C++
|
#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> P; /* ツ点 */
int main(){
int n;
cin>>n;
double x1, y1, x2, y2, x3, y3;
while(cin>>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 cx = (b1*c2-b2*c1)/(a1*b2-a2*b1);
double cy = (c1*a2-c2*a1)/(a1*b2-a2*b1);
P cen2 = P(cx, cy);
double r2 = abs(p1-cen2);
printf("%.3f %.3f %.3f\n", real(cen2), imag(cen2), r2);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:33: error: 'p1' was not declared in this scope; did you mean 'c1'?
24 | double r2 = abs(p1-cen2);
| ^~
| c1
|
s996806005
|
p00010
|
C++
|
#include <stdio.h>
int main(void){
int n , i;
float x1,x2,x3,y1,y2,y3,a1,a2,b1,b2,c1,c2,xp,yp,r;
scanf("%d" , &n);
for(i=1;i<=n;i++){
scanf("%f %f %f %f %f %f" , &x1 , &y1 , &x2 , &y2 , &x3 , &y3);
a1 = 2 * (x2 - x1);
b1 = 2 * (y2 - y1);
c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
a2 = 2 * (x3 - y1);
b2 = 2 * (y3 - y1);
c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
yp = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
r = sqrt((xp - x1) * (xp - x1) + (yp - y1) * (yp - y1));
printf("%.3f %.3f %.3f\n" , xp , yp , r);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:21: error: 'sqrt' was not declared in this scope
17 | r = sqrt((xp - x1) * (xp - x1) + (yp - y1) * (yp - y1));
| ^~~~
|
s644300015
|
p00010
|
C++
|
/*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
*/
void solve(double a, double b, double c, double d, double e, double f) {
double px,py,r;
// ¼ñªüñÂÌð_ y-y1 = y2-y1 / x2-x1 * x-x1 -> y2-y1=a, x2-x1=b, y = a/b*x - a/b*x1-y1 -> y = -b/a*x + c
double sl1 = -1*(c-a)/(d-b); // (x1, y1)-(x2, y2)̼ñªüÌX«
double sl2 = -1*(e-c)/(f-d); // (x2, y2)-(x3, y3)̼ñªüÌX«
double mid1x = (a+c)/2; double mid1y = (b+d)/2;
double mid2x = (c+e)/2; double mid2y = (d+f)/2;
double t1 = mid1y-sl1*mid1x;
double t2 = mid2y-sl2*mid2x;
// y = sl1*x - t1 Æ y = sl2*x - t2 ðA§B -> sl1*x - t1 = sl2*x - t2 -> (sl1-sl2)*x = t1 - t2
px = (t1-t2)/(sl1-sl2);
py = sl1*px - t1;
r = sqr(px,py,a,b);
printf("%4.3f %4.3f %4.3f",px,py,r);
}
double sqr(double a, double b, double c, double d) {
// ñÂÌ_Ì£ðßé\bh
double s = sqrt(pow(max(a,c)-min(a,c), 2) + pow(max(b,d)-min(b,d), 2));
return s;
}
int main() {
int n; cin >> n;
double x1, y1, x2, y2, x3, y3;
for (int i=0; i<n; i++) {
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
solve(x1,y1,x2,y2,x3,y3);
}
return 0;
}
|
a.cc: In function 'void solve(double, double, double, double, double, double)':
a.cc:17:13: error: 'sqr' was not declared in this scope
17 | r = sqr(px,py,a,b);
| ^~~
a.cc:18:9: error: 'printf' was not declared in this scope
18 | printf("%4.3f %4.3f %4.3f",px,py,r);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | /*
a.cc: In function 'double sqr(double, double, double, double)':
a.cc:23:29: error: 'max' was not declared in this scope
23 | double s = sqrt(pow(max(a,c)-min(a,c), 2) + pow(max(b,d)-min(b,d), 2));
| ^~~
a.cc:23:38: error: 'min' was not declared in this scope
23 | double s = sqrt(pow(max(a,c)-min(a,c), 2) + pow(max(b,d)-min(b,d), 2));
| ^~~
a.cc:23:25: error: 'pow' was not declared in this scope
23 | double s = sqrt(pow(max(a,c)-min(a,c), 2) + pow(max(b,d)-min(b,d), 2));
| ^~~
a.cc:23:20: error: 'sqrt' was not declared in this scope; did you mean 'sqr'?
23 | double s = sqrt(pow(max(a,c)-min(a,c), 2) + pow(max(b,d)-min(b,d), 2));
| ^~~~
| sqr
a.cc: In function 'int main()':
a.cc:28:16: error: 'cin' was not declared in this scope
28 | int n; cin >> n;
| ^~~
|
s759626902
|
p00010
|
C++
|
/*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;
/*
http://zo3kirin3.net/?p=297
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q104383420
http://www.nn.iij4u.or.jp/~hsat/misc/math/centre/circumcentre.html
*/
int main() {
int n; cin >> n;
vector<double> x(3), y(3), x2(3), y2(3); // x,yªÀWÌXgAx2,y2ªÀWÌñæÌXg
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] = pow(x[i], 2);
y2[i] = pow(y[i], 2);
}
// eÓÌ·³ðßéBO½ûÌèðp
double a, b, c, a2, b2, c2;
a2 = abs(pow(x[2]-x[1], 2) + pow(y[2]-y[1], 2));
b2 = abs(pow(x[0]-x[2], 2) + pow(y[0]-y[2], 2));
c2 = abs(pow(x[1]-x[0], 2) + pow(y[1]-y[0], 2));
a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
// ÊÏBwÌö®ðpB
double s, S2;
s = (a+b+c) / 2;
S2 = s*(s-a)*(s-b)*(s-c);
// OSðßéBö®ÍWeby[WðQÆ©xNgâÁÄÈ¢©çà¾Å«È¢c
double px, py;
px = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
py = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
// oÍB®`µÄoÍ·éB¼aͼüÌûö®ÅB
cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs(pow(px-x[0], 2)+pow(py-y[0], 2)) << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:47:113: error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'
47 | cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs(pow(px-x[0], 2)+pow(py-y[0], 2)) << endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
|
s520688385
|
p00010
|
C++
|
/*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;
/*
http://zo3kirin3.net/?p=297
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q104383420
http://www.nn.iij4u.or.jp/~hsat/misc/math/centre/circumcentre.html
*/
int main() {
int n; cin >> n;
vector<double> x(3), y(3), x2(3), y2(3); // x,yªÀWÌXgAx2,y2ªÀWÌñæÌXg
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] = pow(x[i], 2);
y2[i] = pow(y[i], 2);
}
// eÓÌ·³ðßéBO½ûÌèðp
double a, b, c, a2, b2, c2;
a2 = abs(pow(x[2]-x[1], 2) + pow(y[2]-y[1], 2));
b2 = abs(pow(x[0]-x[2], 2) + pow(y[0]-y[2], 2));
c2 = abs(pow(x[1]-x[0], 2) + pow(y[1]-y[0], 2));
a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
// ÊÏBwÌö®ðpB
double s, S2;
s = (a+b+c) / 2;
S2 = s*(s-a)*(s-b)*(s-c);
// OSðßéBö®ÍWeby[WðQÆ©xNgâÁÄÈ¢©çà¾Å«È¢c
double px, py;
px = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
py = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
// oÍB®`µÄoÍ·éB¼aͼüÌûö®ÅB
cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0])) << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:47:121: error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'
47 | cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0])) << endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
|
s430037822
|
p00010
|
C++
|
/*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;
/*
http://zo3kirin3.net/?p=297
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q104383420
http://www.nn.iij4u.or.jp/~hsat/misc/math/centre/circumcentre.html
*/
int main() {
int n; cin >> n;
vector<double> x(3), y(3), x2(3), y2(3); // x,yªÀWÌXgAx2,y2ªÀWÌñæÌXg
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];
}
// eÓÌ·³ðßéBO½ûÌèðp
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);
// ÊÏBwÌö®ðpB
double s, S2;
s = (a+b+c) / 2;
S2 = s*(s-a)*(s-b)*(s-c);
// OSðßéBö®ÍWeby[WðQÆ©xNgâÁÄÈ¢©çà¾Å«È¢c
double px, py;
px = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
py = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
// oÍB®`µÄoÍ·éB¼aͼüÌûö®ÅB
cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0])) << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:47:121: error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'
47 | cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0])) << endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
|
s008383391
|
p00010
|
C++
|
#include <stdio.h>
#include <math.h>
int main()
{
int setcount;
float x1, y1, x2, y2, x3, y3;
float nx1, ny1, nx2, ny2;
float nr1, nr2;
float xp, yp, r;
int tx, ty, tr, rem;
int i;
scanf("%d", &setcount);
for(i=0; i<setcount; i++){
scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
nx1=x2-x1; ny1=y2-y1;
nx2=x3-x1; ny2=y3-y1;
nr1=nx1^2+ny1^2; nr2=nx2^2+ny2^2;
nr1*=0.5f; nr2*=0.5f;
if(nx1==0){
nr1/=ny1; ny1=1.0f;
nr2-=nr1*ny2; ny2=0.0f;
nr2/=nx2; nx2=1.0f;
}
else {
//normalize
ny1/=nx1; nr1/=nx1; nx1=1.0f;
//subtraction
ny2-=ny1*nx2; nr2-=nr1*nx2; nx2=0.0f;
//normalize
nr2/=ny2; ny2=1.0f;
//subtraction
nr1-=nr2*ny1; ny1=0.0f;
}
printf("%.3f %.3f %.3f\n", xp, yp, r);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:12: error: invalid operands of types 'float' and 'float' to binary 'operator^'
19 | nr1=nx1^2+ny1^2; nr2=nx2^2+ny2^2;
| ~~~^~~~~~
| | |
| | float
| float
a.cc:19:29: error: invalid operands of types 'float' and 'float' to binary 'operator^'
19 | nr1=nx1^2+ny1^2; nr2=nx2^2+ny2^2;
| ~~~^~~~~~
| | |
| | float
| float
|
s809087809
|
p00010
|
C++
|
#include <stdio.h>
#include <math.h>
int main()
{
int setcount;
float x1, y1, x2, y2, x3, y3;
float nx1, ny1, nx2, ny2;
float nr1, nr2;
float xp, yp, r;
int tx, ty, tr, rem;
int i;
scanf("%d", &setcount);
for(i=0; i<setcount; i++){
xp=nr1+x1; yp=nr2+y1;
r=(float)sqrt((double)(nr1^2+nr2^2));
tx=xp*10000; ty=yp*10000; tr=r*10000;
if((rem=tx%10)<5) tx-=rem;
else tx+=10-rem;
if((rem=ty%10)<5) ty-=rem;
else ty+=10-rem;
if((rem=tr%10)<5) tr-=rem;
else tr+=10-rem;
xp=(float)tx*0.0001f; yp=(float)ty*0.0001f; r=(float)tr*0.0001f;
printf("%.3f %.3f %.3f\n", xp, yp, r);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:31: error: invalid operands of types 'float' and 'float' to binary 'operator^'
18 | r=(float)sqrt((double)(nr1^2+nr2^2));
| ~~~^~~~~~
| | |
| | float
| float
|
s705283983
|
p00010
|
C++
|
#include <iostream>
using namespace std;
int main()
{
int n;cin>>n;
for ( int i=0; i<n; i++ )
{
double x1,y1,x2,y2,x3,y3;
cin>>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);
// http://www.h6.dion.ne.jp/~jpe02_tn/ki-5.html
double r = sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
printf( "%.3f %.3f %.3f\n", x, y, r );
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:22:28: error: 'sqrt' was not declared in this scope
22 | double r = sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
| ^~~~
|
s704081952
|
p00010
|
C++
|
#include <iostream>
#include <cmath>
using namespace std;
#define reep(i, a, n) for(int i = a;i < n; i++)
#define rep(i, n) reep(i, 0, n)
double pow2(double in){
return in * in;
}
double distance(double x1, double y1, double x2, double y2){
return sqrt(pow2(y2 - y1) + pow2(x2 - x1));
}
int main(){
int n;
double x[3], y[3], a, b, cx, cy, r, X[2], Y[2], al, be, cal, ca, sa;
scanf("%d", &n);
rep(i, n){
rep(j, 3){
scanf("%lf %lf", &x[j], &y[j]);
}
ca = (pow2(distance(x[0], y[0], x[1], y[1]))
ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ + pow2(distance(x[1], y[1], x[2], y[2]))
ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ - pow2(distance(x[2], y[2], x[0], y[0])))
ツ ツ ツ ツ ツ / (2.0 * distance(x[0], y[0], x[1], y[1]) * distance(x[1], y[1], x[2], y[2]));
sa = sqrt(1.0 - pow2(ca));
r = distance(x[2], y[2], x[0], y[0]) / sa;
r /= 2.0;
X[0] = x[1] - x[0];
X[1] = x[2] - x[0];
Y[0] = y[1] - y[0];
Y[1] = y[2] - y[0];
al = -(pow2(x[0]) - pow2(x[1]) + pow2(y[0]) - pow2(y[1]));
be = -(pow2(x[0]) - pow2(x[2]) + pow2(y[0]) - pow2(y[2]));
cal = (X[0] * Y[1] - X[1] * Y[0]) * 2.0;
cx = (Y[1] * al - Y[0] * be) / cal;
cy = (X[0] * be - X[1] * al) / cal;
printf("%.3lf %.3lf %.3lf\n", cx, cy, r);
}
return 0;
}
|
a.cc:31:1: error: extended character is not valid in an identifier
31 | ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ + pow2(distance(x[1], y[1], x[2], y[2]))
| ^
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:31:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
32 | ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ - pow2(distance(x[2], y[2], x[0], y[0])))
| ^
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:32:1: error: extended character is not valid in an identifier
a.cc:33:1: error: extended character is not valid in an identifier
33 | ツ ツ ツ ツ ツ / (2.0 * distance(x[0], y[0], x[1], y[1]) * distance(x[1], y[1], x[2], y[2]));
| ^
a.cc:33:1: error: extended character is not valid in an identifier
a.cc:33:1: error: extended character is not valid in an identifier
a.cc:33:1: error: extended character is not valid in an identifier
a.cc:33:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:30:53: error: expected ')' before '\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000\U000030c4\U00003000'
30 | ca = (pow2(distance(x[0], y[0], x[1], y[1]))
| ~ ^
| )
31 | ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ ツ + pow2(distance(x[1], y[1], x[2], y[2]))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s145838021
|
p00010
|
C++
|
#include <stdio.h>
#include <math.h>
#define SQ(x) ((x) * (x))
int main(void)
{
int n;
double x1, x2, x3, y1, y2, y3;
double a, b, c, d, e, f;
double l, m, n;
cin >> n;
for (int i = 0; i < n; i++){
scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = (x1 - x2);
b = (y1 - y2);
c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
d = (x1 - x3);
e = (y1 - y3);
f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));
l = (c * e - b * f) / (e * a - b * d);
m = (d * c - a * f) / (d * b - e * a);
n = -1 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);
printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, sqrt(SQ(l) + SQ(m) - 4 * n) / 2.0);
}
return (0);
}
|
a.cc: In function 'int main()':
a.cc:11:18: error: conflicting declaration 'double n'
11 | double l, m, n;
| ^
a.cc:8:9: note: previous declaration as 'int n'
8 | int n;
| ^
a.cc:13:5: error: 'cin' was not declared in this scope; did you mean 'sin'?
13 | cin >> n;
| ^~~
| sin
|
s972078737
|
p00010
|
C++
|
#include <iostream>
using namespace std;
//0010
int main(){
int n;
while(cin >> n){
double x1,y1,x2,y2,x3,y3,x,y,r;
while(n--){
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
if(x1!=x2){
x=(x1+x2)/2;
}else if(x2!=x3){
x=(x2+x3)/2;
}else if(x3!=x1){
x=(x3+x1)/2;
}
if(y1!=y2){
y=(y1+y2)/2;
}else if(y2!=y3){
y=(y2+y3)/2;
}else if(y3!=y1){
y=(y3+y1)/2;
}
r=sqrt(pow(x-x1,2)+pow(y-y1,2));
cout.setf(ios::fixed);
cout.precision(3);
cout << x << " " << y << " " << r << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:28:32: error: 'pow' was not declared in this scope
28 | r=sqrt(pow(x-x1,2)+pow(y-y1,2));
| ^~~
a.cc:28:27: error: 'sqrt' was not declared in this scope
28 | r=sqrt(pow(x-x1,2)+pow(y-y1,2));
| ^~~~
a.cc:33:10: error: expected '}' at end of input
33 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s677660614
|
p00010
|
C++
|
#include<iostream>
#include<cmath>
#include<cstdip>
#define S second
#define F first
using namespace std;
typedef pair<double,double> P;
double Length(P p,P q){
return sqrt(pow(p.first - q.first,2)+pow(p.second-q.second,2));
}
int main(){
P p[3];
double a,b,c,A,B,C,R,x,y;
int n;
cin >> n;
while(n-- > 0){
cin >> p[0].first >> p[0].second >> p[1].first >>p[1].second >> p[2].first >> p[2].second;
a = Length(p[0],p[1]);
b = Length(p[1],p[2]);
c = Length(p[2],p[0]);
A = acos((b*b+c*c-a*a)/(2*b*c));
B = acos((a*a+c*c-b*b)/(2*a*c));
C = acos((a*a+b*b-c*c)/(2*a*b));
R = 0.5 * (a/sin(A));
//x = 0.5*((((pow(p[0].F,2)+pow(p[0].S,2))*(p[1].S-p[2].S)+((pow(p[1].F,2)+pow(p[1].F,2))*(p[2].S-p[0].S))+((pow(p[2].F,2)+pow(p[2].S,2))*(p[0].S-p[1].S))) ) / (p[0].F*(p[1].S-p[2].S)+p[1].F*(p[2].S-p[0].S)+p[2].F*(p[0].S-p[1].S)));
x = 0.5*( (pow(p[0].F,2)+pow(p[0].S,2))*(p[1].S-p[2].S) + (pow(p[1].F,2)+pow(p[1].S,2))*(p[2].S-p[0].S) + (pow(p[2].F,2)+pow(p[2].S,2))*(p[0].S-p[1].S) )/(
p[0].F*(p[1].S-p[2].S) + p[1].F*(p[2].S-p[0].S) + p[2].F*(p[0].S-p[1].S) );
y = 0.5*((pow(p[0].F,2)+pow(p[0].S,2))*(p[1].F-p[2].F)+(pow(p[1].F,2)+pow(p[1].S,2))*(p[2].F-p[0].F)+(pow(p[2].F,2)+pow(p[2].S,2))*(p[0].F-p[1].F))/(p[0].S*(p[1].F-p[2].F)+p[1].S*(p[2].F-p[0].F)+p[2].S*(p[0].F-p[1].F));
printf("%.3f %.3f %.3f\n",x,y,R);
}
return 0;
}
|
a.cc:3:9: fatal error: cstdip: No such file or directory
3 | #include<cstdip>
| ^~~~~~~~
compilation terminated.
|
s548928736
|
p00010
|
C++
|
//ツ三ツ角ツ形ツづ個外ツ静堋円ツづ個陳?心ツづ? ツ三ツ角ツ形ツづ個静シツ閉ェツづ個青つ陳シツ禿アツ督卍閉ェツ静シツつェツ古ーツづュツづゥツ湘ェツ渉環づ可づ按づゥ.
//ツつアツづ個づヲツつ、ツづ按甘エツ可スツ学ツ的ツづ按姪「ツ妥ィツづーツ嘉ーツつュツづ?つォツづ? ツ暗按可コツづ個ペ-ツジツづ個δ可イツブツδ可δ環づーツ参ツ考ツづ可つキツづゥツづ?嘉ーツつォツづ「ツつキツつ「.
// - http://www.deqnotes.net/acmicpc/2d_geometry/
// - http://www.prefield.com/algorithm/index.html
#include <iostream>
#include <complex>
#include <vector>
using namespace std;
typedef complex<double> P;
P p[3]; //ツ三ツ角ツ形ツづ個三ツ点
//ツ外ツ静?
double cross(const P &a, const P &b){
return imag(conj(a) * b);
}
//ツ静シツ閉ェ/ツ陳シツ静シツ用ツづ個型
struct L : public vector<P> {
L(const P &a, const P &b){
push_back(a);
push_back(b);
}
};
//ツ陳シツ静シ2ツづつづ個古ーツ点ツづーツ仰?づ淞づゥ
P crosspoint(const L &l, const L &m){
double A = cross(l[1] - l[0], m[1] - m[0]);
double B = cross(l[1] - l[0], l[1] - m[0]);
return m[0] + B / A * (m[1] - m[0]);
}
//ツ静シツ閉ェabツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづーツ仰?づ淞づゥ
L getBisection(const P &a, const P &b){
P s = (a + b) / 2.0; //ツ陳?点
P t = (b - a) * P(0, 1); //ツ静シツ閉ェabツづ個法ツ静シツベツクツトツδ仰づーツ偲ヲツ督セ
//ツ静シツ閉ェabツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづ? ツ点sツつゥツづァs+tツづ鳴伸ツづ堕づゥツ陳シツ静シ
return L(s, s + t);
}
void solve(){
//ツ三ツ角ツ形ツづ個静シツ閉ェツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづー2ツづつ偲ヲツ督セツつキツづゥ
L l1 = getBisection(p[0], p[1]);
L l2 = getBisection(p[1], p[2]);
//ツ外ツ静堋円ツづ個陳?心ツづ? l1ツづ?2ツつェツ古ーツ債キツつオツつスツ点
P o = crosspoint(l1, l2);
//ツ三ツ角ツ形ツづ個任ツ暗督づ個陳クツ点ツつゥツづァ, ツ陳?心ツづ慊づ?づ個仰猟猟」ツづーツ偲ヲツづェツづ? ツ板シツ径ツづ可づ按づゥ
printf("%.3f %.3f %.3f\n", o.real(), o.imag(), abs(o - p[0]));
}
int main(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
for(int j = 0; j < 3; j++){
cin >> p[j].real() >> p[j].imag();
}
solve();
}
}
|
a.cc: In function 'int main()':
a.cc:62:11: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'double')
62 | cin >> p[j].real() >> p[j].imag();
| ~~~ ^~ ~~~~~~~~~~~
| | |
| | double
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:6:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'double&' to an rvalue of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:62:23: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'double'
62 | cin >> p[j].real() >> p[j].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'double' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'double' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'double' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note:
|
s711358113
|
p00010
|
C++
|
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
// 半径取得の処理
double getR(double x1, double y1, double x2, double y2, double x3, double y3) {
double marginX1, marginX2, marginX3;
double marginY1, marginY2, marginY3;
double a, b, c;
double r, s;
// それぞれのxとyの長さを求める
marginX1 = abs(x2 - x1);
marginY1 = abs(y2 - y1);
marginX2 = abs(x1 - x3);
marginY2 = abs(y1 - y3);
marginX3 = abs(x3 - x2);
marginY3 = abs(y3 - y2);
// それぞれの辺の長さを求める
a = sqrt(pow(marginX1,2) + pow(marginY1,2));
b = sqrt(pow(marginX2,2) + pow(marginY2,2));
c = sqrt(pow(marginX3,2) + pow(marginY3,2));
// 半径を求める
s = (a + b + c) / 2;
r = (a * b * c) / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
/*
r *= 10000;
r = (int)r;
r /= 10;
r = round(r);
r /= 1000;
*/
return r;
}
// 中心座標を求める処理
void getCentralCoodinate(double x1, double y1, double x2, double y2, double x3, double y3, double *xp, double *yp) {
double marginX1, marginX2;
double marginY1, marginY2;
double marginXp1, marginXp2;
double marginYp1, marginYp2;
double n, m;
// 初期化
*xp = 0;
*yp = 0;
// それぞれのxとyの長さを求める
marginX1 = abs(x2 - x1);
marginY1 = abs(y2 - y1);
marginX2 = abs(x1 - x3);
marginY2 = abs(y1 - y3);
// 中心座標を求めるのに必要な式
marginXp1 = 2 * marginX1;
marginYp1 = 2 * marginY1;
marginXp2 = 2 * marginX2;
marginYp2 = 2 * marginY2;
n = pow(x1,2) - pow(x2,2) + pow(y1,2) - pow(y2,2);
m = pow(x1,2) - pow(x3,2) + pow(y1,2) - pow(y3,2);
*xp = (marginYp1 * m - marginYp2 * n) / (marginXp1 * marginYp2 - marginXp2 * marginYp1);
*yp = (marginXp2 * n - marginXp1 * m) / (marginXp1 * marginYp2 - marginXp2 * marginYp1);
/*
*xp *= 10000;
*xp = (int)*xp;
*xp /= 10;
*xp = round(*xp);
*xp /= 1000;
*yp *= 10000;
*yp = (int)*yp;
*yp /= 10;
*yp = round(*yp);
*yp /= 1000;
*/
}
// main処理
int main(void) {
double x1, x2, x3;
double y1, y2, y3;
double xp, yp;
double r;
int n;
cin >> n;
while(n--) {
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
// 半径と中心座標を取得する処理
r = getR(x1, y1, x2, y2, x3, y3);
getCentralCoodinate(x1, y1, x2, y2, x3, y3, &xp, &yp);
// 出力
cout << setprecision(3);
cout << setiosflags(ios::fixed);
cout << xp << " " << yp << " " << r << endl;
}
|
a.cc: In function 'int main()':
a.cc:110:6: error: expected '}' at end of input
110 | }
| ^
a.cc:90:16: note: to match this '{'
90 | int main(void) {
| ^
|
s112856537
|
p00010
|
C++
|
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <cmath>
using namespace std;
typedef complex<double> P;
const double eps = 1e-5;
vector<P> ps(3);
double R;
double eval(P p) {
double sum = 0;
for(int i = 0; i < ps.size(); ++i)
sum += abs(R-abs(p-ps[i]));
return sum;
}
P getBestP(P o, double r) {
double s = 200;
double mini = 1e100;
P bestP;
double begin = -r;
double end = r;
for(int i = 0; i < s; ++i) {
for(int j = 0; j < s; ++j) {
P v(begin + j/s*(end-begin), begin + i/s*(end-begin));
P p = o+v;
double tmp = eval(p);
if(tmp < mini) {
mini = tmp;
bestP = p;
}
}
}
return bestP;
}
int main() {
int Tc;
cin >> Tc;
for(int tc = 0; tc < Tc; ++tc) {
for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
R = abs(ps[1]-ps[2])/abs(sin(arg(ps[1]-ps[0])-arg(ps[2]-ps[0])))/2.0;
P res(0,0);
for(double r = 100.0; r > eps; r *= 0.1) {
res = getBestP(res, r);
}
printf("%.3f %.3f %.3f\n", res.real(), res.imag(), R);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:44:44: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'double')
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~ ^~ ~~~~~~~~~~~~
| | |
| | double
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'double&' to an rvalue of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:44:57: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'double'
44 | for(int i = 0; i < ps.size(); ++i) cin >> ps[i].real() >> ps[i].imag();
| ~~~~~~~~~~^~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'double' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'double' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type
|
s674762142
|
p00010
|
C++
|
#include <stdio.h>
#include <math.h>
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i=0;i<n;i++){
        double x1,y1,x2,y2,x3,y3;
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
 
        double x,y;
        double ax,ay,am,bx,by,bm;
 
 
        if(y1==y2){
            x = (x1+x2)/2;
            bx = (x2+x3)/2;
            by = (y2+y3)/2;
            bm = -(x2-x3)/(y2-y3);
            y = bm*(x-bx)+by;
        }else if(y2==y3){
            x = (x2+x3)/2;
            ax = (x1+x2)/2;
            ay = (y1+y2)/2;
            am = -(x1-x2)/(y1-y2);
            y = am*(x-ax)+ay;
        }else{
            ax = (x1+x2)/2;
            ay = (y1+y2)/2;
            am = -(x1-x2)/(y1-y2); 
            bx = (x2+x3)/2;
            by = (y2+y3)/2;
            bm = -(x2-x3)/(y2-y3);
 
            x = (am*ax-bm*bx-ay+by)/(am-bm);
            y = am*(x-ax)+ay;
        }
         
        printf("%.3lf %.3lf %.3lf\n", x, y, sqrt(pow(x1-x, 2)+pow(y1-y,2)));
    }
}
|
a.cc:3:2: error: stray '#' in program
3 |  
| ^
a.cc:5:2: error: stray '#' in program
5 |     int n;
| ^
a.cc:5:8: error: stray '#' in program
5 |     int n;
| ^
a.cc:5:14: error: stray '#' in program
5 |     int n;
| ^
a.cc:5:20: error: stray '#' in program
5 |     int n;
| ^
a.cc:6:2: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:6:8: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:6:14: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:6:20: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:7:2: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:7:8: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:7:14: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:7:20: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:8:2: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:8: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:14: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:20: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:26: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:32: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:38: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:44: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:9:2: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:8: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:14: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:20: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:26: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:32: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:38: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:44: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:10:2: error: stray '#' in program
10 |  
| ^
a.cc:11:2: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:8: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:14: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:20: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:26: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:32: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:38: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:44: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:12:2: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:8: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:14: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:20: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:26: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:32: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:38: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:44: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:13:2: error: stray '#' in program
13 |  
| ^
a.cc:14:2: error: stray '#' in program
14 |  
| ^
a.cc:15:2: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:8: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:14: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:20: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:26: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:32: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:38: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:44: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:16:2: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:8: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:14: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:20: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:26: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:32: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:38: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:44: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:50: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:56: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:62: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:68: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:17:2: error: stray '#' in program
17 |             bx = (x2+x3)/2;
| ^
a.cc:17:8: error: stray '#' in program
17 |             bx = (x2+x3)/2;
| ^
a.cc:17:14: error: stray '#' in program
17 |             bx = (x2+x3)/2;
|
s829246601
|
p00010
|
C++
|
#include <stdio.h>
#include <math.h>
 
int main(){
    int n;
    scanf("%d", &n);
    for(int i=0;i<n;i++){
        double x1,y1,x2,y2,x3,y3;
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
 
        double x,y;
        double ax,ay,am,bx,by,bm;
 
 
        if(y1==y2){
            x = (x1+x2)/2;
            bx = (x2+x3)/2;
            by = (y2+y3)/2;
            bm = -(x2-x3)/(y2-y3);
            y = bm*(x-bx)+by;
        }else if(y2==y3){
            x = (x2+x3)/2;
            ax = (x1+x2)/2;
            ay = (y1+y2)/2;
            am = -(x1-x2)/(y1-y2);
            y = am*(x-ax)+ay;
        }else{
            ax = (x1+x2)/2;
            ay = (y1+y2)/2;
            am = -(x1-x2)/(y1-y2); 
            bx = (x2+x3)/2;
            by = (y2+y3)/2;
            bm = -(x2-x3)/(y2-y3);
 
            x = (am*ax-bm*bx-ay+by)/(am-bm);
            y = am*(x-ax)+ay;
        }
         
        printf("%.3lf %.3lf %.3lf\n", x, y, sqrt(pow(x1-x, 2)+pow(y1-y,2)));
    }
}
|
a.cc:3:2: error: stray '#' in program
3 |  
| ^
a.cc:5:2: error: stray '#' in program
5 |     int n;
| ^
a.cc:5:8: error: stray '#' in program
5 |     int n;
| ^
a.cc:5:14: error: stray '#' in program
5 |     int n;
| ^
a.cc:5:20: error: stray '#' in program
5 |     int n;
| ^
a.cc:6:2: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:6:8: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:6:14: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:6:20: error: stray '#' in program
6 |     scanf("%d", &n);
| ^
a.cc:7:2: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:7:8: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:7:14: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:7:20: error: stray '#' in program
7 |     for(int i=0;i<n;i++){
| ^
a.cc:8:2: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:8: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:14: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:20: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:26: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:32: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:38: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:8:44: error: stray '#' in program
8 |         double x1,y1,x2,y2,x3,y3;
| ^
a.cc:9:2: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:8: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:14: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:20: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:26: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:32: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:38: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:9:44: error: stray '#' in program
9 |         scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
| ^
a.cc:10:2: error: stray '#' in program
10 |  
| ^
a.cc:11:2: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:8: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:14: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:20: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:26: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:32: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:38: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:11:44: error: stray '#' in program
11 |         double x,y;
| ^
a.cc:12:2: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:8: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:14: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:20: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:26: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:32: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:38: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:12:44: error: stray '#' in program
12 |         double ax,ay,am,bx,by,bm;
| ^
a.cc:13:2: error: stray '#' in program
13 |  
| ^
a.cc:14:2: error: stray '#' in program
14 |  
| ^
a.cc:15:2: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:8: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:14: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:20: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:26: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:32: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:38: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:15:44: error: stray '#' in program
15 |         if(y1==y2){
| ^
a.cc:16:2: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:8: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:14: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:20: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:26: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:32: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:38: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:44: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:50: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:56: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:62: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:16:68: error: stray '#' in program
16 |             x = (x1+x2)/2;
| ^
a.cc:17:2: error: stray '#' in program
17 |             bx = (x2+x3)/2;
| ^
a.cc:17:8: error: stray '#' in program
17 |             bx = (x2+x3)/2;
| ^
a.cc:17:14: error: stray '#' in program
17 |             bx = (x2+x3)/2;
|
s773419136
|
p00010
|
C++
|
#include <iostream>
using namespace std;
double dist(double x1, double y1, double x2, double y2){
return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
int main(){
double x[3], y[3];
int n;
cin >> n;
while(n-- > 0){
for(int i = 0; i < 3; i++){
cin >> x[i] >> y[i];
}
double a = x[1] - x[0];
double b = y[1] - y[0];
double c = x[2] - x[1];
double d = y[2] - y[1];
double e = a*a + b*b;
double f = c*c + d*d;
double p = (e*c - f*a) / (2 * (b*c - a*d));
double q = (e*d - f*b) / (2 * (a*d - b*c));
double r = dist(x[0], y[0], p, q);
cout.setf(ios::fixed);
cout.precision(4);
cout << p << ' ' << q << ' ' << r << endl;
}
return 0;
}
|
a.cc: In function 'double dist(double, double, double, double)':
a.cc:6:16: error: 'sqrt' was not declared in this scope
6 | return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
| ^~~~
|
s599891333
|
p00010
|
C++
|
#include <iostream>
#include <cstdio>
#include <algorithm>
struct Vector2D {
double x, y;
Vector2D() : x(0.0), y(0.0) {}
Vector2D(double vx, double vy) : x(vx), y(vy) {}
Vector2D& operator+=(const Vector2D& rhs)
{
x += rhs.x;
y += rhs.y;
return *this;
}
Vector2D& operator-=(const Vector2D& rhs)
{
x -= rhs.x;
y -= rhs.y;
return *this;
}
Vector2D& operator*=(double rhs)
{
x *= rhs;
y *= rhs;
return *this;
}
};
Vector2D operator+(const Vector2D& lhs, const Vector2D& rhs)
{
Vector2D result(lhs);
return result += rhs;
}
Vector2D operator-(const Vector2D& lhs, const Vector2D& rhs)
{
Vector2D result(lhs);
return result -= rhs;
}
Vector2D operator*(double lhs, const Vector2D& rhs)
{
Vector2D result(rhs);
return result *= lhs;
}
void solve(Vector2D p1, Vector2D p2, Vector2D p3, Vector2D& center, double& radius)
{
// p3-base p1, p3-base p2
Vector2D r1(p1 - p3), r2(p2 - p3);
double det = r2.x * r1.y - (-r1.x) * r2.y;
double a = (r2.x * (r2.x - r1.x) + r2.y * (r1.y - r2.y)) * 0.5 / det;
center = p3 + (0.5 * r1 + a * Vector2D(r1.y, -r1.x));
Vector2D r = p1 - center;
radius = sqrt(r.x * r.x + r.y * r.y);
}
int main()
{
int count = 0;
std::cin >> count;
for (int i = 0; i < count; ++i) {
Vector2D p1,p2,p3;
std::cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
if (!std::cin.good()) {
break;
}
Vector2D center;
double radius = 0.0;
solve(p1, p2, p3, center, radius);
std::printf("%.3f %.3f %.3f\n", center.x, center.y, radius);
}
return 0;
}
|
a.cc: In function 'void solve(Vector2D, Vector2D, Vector2D, Vector2D&, double&)':
a.cc:59:18: error: 'sqrt' was not declared in this scope
59 | radius = sqrt(r.x * r.x + r.y * r.y);
| ^~~~
|
s751376270
|
p00010
|
C++
|
#include <iostream>
#include <cstdio>
#include <algorithm>
struct Vector2D {
double x, y;
Vector2D() : x(0.0), y(0.0) {}
Vector2D(double vx, double vy) : x(vx), y(vy) {}
Vector2D& operator+=(const Vector2D& rhs)
{
x += rhs.x;
y += rhs.y;
return *this;
}
Vector2D& operator-=(const Vector2D& rhs)
{
x -= rhs.x;
y -= rhs.y;
return *this;
}
Vector2D& operator*=(double rhs)
{
x *= rhs;
y *= rhs;
return *this;
}
};
Vector2D operator+(const Vector2D& lhs, const Vector2D& rhs)
{
Vector2D result(lhs);
return result += rhs;
}
Vector2D operator-(const Vector2D& lhs, const Vector2D& rhs)
{
Vector2D result(lhs);
return result -= rhs;
}
Vector2D operator*(double lhs, const Vector2D& rhs)
{
Vector2D result(rhs);
return result *= lhs;
}
void solve(Vector2D p1, Vector2D p2, Vector2D p3, Vector2D& center, double& radius)
{
// p3-base p1, p3-base p2
Vector2D r1(p1 - p3), r2(p2 - p3);
double det = r2.x * r1.y - (-r1.x) * r2.y;
double a = (r2.x * (r2.x - r1.x) + r2.y * (r1.y - r2.y)) * 0.5 / det;
center = p3 + (0.5 * r1 + a * Vector2D(r1.y, -r1.x));
Vector2D r = p1 - center;
radius = std::sqrt(r.x * r.x + r.y * r.y);
}
int main()
{
int count = 0;
std::cin >> count;
for (int i = 0; i < count; ++i) {
Vector2D p1,p2,p3;
std::cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
if (!std::cin.good()) {
break;
}
Vector2D center;
double radius = 0.0;
solve(p1, p2, p3, center, radius);
std::printf("%.3f %.3f %.3f\n", center.x, center.y, radius);
}
return 0;
}
|
a.cc: In function 'void solve(Vector2D, Vector2D, Vector2D, Vector2D&, double&)':
a.cc:59:23: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
59 | radius = std::sqrt(r.x * r.x + r.y * r.y);
| ^~~~
| sort
|
s732933948
|
p00010
|
C++
|
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main(){
double x1,y1,x2,y2,x3,y3;
vector<double> x1l,y1l,x2l,y2l,x3l,y3l;
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
x1l.push_back(x1);
y1l.push_back(y1);
x2l.push_back(x2);
y2l.push_back(y2);
x3l.push_back(x3);
y3l.push_back(y3);
}
double ex,ey,fx,fy;
double a,b,c,d,e,f,r;
double cx,cy;
for(int i=0; i<n; i++){
x1=x1l[i];
y1=y1l[i];
x2=x2l[i];
y2=y2l[i];
x3=x3l[i];
y3=y3l[i];
a = x1*x1+y1+y1;
b = x2*x2+y2+y2;
c = x3*x3+y3+y3;
d = 0.5/(x1*y2-x2*y1+x2*y3-x3*y2+x3*y1-x1*y3);
e = d*(a*y2-b*y1+b*y3-c*y2+c*y1-a*y3);
f = d*(x1*b-x2*a+x2*c-x3*b+x3*a-x1*c);
r = sqrt((e-x1)*(e-x1)+(f-y1)*(f-y1));
printf("%0.3f %0.3f %0.3f\n",e,f,r);
}
r
|
a.cc: In function 'int main()':
a.cc:46:4: error: expected ';' at end of input
46 | r
| ^
| ;
a.cc:46:4: error: expected '}' at end of input
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s918522713
|
p00010
|
C++
|
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main(){
double x1,y1,x2,y2,x3,y3;
vector<double> x1l,y1l,x2l,y2l,x3l,y3l;
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
x1l.push_back(x1);
y1l.push_back(y1);
x2l.push_back(x2);
y2l.push_back(y2);
x3l.push_back(x3);
y3l.push_back(y3);
}
double ex,ey,fx,fy;
double a,b,c,d,e,f,r;
double cx,cy;
for(int i=0; i<n; i++){
x1=x1l[i];
y1=y1l[i];
x2=x2l[i];
y2=y2l[i];
x3=x3l[i];
y3=y3l[i];
a = x1*x1+y1+y1;
b = x2*x2+y2+y2;
c = x3*x3+y3+y3;
d = 0.5/(x1*y2-x2*y1+x2*y3-x3*y2+x3*y1-x1*y3);
e = d*(a*y2-b*y1+b*y3-c*y2+c*y1-a*y3);
f = d*(x1*b-x2*a+x2*c-x3*b+x3*a-x1*c);
r = sqrt((e-x1)*(e-x1)+(f-y1)*(f-y1));
printf("%0.3f %0.3f %0.3f\n",e,f,r);
}
r
|
a.cc: In function 'int main()':
a.cc:46:4: error: expected ';' at end of input
46 | r
| ^
| ;
a.cc:46:4: error: expected '}' at end of input
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s723519999
|
p00010
|
C++
|
#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
int main()
{
int i,n;
double x1,x2,x3,y1,y2,y3;
double m1,m2,xm1,xm2,ym1,ym2,xo,yo,r;
//m1,m2…辺の法線 xm1,ym1…辺の中点の座標
cin>>n;
for(i=0;i<n;i++){
flg=0;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
xm1=(x1+x2)/2;
xm2=(x2+x3)/2;
ym1=(y1+y2)/2;
ym2=(y2+y3)/2;
if(y1-y2!=0) m1=(-1)*(x1-x2)/(y1-y2);
else if(y1-y2==0) flg=1;
if(y2-y3!=0) m2=(-1)*(x2-x3)/(y2-y3);
else if(y2-y3==0) flg=2;
if(flg==0) xo=(m1*xm1-m2*xm2+ym2-ym1)/(m1-m2);
else if(flg==1)xo=xm1;
else if(flg==2)xo=xm2;
if(flg==1)yo=m2*(xo-xm2)+ym2;
else yo=m1*(xo-xm1)+ym1;
r=sqrt((x1-xo)*(x1-xo)+(y1-yo)*(y1-yo));
printf("%.3lf %.3lf %.3lf \n",xo,yo,r);
}
}
|
a.cc: In function 'int main()':
a.cc:15:17: error: 'flg' was not declared in this scope
15 | flg=0;
| ^~~
|
s613675337
|
p00010
|
C++
|
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int n;
double x1, y1, x2, y2, x3, y3, m1, m2, m3, b1, b2, b3, px, py, r;
double d[2], e[2], f[2];
cin >> n;
for(int i = 0; i < n; i++){
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
d[0] = (x2 + x3) / 2;
d[1] = (y2 + y3) / 2;
e[0] = (x3 + x1) / 2;
e[1] = (y3 + y1) / 2; int count = 0;
for(int i = 0; i <= n; i++){
if(num[i]){
count++;
}
}
cout << count << endl;
}
f[0] = (x1 + x2) / 2;
f[1] = (y1 + y2) / 2;
m1 = (y3 - y2) / (x3 - x2);
m2 = (y1 - y3) / (x1 - x3);
m3 = (y2 - y1) / (x2 - x1);
b1 = d[1] + d[0] / m1;
b2 = e[1] + e[0] / m2;
b3 = f[1] + f[0] / m3;
px = -(b1 - b2) / ((1 / m2) - (1 / m1));
py = -(1 / m1) * px + b1;
r = (double)sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py));
px = floor(1000 * (px + 0.0005)) / 1000;
py = floor(1000 * (py + 0.0005)) / 1000;
r = floor(1000 * (r + 0.0005)) / 1000;
cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:16: error: 'num' was not declared in this scope; did you mean 'enum'?
18 | if(num[i]){
| ^~~
| enum
a.cc: At global scope:
a.cc:41:9: error: expected unqualified-id before 'return'
41 | return 0;
| ^~~~~~
a.cc:42:1: error: expected declaration before '}' token
42 | }
| ^
|
s768338079
|
p00010
|
C++
|
using System;
class main
{
static void Main(string[] args)
{
string s = string.Empty;
var n = int.Parse(Console.ReadLine());
while (n-- != 0)
{
s = Console.ReadLine();
string[] s1 = s.Split(' ');
double x1 = double.Parse(s1[0]);
double x2 = double.Parse(s1[1]);
double x3 = double.Parse(s1[2]);
double y1 = double.Parse(s1[3]);
double y2 = double.Parse(s1[4]);
double y3 = double.Parse(s1[5]);
double a = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
double b = Math.Sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
double c = Math.Sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
double r = (a * b * c) / Math.Sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
double x = (((x1 * x1 + y1 * y1) * (y2 - y3)) + ((x2 * x2 + y2 * y2) * (y3 - y1)) + ((x3 * x3 + y3 * y3) * (y1 - y2))) / ((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2))) * 0.5;
double y = (((x1 * x1 + y1 * y1) * (x2 - x3)) + ((x2 * x2 + y2 * y2) * (x3 - x1)) + ((x3 * x3 + y3 * y3) * (x1 - x2))) / ((y1 * (x2 - x3)) + (y2 * (x3 - x1)) + (y3 * (x1 - x2))) * 0.5;
Console.WriteLine("{0:F3} {1:F3} {2:F3}", x, y, r);
}
Console.ReadKey();
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:5:22: error: 'string' has not been declared
5 | static void Main(string[] args)
| ^~~~~~
a.cc:5:31: error: expected ',' or '...' before 'args'
5 | static void Main(string[] args)
| ^~~~
a.cc:29:2: error: expected ';' after class definition
29 | }
| ^
| ;
a.cc: In static member function 'static void main::Main(int*)':
a.cc:7:9: error: 'string' was not declared in this scope
7 | string s = string.Empty;
| ^~~~~~
a.cc:8:9: error: 'var' was not declared in this scope
8 | var n = int.Parse(Console.ReadLine());
| ^~~
a.cc:9:16: error: 'n' was not declared in this scope
9 | while (n-- != 0)
| ^
a.cc:11:13: error: 's' was not declared in this scope
11 | s = Console.ReadLine();
| ^
a.cc:11:17: error: 'Console' was not declared in this scope
11 | s = Console.ReadLine();
| ^~~~~~~
a.cc:12:20: error: expected primary-expression before ']' token
12 | string[] s1 = s.Split(' ');
| ^
a.cc:13:25: error: expected primary-expression before 'double'
13 | double x1 = double.Parse(s1[0]);
| ^~~~~~
a.cc:14:25: error: expected primary-expression before 'double'
14 | double x2 = double.Parse(s1[1]);
| ^~~~~~
a.cc:15:25: error: expected primary-expression before 'double'
15 | double x3 = double.Parse(s1[2]);
| ^~~~~~
a.cc:16:25: error: expected primary-expression before 'double'
16 | double y1 = double.Parse(s1[3]);
| ^~~~~~
a.cc:17:25: error: expected primary-expression before 'double'
17 | double y2 = double.Parse(s1[4]);
| ^~~~~~
a.cc:18:25: error: expected primary-expression before 'double'
18 | double y3 = double.Parse(s1[5]);
| ^~~~~~
a.cc:19:24: error: 'Math' was not declared in this scope
19 | double a = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
| ^~~~
a.cc:27:9: error: 'Console' was not declared in this scope
27 | Console.ReadKey();
| ^~~~~~~
|
s641870423
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <double> vd;
typedef vector <vd> vvd;
vvd inverse(vvd &x){
vvd tmp(2, vd(2));
if (x.size()!=2) return tmp;
double a, b, c, d, e;
a = x[0][0];
b = x[0][1];
c = x[1][0];
d = x[1][1];
e = 1.0 / (a*d-b*c);
tmp[0][0] = d * e;
tmp[0][1] = -b * e;
tmp[1][0] = -c * e;
tmp[1][1] = a * e;
return tmp;
}
vvd Mmult(vvd &A, vvd &B){
int n1=A.size();
int n2=A[0].size();
int n3=B[0].size();
vvd C(n1, vd(n3));
for (int i=0; i<n1; i++)
for (int j=0; j<n3; j++)
C[i][j] = 0;
for (int i=0; i<n1; i++)
for (int j=0; j<n2; j++)
for (int k=0; k<n3; k++)
C[i][k] += A[i][j] * B[j][k];
return C;
}
int main(void){
int n;
double x1, y1, x2, y2, x3, y3, dx1, dy1, dx2, dy2;
vvd A(2, vd(2)), B(2, vd(1));
cin>>n;
for (int i=1; i<n+1; i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
dx1 = x2 - x1;
dy1 = y2 - y1;
dx2 = x3 - x1;
dy2 = y3 - y1;
A[0][0] = -dx1;
A[0][1] = dy1;
A[1][0] = -dx2;
A[1][1] = dy2;
B[0][0] = -dx1*(x1+x2)/2 + dy1*(y1+y2)/2;
B[1][0] = -dx2*(x1+x3)/2 + dy2*(y1+y3)/2;
B = Mmult(inverse(A), B);
double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
cout<<fixed<<setprecision(3);
cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:58:34: error: cannot bind non-const lvalue reference of type 'vvd&' {aka 'std::vector<std::vector<double> >&'} to an rvalue of type 'vvd' {aka 'std::vector<std::vector<double> >'}
58 | B = Mmult(inverse(A), B);
| ~~~~~~~^~~
a.cc:25:16: note: initializing argument 1 of 'vvd Mmult(vvd&, vvd&)'
25 | vvd Mmult(vvd &A, vvd &B){
| ~~~~~^
|
s187984389
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <double> vd;
typedef vector < vd > vvd;
vvd inverse(vvd &x){
vvd tmp(2, vd(2));
if (x.size()!=2) return tmp;
double a, b, c, d, e;
a = x[0][0];
b = x[0][1];
c = x[1][0];
d = x[1][1];
e = 1.0 / (a*d-b*c);
tmp[0][0] = d * e;
tmp[0][1] = -b * e;
tmp[1][0] = -c * e;
tmp[1][1] = a * e;
return tmp;
}
vvd Mmult(vvd &A, vvd &B){
int n1=A.size();
int n2=A[0].size();
int n3=B[0].size();
vvd C(n1, vd(n3));
for (int i=0; i<n1; i++)
for (int j=0; j<n3; j++)
C[i][j] = 0;
for (int i=0; i<n1; i++)
for (int j=0; j<n2; j++)
for (int k=0; k<n3; k++)
C[i][k] += A[i][j] * B[j][k];
return C;
}
int main(void){
int n;
double x1, y1, x2, y2, x3, y3, dx1, dy1, dx2, dy2;
vvd A(2, vd(2)), B(2, vd(1));
cin>>n;
for (int i=1; i<n+1; i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
dx1 = x2 - x1;
dy1 = y2 - y1;
dx2 = x3 - x1;
dy2 = y3 - y1;
A[0][0] = -dx1;
A[0][1] = dy1;
A[1][0] = -dx2;
A[1][1] = dy2;
B[0][0] = -dx1*(x1+x2)/2 + dy1*(y1+y2)/2;
B[1][0] = -dx2*(x1+x3)/2 + dy2*(y1+y3)/2;
B = Mmult(inverse(A), B);
double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
cout<<fixed<<setprecision(3);
cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
}
return 0;
}
|
a.cc:7:17: error: extended character is not valid in an identifier
7 | typedef vector < vd > vvd;
| ^
a.cc:7:17: error: extended character is not valid in an identifier
a.cc:7:17: error: '\U00003000vd\U00003000' was not declared in this scope
7 | typedef vector < vd > vvd;
| ^~~~~~
a.cc:7:23: error: template argument 1 is invalid
7 | typedef vector < vd > vvd;
| ^
a.cc:7:23: error: template argument 2 is invalid
a.cc: In function 'vvd inverse(vvd&)':
a.cc:10:25: error: expression list treated as compound expression in initializer [-fpermissive]
10 | vvd tmp(2, vd(2));
| ^
a.cc:10:20: error: cannot convert 'vd' {aka 'std::vector<double>'} to 'vvd' {aka 'int'} in initialization
10 | vvd tmp(2, vd(2));
| ^~~~~
| |
| vd {aka std::vector<double>}
a.cc:11:15: error: request for member 'size' in 'x', which is of non-class type 'vvd' {aka 'int'}
11 | if (x.size()!=2) return tmp;
| ^~~~
a.cc:13:14: error: invalid types 'vvd {aka int}[int]' for array subscript
13 | a = x[0][0];
| ^
a.cc:14:14: error: invalid types 'vvd {aka int}[int]' for array subscript
14 | b = x[0][1];
| ^
a.cc:15:10: error: invalid types 'vvd {aka int}[int]' for array subscript
15 | c = x[1][0];
| ^
a.cc:16:14: error: invalid types 'vvd {aka int}[int]' for array subscript
16 | d = x[1][1];
| ^
a.cc:18:12: error: invalid types 'vvd {aka int}[int]' for array subscript
18 | tmp[0][0] = d * e;
| ^
a.cc:19:12: error: invalid types 'vvd {aka int}[int]' for array subscript
19 | tmp[0][1] = -b * e;
| ^
a.cc:20:12: error: invalid types 'vvd {aka int}[int]' for array subscript
20 | tmp[1][0] = -c * e;
| ^
a.cc:21:12: error: invalid types 'vvd {aka int}[int]' for array subscript
21 | tmp[1][1] = a * e;
| ^
a.cc: In function 'vvd Mmult(vvd&, vvd&)':
a.cc:26:14: error: request for member 'size' in 'A', which is of non-class type 'vvd' {aka 'int'}
26 | int n1=A.size();
| ^~~~
a.cc:27:13: error: invalid types 'vvd {aka int}[int]' for array subscript
27 | int n2=A[0].size();
| ^
a.cc:28:17: error: invalid types 'vvd {aka int}[int]' for array subscript
28 | int n3=B[0].size();
| ^
a.cc:29:25: error: expression list treated as compound expression in initializer [-fpermissive]
29 | vvd C(n1, vd(n3));
| ^
a.cc:29:19: error: cannot convert 'vd' {aka 'std::vector<double>'} to 'vvd' {aka 'int'} in initialization
29 | vvd C(n1, vd(n3));
| ^~~~~~
| |
| vd {aka std::vector<double>}
a.cc:32:26: error: invalid types 'vvd {aka int}[int]' for array subscript
32 | C[i][j] = 0;
| ^
a.cc:37:34: error: invalid types 'vvd {aka int}[int]' for array subscript
37 | C[i][k] += A[i][j] * B[j][k];
| ^
a.cc:37:45: error: invalid types 'vvd {aka int}[int]' for array subscript
37 | C[i][k] += A[i][j] * B[j][k];
| ^
a.cc:37:55: error: invalid types 'vvd {aka int}[int]' for array subscript
37 | C[i][k] += A[i][j] * B[j][k];
| ^
a.cc: In function 'int main()':
a.cc:44:23: error: expression list treated as compound expression in initializer [-fpermissive]
44 | vvd A(2, vd(2)), B(2, vd(1));
| ^
a.cc:44:18: error: cannot convert 'vd' {aka 'std::vector<double>'} to 'vvd' {aka 'int'} in initialization
44 | vvd A(2, vd(2)), B(2, vd(1));
| ^~~~~
| |
| vd {aka std::vector<double>}
a.cc:44:36: error: expression list treated as compound expression in initializer [-fpermissive]
44 | vvd A(2, vd(2)), B(2, vd(1));
| ^
a.cc:44:31: error: cannot convert 'vd' {aka 'std::vector<double>'} to 'vvd' {aka 'int'} in initialization
44 | vvd A(2, vd(2)), B(2, vd(1));
| ^~~~~
| |
| vd {aka std::vector<double>}
a.cc:52:18: error: invalid types 'vvd {aka int}[int]' for array subscript
52 | A[0][0] = -dx1;
| ^
a.cc:53:18: error: invalid types 'vvd {aka int}[int]' for array subscript
53 | A[0][1] = dy1;
| ^
a.cc:54:18: error: invalid types 'vvd {aka int}[int]' for array subscript
54 | A[1][0] = -dx2;
| ^
a.cc:55:18: error: invalid types 'vvd {aka int}[int]' for array subscript
55 | A[1][1] = dy2;
| ^
a.cc:56:18: error: invalid types 'vvd {aka int}[int]' for array subscript
56 | B[0][0] = -dx1*(x1+x2)/2 + dy1*(y1+y2)/2;
| ^
a.cc:57:18: error: invalid types 'vvd {aka int}[int]' for array subscript
57 | B[1][0] = -dx2*(x1+x3)/2 + dy2*(y1+y3)/2;
| ^
a.cc:58:34: error: cannot bind non-const lvalue reference of type 'vvd&' {aka 'int&'} to an rvalue of type 'vvd' {aka 'int'}
58 | B = Mmult(inverse(A), B);
| ~~~~~~~^~~
a.cc:25:16: note: initializing argument 1 of 'vvd Mmult(vvd&, vvd&)'
25 | vvd Mmult(vvd &A, vvd &B){
| ~~~~~^
a.cc:60:37: error: invalid types 'vvd {aka int}[int]' for array subscript
60 | double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
| ^
a.cc:60:55: error: invalid types 'vvd {aka int}[int]' for array subscript
60 | double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
| ^
a.cc:62:24: error: invalid types 'vvd {aka int}[int]' for array subscript
62 | cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
| ^
a.cc:62:38: error: invalid types 'vvd {aka int}[int]' for array subscript
62 | cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
| ^
|
s860236333
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <double> vd;
typedef vector < vd > vvd;
vvd inverse(vvd &x){
vvd tmp(2, vd(2));
if (x.size()!=2) return tmp;
double a, b, c, d, e;
a = x[0][0];
b = x[0][1];
c = x[1][0];
d = x[1][1];
e = 1.0 / (a*d-b*c);
tmp[0][0] = d * e;
tmp[0][1] = -b * e;
tmp[1][0] = -c * e;
tmp[1][1] = a * e;
return tmp;
}
vvd Mmult(vvd &A, vvd &B){
int n1=A.size();
int n2=A[0].size();
int n3=B[0].size();
vvd C(n1, vd(n3));
for (int i=0; i<n1; i++)
for (int j=0; j<n3; j++)
C[i][j] = 0;
for (int i=0; i<n1; i++)
for (int j=0; j<n2; j++)
for (int k=0; k<n3; k++)
C[i][k] += A[i][j] * B[j][k];
return C;
}
int main(void){
int n;
double x1, y1, x2, y2, x3, y3, dx1, dy1, dx2, dy2;
vvd A(2, vd(2)), B(2, vd(1));
cin>>n;
for (int i=1; i<n+1; i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
dx1 = x2 - x1;
dy1 = y2 - y1;
dx2 = x3 - x1;
dy2 = y3 - y1;
A[0][0] = -dx1;
A[0][1] = dy1;
A[1][0] = -dx2;
A[1][1] = dy2;
B[0][0] = -dx1*(x1+x2)/2 + dy1*(y1+y2)/2;
B[1][0] = -dx2*(x1+x3)/2 + dy2*(y1+y3)/2;
B = Mmult(inverse(A), B);
double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
cout<<fixed<<setprecision(3);
cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:58:34: error: cannot bind non-const lvalue reference of type 'vvd&' {aka 'std::vector<std::vector<double> >&'} to an rvalue of type 'vvd' {aka 'std::vector<std::vector<double> >'}
58 | B = Mmult(inverse(A), B);
| ~~~~~~~^~~
a.cc:25:16: note: initializing argument 1 of 'vvd Mmult(vvd&, vvd&)'
25 | vvd Mmult(vvd &A, vvd &B){
| ~~~~~^
|
s464691401
|
p00010
|
C++
|
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
cout << A[i][j] << " ";
}
cout << endl;
}
|
a.cc:2:5: error: expected unqualified-id before 'for'
2 | for(int i=0; i<3; i++) {
| ^~~
a.cc:2:18: error: 'i' does not name a type
2 | for(int i=0; i<3; i++) {
| ^
a.cc:2:23: error: 'i' does not name a type
2 | for(int i=0; i<3; i++) {
| ^
|
s111111515
|
p00010
|
C++
|
#define INF 100000000
using namespace std;
#define pw(a) (a)*(a)
int main(){
double x1,x2,x3,y1,y2,y3;
int n;
cin >> n;
while(n--){
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
double a,b,l,m,n;
a = -1*(pw(x1) - pw(x2) + pw(y1) - pw(y2));
b = -1*(pw(x1) - pw(x3) + pw(y1) - pw(y3));
l = (a*(y1-y3)+b*(y1-y2))/((y1-y3)*(x1-x2)-(x1-x3)*(y1-y2));
m = (b-(x1-x3)*l)/(y1-y3);
n = (x1*l + y1*m) - (pw(x1) + pw(y1));
printf("%.3f %.3f %.3f\n",(float)-l/2,(float)-m/2,(float)sqrt((pw(l) + pw(m) - 4*n))/2);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
8 | cin >> n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #define INF 100000000
a.cc:17:62: error: 'sqrt' was not declared in this scope
17 | printf("%.3f %.3f %.3f\n",(float)-l/2,(float)-m/2,(float)sqrt((pw(l) + pw(m) - 4*n))/2);
| ^~~~
a.cc:17:5: error: 'printf' was not declared in this scope
17 | printf("%.3f %.3f %.3f\n",(float)-l/2,(float)-m/2,(float)sqrt((pw(l) + pw(m) - 4*n))/2);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define INF 100000000
|
s877652171
|
p00010
|
C++
|
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
long double x1,x2,x3,y1,y2,y3;
long double p,q,r;
int tmp;
int n;
cin >> n;
while(n--){
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
p = ((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));
q = ((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*x3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
r2 = sqrt((x1-p)*(x1-p) + (y1-q)*(y1-q));
printf("%.3Lf %.3Lf %.3Lf\n", p, q, r);
}
}
|
a.cc: In function 'int main()':
a.cc:22:5: error: 'r2' was not declared in this scope; did you mean 'r'?
22 | r2 = sqrt((x1-p)*(x1-p) + (y1-q)*(y1-q));
| ^~
| r
|
s653310247
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
inline sqr(double x){return x*x;}
inline double Roundoff(double x){
if( x<0 ){
x*=-1;
x=(x-(x-int(x*1000)/1000))+(((x*1000)-int(x*1000))*10)>=4?0.001:0;
x*=-1;
}else{
x=(x-(x-int(x*1000)/1000))+(((x*1000)-int(x*1000))*10)>=4?0.001:0;
}
return x;
}
void SolveSimultEq(double &x,double &y,double a,double b,double c,double d,double e,double f);
int main(){
int datanum;
double *x1,*y1,*x2,*y2,*x3,*y3;
cin>>datanum;
x1=new double[datanum];
y1=new double[datanum];
x2=new double[datanum];
y2=new double[datanum];
x3=new double[datanum];
y3=new double[datanum];
for( int i=0;i<datanum;i++ ){
cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]>>x3[i]>>y3[i];
}
for( int i=0;i<datanum;i++ ){
double px,py,r;
SolveSimultEq(px,py,2*(x1[i]-x2[i]),2*(y1[i]-y2[i]),sqr(x1[i])-sqr(x2[i])+sqr(y1[i])-sqr(y2[i]),
2*(x2[i]-x3[i]),2*(y2[i]-y3[i]),sqr(x2[i])-sqr(x3[i])+sqr(y2[i])-sqr(y3[i]));
r=sqrt(sqr(x1[i]-px)+sqr(y1[i]-py));
cout<<fixed<<setprecision(3)<<px<<" "<<setprecision(3)<<py<<" "<<setprecision(3)<<r<<endl;
}
delete x1;
delete y1;
delete x2;
delete y2;
delete x3;
delete y3;
return 0;
}
void SolveSimultEq(double &x,double &y,double a,double b,double c,double d,double e,double f){
double delta=a*e-b*d;
x=(c*e-b*f)/delta;
y=(a*f-c*d)/delta;
}
|
a.cc:6:8: error: ISO C++ forbids declaration of 'sqr' with no type [-fpermissive]
6 | inline sqr(double x){return x*x;}
| ^~~
|
s187980062
|
p00010
|
C++
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
inline double square(double x){return x*x;}
inline double Roundoff(double x){
if( x<0 ){
x*=-1;
x=(x-(x-int(x*1000)/1000))+(((x*1000)-int(x*1000))*10)>=4?0.001:0;
x*=-1;
}else{
x=(x-(x-int(x*1000)/1000))+(((x*1000)-int(x*1000))*10)>=4?0.001:0;
}
return x;
}
void SolveSimultEq(double &x,double &y,double a,double b,double c,double d,double e,double f);
int main(){
int datanum;
double *x1,*y1,*x2,*y2,*x3,*y3;
cin>>datanum;
x1=new double[datanum];
y1=new double[datanum];
x2=new double[datanum];
y2=new double[datanum];
x3=new double[datanum];
y3=new double[datanum];
for( int i=0;i<datanum;i++ ){
cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]>>x3[i]>>y3[i];
}
for( int i=0;i<datanum;i++ ){
double px,py,r;
SolveSimultEq(px,py,2*(x1[i]-x2[i]),2*(y1[i]-y2[i]),square(x1[i])-square(x2[i])+square(y1[i])-square(y2[i]),
2*(x2[i]-x3[i]),2*(y2[i]-y3[i]),square(x2[i])-square(x3[i])+square(y2[i])-square(y3[i]));
r=squaret(square(x1[i]-px)+square(y1[i]-py));
cout<<fixed<<setprecision(3)<<px<<" "<<setprecision(3)<<py<<" "<<setprecision(3)<<r<<endl;
}
delete x1;
delete y1;
delete x2;
delete y2;
delete x3;
delete y3;
return 0;
}
void SolveSimultEq(double &x,double &y,double a,double b,double c,double d,double e,double f){
double delta=a*e-b*d;
x=(c*e-b*f)/delta;
y=(a*f-c*d)/delta;
}
|
a.cc: In function 'int main()':
a.cc:38:19: error: 'squaret' was not declared in this scope; did you mean 'square'?
38 | r=squaret(square(x1[i]-px)+square(y1[i]-py));
| ^~~~~~~
| square
|
s735668791
|
p00010
|
C++
|
#include <stdio.h>
#include<string>
#include<string.h>
#include <math.h>
#include<iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
using namespace std;
/*
//my header
#include "define.h"
#include "geometry.h"*/
#define MyAbs(a) ((a)>0?(a):-(a))
#define MyEqualDoule(a,b) (MyAbs(a-b)<1e-6)
#define foreach(i,n) for(i=0;i<n;++i)
#define foreachd(i,n) for(int i=0;i<n;++i)
#define printfInt1(n) printf("%d\n",n)
#define scanfInt1(n) scanf("%d",&n)
#define scanfInt2(a,b) scanf("%d%d", &a, &b)
#define scanfInt3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scanfFloat2(a,b) scanf("%f%f", &a,&b)
void init()
{
#ifdef _WIN32
freopen("1.txt", "r", stdin);
#endif
}
void func();
int main()
{
init();
func();
return 0;
}
//譁ケ遞?class CMathEquation
{
public:
//ax + by = c;dx + ey = d;荳疲婿遞矩怙隕∽ソ晁ッ∵怏隗」
static void CalcuXY(double&x, double&y, double a, double b, double c, double d,double e,double f)
{
x = (c*e-f*b)*1.0/(a*e - b*d);
y = (c*d-a*f)*1.0/(b*d - a*e);
if(MyEqualDoule(x, 0))
x = 0;
if(MyEqualDoule(y, 0))
y = 0;
}
//蟾イ遏・荳臥せ蟆ア蝨?噪蝨?ソバx?経y蜥悟濠蠕в
static void CalcuCircleByPoint3(double& ox, double& oy, double& r, double x1, double y1, double x2, double y2,double x3, double y3)
{
double a,b,c,d,e,f;
double dx12,dx13,dy12,dy13,dx12_2,dy12_2,dx13_2,dy13_2;
dx12 = x1 - x2;
dx12_2 = dx12 * (x1 + x2);
dy12 = y1 - y2;
dy12_2 = dy12 * (y1 + y2);
dx13 = x1 - x3;
dx13_2 = dx13 * (x1 + x3);
dy13 = y1 - y3;
dy13_2 = dy13 * (y1 + y3);
a = dx12;
b = dy12;
c = (dx12_2 + dy12_2) / 2.0;
d = dy13;
e = dy13;
f = (dx13_2 + dy13_2) / 2.0;
CalcuXY(ox, oy, a, b, c, d, e, f);
r = pow((ox - x1), 2) + pow((oy - y1), 2);
r = sqrt(r);
}
};
void func()
{
int n;
scanf("%d", &n);
while(n--)
{
double x1,y1, x2,y2,x3,y3;
scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
double ox, oy, r;
CMathEquation::CalcuCircleByPoint3(ox, oy, r, x1, y1, x2, y2, x3, y3);
printf("%.3lf %.3lf %.3lf\n", ox, oy, r);
}
}
|
a.cc:50:1: error: expected unqualified-id before '{' token
50 | {
| ^
a.cc: In function 'void func()':
a.cc:100:17: error: 'CMathEquation' has not been declared
100 | CMathEquation::CalcuCircleByPoint3(ox, oy, r, x1, y1, x2, y2, x3, y3);
| ^~~~~~~~~~~~~
|
s222652938
|
p00010
|
C++
|
#include <iomanip>
#include <iostream>
using namespace std;
/** Problem0010 : CIrcumscribed Circle of a Triangle **/
int main()
{
int n;
double X1, Y1, X2, Y2, X3, Y3;
double a, b, c, d, e, f, l, m;
cin >> n;
for (int i=0; i<n; i++) {
cin >> X1 >> Y1 >> X2 >> Y2 >> X3 >> Y3;
a = X1-X2; b = Y1-Y2; c = -(X1*X1+Y1*Y1)+(X2*X2+Y2*Y2);
d = X2-X3; e = Y2-Y3; f = -(X2*X2+Y2*Y2)+(X3*X3+Y3*Y3);
l = (c*e - b*f)/(e*a - b*d); m = (c*d - a*f)/(b*d - a*e);
cout << setprecision(3) << setiosflags(ios::fixed);
cout << -l/2 << " " << -m/2 << " " << sqrt(l*l+m*m-4*n)/2 << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:55: error: 'sqrt' was not declared in this scope
18 | cout << -l/2 << " " << -m/2 << " " << sqrt(l*l+m*m-4*n)/2 << endl;
| ^~~~
|
s849581610
|
p00010
|
C++
|
#include "stdio.h"
#include <iostream>
using namespace std;
/** Problem0010 : CIrcumscribed Circle of a Triangle **/
int main()
{
int N;
double X1, Y1, X2, Y2, X3, Y3;
double a, b, c, d, e, f, l, m, n;
cin >> N;
for (int i=0; i<N; i++) {
cin >> X1 >> Y1 >> X2 >> Y2 >> X3 >> Y3;
a = X1-X2; b = Y1-Y2; c = -(X1*X1+Y1*Y1-X2*X2-Y2*Y2);
d = X2-X3; e = Y2-Y3; f = -(X2*X2+Y2*Y2-X3*X3-Y3*Y3);
l = (c*e - b*f)/(e*a - b*d); m = (c*d - a*f)/(b*d - a*e);
n = -(X1*X1+Y1*Y1+l*X1+m*Y1);
printf("%.3f %.3f %.3f\n",l*-0.5,m*-0.5,sqrt(l*l+m*m-n*4.0)/2.0);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:57: error: 'sqrt' was not declared in this scope
18 | printf("%.3f %.3f %.3f\n",l*-0.5,m*-0.5,sqrt(l*l+m*m-n*4.0)/2.0);
| ^~~~
|
s511405426
|
p00010
|
C++
|
#include<iostream>
using namespace std;
int main()
{
int n;
double x1,y1,x2,y2,x3,y3;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> 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);
cout << x << " " << y << " " << r << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:26:28: error: 'sqrt' was not declared in this scope
26 | double r = sqrt(r_2);
| ^~~~
|
s851787784
|
p00010
|
C++
|
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
int n;
double x1,y1,x2,y2,x3,y3,x,y,r,d,dx1,dx2,dx3;
cin>>n;
while(n--)
{
cin>>x1>>y1>>x2>>y2>>x3>>y3;
d=2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2));
dx=x1*x1+y1*y1;
dx2=x2*x2+y2*y2;
dx3=x3*x3+y3*y3;
x=(dx1*(y2-y3)+dx2*(y3-y3)+dx3*(y1-y2))/d;
y=(dx1*(x3-x2)+dx2*(x1-x3)+dx3*(x2-x1))/d;
r=sqrt(pow(x1-x,2)+pow(y1-y,2));
printf("%.3lf %.3lf %.3lf\n",x,y,r);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:9: error: 'dx' was not declared in this scope; did you mean 'dx3'?
15 | dx=x1*x1+y1*y1;
| ^~
| dx3
|
s476700652
|
p00010
|
C++
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace contest10
{
class Program
{
static void Main(string[] args)
{
var read_line_origin = Console.ReadLine();
if (string.IsNullOrEmpty(read_line_origin))
{
return;
}
//三角形の数
int all_num = int.Parse(read_line_origin);
//空白で分割する
read_line_origin = Console.ReadLine();
string[] words = read_line_origin.Split();
for (int i = 0; i < all_num; i++)
{
//配列の要素、すべてに処理を行う
var num_array = Array.ConvertAll(words, len => double.Parse(len));
//三角形の座標
double x1 = num_array[(i * 6) + 0];
double y1 = num_array[(i * 6) + 1];
double x2 = num_array[(i * 6) + 2];
double y2 = num_array[(i * 6) + 3];
double x3 = num_array[(i * 6) + 4];
double y3 = num_array[(i * 6) + 5];
//辺の長さ
double r1 = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
double r2 = Math.Sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
double r3 = Math.Sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
//計算用
double tmp_1 = (r1 * r1) * (r2 * r2 + r3 * r3 - r1 * r1);
double tmp_2 = (r2 * r2) * (r3 * r3 + r1 * r1 - r2 * r2);
double tmp_3 = (r3 * r3) * (r1 * r1 + r2 * r2 - r3 * r3);
double tri_tmp = tmp_1 + tmp_2 + tmp_3;
double center_x = (tmp_1 * x1 + tmp_2 * x2 + tmp_3 * x3) / tri_tmp;
double center_y = (tmp_1 * y1 + tmp_2 * y2 + tmp_3 * y3) / tri_tmp;
double x = (((x1 * x1 + y1 * y1) * (y2 - y3)) +
((x2 * x2 + y2 * y2) * (y3 - y1)) +
((x3 * x3 + y3 * y3) * (y1 - y2)))
/
((x1 * (y2 - y3)) +
(x2 * (y3 - y1)) +
(x3 * (y1 - y2))
) * 0.5;
double y = (((x1 * x1 + y1 * y1) * (x2 - x3)) + ((x2 * x2 + y2 * y2) * (x3 - x1)) + ((x3 * x3 + y3 * y3) * (x1 - x2))) / ((y1 * (x2 - x3)) + (y2 * (x3 - x1)) + (y3 * (x1 - x2))) * 0.5;
double radius = (r1 * r2 * r3) /
Math.Sqrt(
(r1 + r2 + r3) * (-r1 + r2 + r3) * (r1 - r2 + r3) * (r1 + r2 - r3)
);
Console.WriteLine("{0:f3} {1:f3} {2:f3}", x, y, radius);
}
}
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:10:26: error: 'string' has not been declared
10 | static void Main(string[] args)
| ^~~~~~
a.cc:10:35: error: expected ',' or '...' before 'args'
10 | static void Main(string[] args)
| ^~~~
a.cc:79:6: error: expected ';' after class definition
79 | }
| ^
| ;
a.cc: In static member function 'static void contest10::Program::Main(int*)':
a.cc:12:13: error: 'var' was not declared in this scope
12 | var read_line_origin = Console.ReadLine();
| ^~~
a.cc:14:17: error: 'string' was not declared in this scope
14 | if (string.IsNullOrEmpty(read_line_origin))
| ^~~~~~
a.cc:14:38: error: 'read_line_origin' was not declared in this scope
14 | if (string.IsNullOrEmpty(read_line_origin))
| ^~~~~~~~~~~~~~~~
a.cc:20:27: error: expected primary-expression before 'int'
20 | int all_num = int.Parse(read_line_origin);
| ^~~
a.cc:24:13: error: 'read_line_origin' was not declared in this scope
24 | read_line_origin = Console.ReadLine();
| ^~~~~~~~~~~~~~~~
a.cc:24:32: error: 'Console' was not declared in this scope
24 | read_line_origin = Console.ReadLine();
| ^~~~~~~
a.cc:25:13: error: 'string' was not declared in this scope
25 | string[] words = read_line_origin.Split();
| ^~~~~~
a.cc:25:20: error: expected primary-expression before ']' token
25 | string[] words = read_line_origin.Split();
| ^
a.cc:30:21: error: expected ';' before 'num_array'
30 | var num_array = Array.ConvertAll(words, len => double.Parse(len));
| ^~~~~~~~~
a.cc:33:29: error: 'num_array' was not declared in this scope
33 | double x1 = num_array[(i * 6) + 0];
| ^~~~~~~~~
a.cc:41:29: error: 'Math' was not declared in this scope
41 | double r1 = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
| ^~~~
|
s989400016
|
p00010
|
C++
|
import java.util.Scanner;
import java.lang.Math;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
for(int i = 0; i < n; i++) {
double x1,y1,x2,y2,x3,y3;
x1 = scan.nextDouble();
y1 = scan.nextDouble();
x2 = scan.nextDouble();
y2 = scan.nextDouble();
x3 = scan.nextDouble();
y3 = scan.nextDouble();
double a1, a2, b1, b2, c1, c2, px, py;
a1 = 2 * (x2 - x1);
b1 = 2 * (y2 - y1);
c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
a2 = 2 * (x3 - x1);
b2 = 2 * (y3 - y1);
c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
double temp = a1*b2 - a2*b1;
px = (b1*c2 - b2*c1) / temp;
py = (c1*a2 - c2*a1) / temp;
double r = Math.sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py));
System.out.printf("%.3f %.3f %.3f", px, py, r);
}
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.lang.Math;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:15: error: expected ':' before 'static'
5 | public static void main(String[] args) {
| ^~~~~~~
| :
a.cc:5:33: error: 'String' has not been declared
5 | public static void main(String[] args) {
| ^~~~~~
a.cc:5:42: error: expected ',' or '...' before 'args'
5 | public static void main(String[] args) {
| ^~~~
a.cc:39:2: error: expected ';' after class definition
39 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:6:17: error: 'Scanner' was not declared in this scope
6 | Scanner scan = new Scanner(System.in);
| ^~~~~~~
a.cc:8:25: error: 'scan' was not declared in this scope
8 | int n = scan.nextInt();
| ^~~~
a.cc:34:36: error: 'Math' was not declared in this scope
34 | double r = Math.sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py));
| ^~~~
a.cc:36:25: error: 'System' was not declared in this scope
36 | System.out.printf("%.3f %.3f %.3f", px, py, r);
| ^~~~~~
|
s379892313
|
p00011
|
Java
|
import java.util.Scanner;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int w = sc.nextInt();
int n = sc.nextInt();
int[] c = new int[2];
int f=0;
int s=0;
int temp = 0;
int[] amida = new int[w];
for(int i = 0 ; i < w ; i ++)
amida[i]=i+1;
for(int i = 0 ; i < n ; i ++){
c=br.readLine().split(",");
f=Integer.parseInt(c[0]);
s=Integer.parseInt(c[1]);
temp=amida[f-1];
amida[f-1]=amida[s-1];
amida[s-1]=temp;
}
for(int i = 0;i>0;i++){
System.out.println(amida[i]);
}
}
}
|
Main.java:18: error: incompatible types: String[] cannot be converted to int[]
c=br.readLine().split(",");
^
Main.java:19: error: incompatible types: int cannot be converted to String
f=Integer.parseInt(c[0]);
^
Main.java:20: error: incompatible types: int cannot be converted to String
s=Integer.parseInt(c[1]);
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
|
s252144112
|
p00011
|
Java
|
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int a[] = new int[w];
int b[] = new int[w];
int c[] = new int[w];
int temp;
int i = 0;
for(i=0;i<w;i++){
a[i] = i + 1;
b[i] = sc.nextInt();
c[i] = sc.nextInt();
}
for(i=0;i<w;i++){
temp = a[b[i]];
a[b[i]] = a[c[i]];
a[c[i]] = temp;
}
for(i=0;i<w;i++){
System.out.println(a[i]);
}
}
|
Main.java:27: error: reached end of file while parsing
}
^
1 error
|
s144187170
|
p00011
|
Java
|
import java.io.*;
import java.util.*;
public class Amidakuji{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int a[] = new int[w];
int b[] = new int[w];
int c[] = new int[w];
int temp;
int i = 0;
for(i=0;i<w;i++){
a[i] = i + 1;
b[i] = sc.nextInt();
c[i] = sc.nextInt();
}
for(i=0;i<w;i++){
temp = a[b[i]];
a[b[i]] = a[c[i]];
a[c[i]] = temp;
}
for(i=0;i<w;i++){
System.out.println(a[i]);
}
}
}
|
Main.java:4: error: class Amidakuji is public, should be declared in a file named Amidakuji.java
public class Amidakuji{
^
1 error
|
s349378489
|
p00011
|
Java
|
import java.io.*;
import java.util.*;
public class Amidakuji{
public static void main(String[] args){
Scanner sc = new Scanner(System.in).useDelimiter("\\D");;
int w = sc.nextInt();
int n = sc.nextInt();
int a[] = new int[w];
int b[] = new int[n];
int c[] = new int[n];
int temp = 0;
int i = 0;
for(i=0;i<n;i++){
b[i] = sc.nextInt();
c[i] = sc.nextInt();
}
for(i=0;i<w;i++){
a[i] = i + 1;
}
for(i=0;i<n;i++){
temp = a[b[i]];
a[b[i]] = a[c[i]];
a[c[i]] = temp;
}
for(i=0;i<w;i++){
System.out.println(a[i]);
}
}
}
|
Main.java:4: error: class Amidakuji is public, should be declared in a file named Amidakuji.java
public class Amidakuji{
^
1 error
|
s132817371
|
p00011
|
Java
|
import java.util.Scanner;
public class Main2 {
public static void main(String[] args) {
int n,w;
Scanner sc=new Scanner(System.in);
w=sc.nextInt();
n=sc.nextInt();
int[] values = new int[w];
for(int i=0;i<w;i++){
values[i] = i+ 1;
}
for(int i= 0; i< n; i++) {
String str= sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) -1;
int b = Integer.parseInt(ab[1]) -1;
int temp;
temp=values[a];
values[a]=values[b];
values[b]=temp;
}
for(int i=0;i<5;i++)
System.out.println(values[i]);
}
}
|
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
^
1 error
|
s328502769
|
p00011
|
Java
|
public class Main {
public static void Main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int[] a = new int[w+1];
for(int i=1;i<=w;i++)a[i]=i;
int m = sc.nextInt();
while(m--!=0){
String[] s = sc.next().split(",");
int l = Integer.parseInt(s[0]);
int r = Integer.parseInt(s[1]);
int t = a[l];
a[l] = a[r];
a[r] = t;
}
for(int i=1;i<=w;i++)System.out.println(a[i]);
}
}
|
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s341235631
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int c = sc.nextInt();
int a, b;
int[] wide = new int[w];
for (int i = 0; i < w; i++) {
wide[i] = i + 1;
}
for (int i = 0; i < c; i++) {
String line = sc.nextLine();
a = Integer.parseInt(line.charAt(0));
b = Integer.parseInt(line.charAt(2));
swap(wide[a], wide[b]);
}
for (int i = 0; i < w; i++) {
System.out.println(wide[i]);
}
}
public static void swap(int x, int y) {
int z;
z = x;
x = y;
y = z;
}
}
|
Main.java:15: error: incompatible types: char cannot be converted to String
a = Integer.parseInt(line.charAt(0));
^
Main.java:16: error: incompatible types: char cannot be converted to String
b = Integer.parseInt(line.charAt(2));
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
|
s939810406
|
p00011
|
Java
|
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int w = sc.nextInt();
int n =sc.nextInt();
int[] values =new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
String str =sc.next();
String[] ab=str.split(",");
int a =Integer.parseInt(ab[0])-1;
int b =Interger.parseInt(ab[1])-1;
int temp;
temp=values[a];
values[a]=values[b];
values[b]=temp;
}
for(int i=0;i<w;i++){
System.out.printf("%d\n",values[i]);
}
}
}
|
Main.java:15: error: cannot find symbol
int b =Interger.parseInt(ab[1])-1;
^
symbol: variable Interger
location: class Main
1 error
|
s215320503
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
static int[]z;
public static int a,b,n,w,t;
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
w=sc.nextInt();
n=sc.nextInt();
z = new int[w];
mmm();
for(int i=0;i<w;i++)
System.out.println(z[i]);
}
static void mmm(){
for(int i=0;i<w;i++){
z[i] = i+ 1;
}
for(int i= 0; i< n; i++) {
String mm= sc.next();
String[] a1 = mm.split(",");
a = Integer.parseInt(a1[0]) -1;
b = Integer.parseInt(a1[1]) -1;
t=z[a];
z[a]=z[b];
z[b]=t;
}
}
}
|
Main.java:20: error: cannot find symbol
String mm= sc.next();
^
symbol: variable sc
location: class Main
1 error
|
s483554930
|
p00011
|
Java
|
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
int p,q,r,s;
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
p=sc.nextInt();
q=sc.nextInt();
r=k[p-1];
s=k[q-1];
k[p-1]=s;
k[q-1]=r;
}
for(int k=0;k<w;k++){
System.out.println(k[k]);
}
}
}
|
Main.java:21: error: variable k is already defined in method main(String[])
for(int k=0;k<w;k++){
^
Main.java:22: error: array required, but int found
System.out.println(k[k]);
^
2 errors
|
s481863614
|
p00011
|
Java
|
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
int p,q,r;
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.nextLine.split(",");
p=Integer.perseInt(line[0]);
q=Integer.perseInt(line[1]);
r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
}
}
|
Main.java:14: error: cannot find symbol
String[] line=sc.nextLine.split(",");
^
symbol: variable nextLine
location: variable sc of type Scanner
Main.java:15: error: cannot find symbol
p=Integer.perseInt(line[0]);
^
symbol: method perseInt(String)
location: class Integer
Main.java:16: error: cannot find symbol
q=Integer.perseInt(line[1]);
^
symbol: method perseInt(String)
location: class Integer
3 errors
|
s287707463
|
p00011
|
Java
|
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] k=new int[w];
for(int i=0;i<w;i++){
k[i]=i+1;
}
for(int j=0;j<n;j++){
String[] line=sc.nextLine().split(",");
int p=Integer.perseInt(line[0]);
int q=Integer.perseInt(line[1]);
int r=k[p-1];
k[p-1]=k[q-1];
k[q-1]=r;
}
for(int l=0;l<w;l++){
System.out.println(k[l]);
}
}
}
|
Main.java:14: error: cannot find symbol
int p=Integer.perseInt(line[0]);
^
symbol: method perseInt(String)
location: class Integer
Main.java:15: error: cannot find symbol
int q=Integer.perseInt(line[1]);
^
symbol: method perseInt(String)
location: class Integer
2 errors
|
s036480271
|
p00011
|
Java
|
import java.util.Scanner;
public class AOJ {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int T[] = new int[w];
for(int i=0;i<w;i++){
T[i]=i+1;
//System.out.println(T[i]);
}
int n = sc.nextInt();
for(int i = 0;i<n;i++ ){
int temp = 0;
String A = sc.next();
String[] fruit = A.split(",");
int a = Integer.parseInt(fruit[0]);
int b = Integer.parseInt(fruit[1]);
temp = T[a-1];
T[a-1]=T[b-1];
T[b-1]=temp;
}
for(int i = 0;i<w;i++){
System.out.println(T[i]);
}
}
}
|
Main.java:2: error: class AOJ is public, should be declared in a file named AOJ.java
public class AOJ {
^
1 error
|
s979581830
|
p00011
|
Java
|
public class Main {
public static void main(String[] args) {
Scanner sc = null;
try {
sc = new Scanner(System.in);
// 縦線の数
int w = sc.nextInt();
// あみだのスタートライン
int[] nums = new int[w];
for (int i = 0; i < w; i++) {
nums[i] = i + 1;
}
// 横線の数
int n = sc.nextInt();
// 横線を引く
for (int i = 0; i < n; i++) {
String[] input = sc.next().split(",");
int a = Integer.parseInt(input[0]);
int b = Integer.parseInt(input[1]);
int work = nums[a - 1];
nums[a - 1] = nums[b - 1];
nums[b - 1] = work;
}
// 結果出力
for (int result : nums) {
System.out.println(result);
}
} finally {
sc.close();
}
}
}
|
Main.java:4: error: cannot find symbol
Scanner sc = null;
^
symbol: class Scanner
location: class Main
Main.java:6: error: cannot find symbol
sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s118370862
|
p00011
|
Java
|
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int num[]=new int[w+1];
for(int i=1;i<=w;i++){
num[i]=i;
}
int n=sc.nextInt();
for(int i=0;i<n;i++){
String[] str=sc.next().split(",");
int a=Integer.parseInt(str[0]);
int b=Integer.parseInt(str[1]);
int c=num[a];
num[a]=num[b];
num[b]=c;
}
for(int i=1;i<=w;i++){
System.out.println(num[i]);
}
sc.close();
}
|
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
^
(use --enable-preview to enable unnamed classes)
1 error
|
s156532106
|
p00011
|
Java
|
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int num[]=new int[w+1];
for(int i=1;i<=w;i++){
num[i]=i;
}
int n=sc.nextInt();
for(int i=0;i<n;i++){
String[] str=sc.next().split(",");
int a=Integer.parseInt(str[0]);
int b=Integer.parseInt(str[1]);
int c=num[a];
num[a]=num[b];
num[b]=c;
}
for(int i=1;i<=w;i++){
System.out.println(num[i]);
}
sc.close();
}
|
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
^
(use --enable-preview to enable unnamed classes)
1 error
|
s251047542
|
p00011
|
Java
|
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int num[]=new int[w+1];
for(int i=1;i<=w;i++){
num[i]=i;
}
int n=sc.nextInt();
for(int i=0;i<n;i++){
String[] str=sc.next().split(",");
int a=Integer.parseInt(str[0]);
int b=Integer.parseInt(str[1]);
int c=num[a];
num[a]=num[b];
num[b]=c;
}
for(int i=1;i<=w;i++){
System.out.println(num[i]);
}
sc.close();
}
|
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
^
(use --enable-preview to enable unnamed classes)
1 error
|
s175960846
|
p00011
|
Java
|
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int num[]=new int[w+1];
for(int i=1;i<=w;i++){
num[i]=i;
}
int n=sc.nextInt();
for(int i=0;i<n;i++){
String[] str=sc.next().split(",");
int a=Integer.parseInt(str[0]);
int b=Integer.parseInt(str[1]);
int c=num[a];
num[a]=num[b];
num[b]=c;
}
for(int i=1;i<=w;i++){
System.out.println(num[i]);
}
sc.close();
}
|
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
^
(use --enable-preview to enable unnamed classes)
1 error
|
s686494255
|
p00011
|
Java
|
import java.util.Scanner;
public class pro4_3 {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
Scanner sc= new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i= 0; i< values.length; i++) {
values[i] = i+ 1;
}
for(int i= 0; i< n; i++) {
String str= sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) -1;
int b = Integer.parseInt(ab[1]) -1;
// aとbを使ってvaluesを操作しよう
int c=0;
c=values[a];
values[a]=values[b];
values[b]=c;
}
// valuesを出力しよう
for(int i= 0; i<= n; i++) {
System.out.println(values[i]);
}
System.out.println('\n');
}
}
|
Main.java:2: error: class pro4_3 is public, should be declared in a file named pro4_3.java
public class pro4_3 {
^
1 error
|
s079749601
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int kari;
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
kari = values[a];
values[a] = values[b];
values[b] = values[a];
}
// values??????????????????
for(i = 0;i<values;i++){
System.out.println("values[i]");
i++
}
}
}
|
Main.java:26: error: ';' expected
i++
^
1 error
|
s324480325
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int kari;
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
kari = values[a];
values[a] = values[b];
values[b] = values[a];
}
// values??????????????????
for(i = 0;i<values;i++){
System.out.println("values[i]");
i++;
}
}
}
|
Main.java:24: error: cannot find symbol
for(i = 0;i<values;i++){
^
symbol: variable i
location: class Main
Main.java:24: error: cannot find symbol
for(i = 0;i<values;i++){
^
symbol: variable i
location: class Main
Main.java:24: error: cannot find symbol
for(i = 0;i<values;i++){
^
symbol: variable i
location: class Main
Main.java:26: error: cannot find symbol
i++;
^
symbol: variable i
location: class Main
4 errors
|
s833172639
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int kari;
int i:
int[] values = new int[w];
for (i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
kari = values[a];
values[a] = values[b];
values[b] = values[a];
}
// values??????????????????
for(i = 0;i<values;i++){
System.out.println("values[i]");
i++;
}
}
}
|
Main.java:9: error: ';' expected
int i:
^
1 error
|
s323955648
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int tmp = values[a];
values[a] = values[b];
values[b] = tmp;
}
// values??????????????????
for(i=0;i<w;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:23: error: cannot find symbol
for(i=0;i<w;i++){
^
symbol: variable i
location: class Main
Main.java:23: error: cannot find symbol
for(i=0;i<w;i++){
^
symbol: variable i
location: class Main
Main.java:23: error: cannot find symbol
for(i=0;i<w;i++){
^
symbol: variable i
location: class Main
Main.java:24: error: cannot find symbol
System.out.println(values[i]);
^
symbol: variable i
location: class Main
4 errors
|
s054720459
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int kari;
int i;
int[] values = new int[w];
for (i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
kari = values[a];
values[a] = values[b];
values[b] = values[a];
}
// values??????????????????
for(i = 0;i<values;i++){
System.out.println("values[i]");
i++;
}
}
}
|
Main.java:25: error: bad operand types for binary operator '<'
for(i = 0;i<values;i++){
^
first type: int
second type: int[]
1 error
|
s352920628
|
p00011
|
Java
|
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
int c;
c = values[a];
values[a] = values[b];
values[b] = c;
}
for (int i = 0; i < values.length; i++) {
System.out.println(values[i]);
}
}
}
|
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s154610182
|
p00011
|
Java
|
import java.util.Scanner;
public class AOJ3_3{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i=0;i<values.length;i++){
values[i] = i + 1;
}
for(int i = 0;i<n;i++){
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) -1;
int b = Integer.parseInt(ab[0]) -1;
System.out.println(values[a]);
int temp = values[a];
values[a] = values[b];
values[b] = temp;
System.out.println(values[a]);
}
values[0] = 2;
values[4] = 3;
for(int i = 0;i<w;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:3: error: class AOJ3_3 is public, should be declared in a file named AOJ3_3.java
public class AOJ3_3{
^
1 error
|
s645592939
|
p00011
|
Java
|
import java.util,Scanner;
public class Main{
public statiac void main(String[] args){
Scanner sc = new Scanner(System.in);
int w =sc.nextInt();
int n =sc.nextInt();
int[] values =new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
string str= sc.next();
String[]ab= str.split(",");
int a=Integer.parseInt(ab[0])-1;
int b=Integer.parseInt(ab[0])-1;
values[a]=b+1;
values[b]=a+1;
}
for(int i=0;i<values.length;i++){
printf("%d\n",values[i]);
}
}
}
|
Main.java:1: error: ';' expected
import java.util,Scanner;
^
Main.java:4: error: <identifier> expected
public statiac void main(String[] args){
^
2 errors
|
s941602285
|
p00011
|
Java
|
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w =sc.nextInt();
int n =sc.nextInt();
int[] values =new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
string str= sc.next();
String[]ab= str.split(",");
int a=Integer.parseInt(ab[0])-1;
int b=Integer.parseInt(ab[0])-1;
values[a]=b+1;
values[b]=a+1;
}
for(int i=0;i<values.length;i++){
printf("%d\n",values[i]);
}
}
}
|
Main.java:13: error: cannot find symbol
string str= sc.next();
^
symbol: class string
location: class Main
Main.java:21: error: cannot find symbol
printf("%d\n",values[i]);
^
symbol: method printf(String,int)
location: class Main
2 errors
|
s183093343
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int c = values[a];
values[a]=values[b];
values[b] = int c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:20: error: '.class' expected
values[b] = int c;
^
1 error
|
s384659299
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int c = values[a];
values[a]=values[b];
values[b] = int c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:20: error: '.class' expected
values[b] = int c;
^
1 error
|
s730290106
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int c = values[a];
values[a]=values[b];
values[b] = int c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:20: error: '.class' expected
values[b] = int c;
^
1 error
|
s741028918
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int c = values[a];
values[a]=values[b];
values[b] = c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:23: error: cannot find symbol
for(i = 0;i<w;i++){
^
symbol: variable i
location: class Main
Main.java:23: error: cannot find symbol
for(i = 0;i<w;i++){
^
symbol: variable i
location: class Main
Main.java:23: error: cannot find symbol
for(i = 0;i<w;i++){
^
symbol: variable i
location: class Main
Main.java:24: error: cannot find symbol
System.out.printf(values[i]);
^
symbol: variable i
location: class Main
Main.java:24: error: no suitable method found for printf(int)
System.out.printf(values[i]);
^
method PrintStream.printf(String,Object...) is not applicable
(argument mismatch; int cannot be converted to String)
method PrintStream.printf(Locale,String,Object...) is not applicable
(argument mismatch; int cannot be converted to Locale)
5 errors
|
s081979974
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int i;
int c = 0;
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
c = values[a];
values[a] = values[b];
values[b] = c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:11: error: variable i is already defined in method main(String[])
for (int i = 0; i < values.length; i++) {
^
Main.java:14: error: variable i is already defined in method main(String[])
for (int i = 0; i < n; i++) {
^
Main.java:26: error: no suitable method found for printf(int)
System.out.printf(values[i]);
^
method PrintStream.printf(String,Object...) is not applicable
(argument mismatch; int cannot be converted to String)
method PrintStream.printf(Locale,String,Object...) is not applicable
(argument mismatch; int cannot be converted to Locale)
3 errors
|
s360792645
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int i;
int c = 0;
int[] values = new int[w];
for (i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
c = values[a];
values[a] = values[b];
values[b] = c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:26: error: no suitable method found for printf(int)
System.out.printf(values[i]);
^
method PrintStream.printf(String,Object...) is not applicable
(argument mismatch; int cannot be converted to String)
method PrintStream.printf(Locale,String,Object...) is not applicable
(argument mismatch; int cannot be converted to Locale)
1 error
|
s665890018
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int i;
int c = 0;
int[] values = new int[w];
for (i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
c = values[a];
values[a] = values[b];
values[b] = c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:26: error: no suitable method found for printf(int)
System.out.printf(values[i]);
^
method PrintStream.printf(String,Object...) is not applicable
(argument mismatch; int cannot be converted to String)
method PrintStream.printf(Locale,String,Object...) is not applicable
(argument mismatch; int cannot be converted to Locale)
1 error
|
s693808027
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int i;
int c = 0;
int[] values = new int[w];
for (i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
c = values[a];
values[a] = values[b];
values[b] = c;
}
// values??????????????????
for(i = 0;i<w;i++){
System.out.printf(values[i]);
}
}
}
|
Main.java:26: error: no suitable method found for printf(int)
System.out.printf(values[i]);
^
method PrintStream.printf(String,Object...) is not applicable
(argument mismatch; int cannot be converted to String)
method PrintStream.printf(Locale,String,Object...) is not applicable
(argument mismatch; int cannot be converted to Locale)
1 error
|
s247356826
|
p00011
|
Java
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int w, n, a, b, i, swap;
w = scan.nextInt();
int[] amidakuji = new int[w];
for (i = 0; i < n; i ++) amidakuji[i] = i;
n = scan.nextInt();
for (i = 0; i < n; i ++) {
a = scan.nextInt();
b = scan.nextInt();
a --; b --;
swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
}
for (i = 0; i < n; i ++) {
System.out.println(amidakuji[i] + 1);
}
}
}
|
Main.java:8: error: variable n might not have been initialized
for (i = 0; i < n; i ++) amidakuji[i] = i;
^
1 error
|
s759878155
|
p00011
|
Java
|
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w =sc.nextInt();
int n =sc.nextInt();
int[] values =new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
String str= sc.next();
String[]ab= str.split(",");
int a=Integer.parseInt(ab[0])-1;
int b=Integer.parseInt(ab[1])-1;
int t=swap[a];
swap[a]=swap[b];
swap[b]=t;
}
for(int i=0;i<values.length;i++){
System.out.printf("%d\n",values[i]);
}
}
}
|
Main.java:17: error: cannot find symbol
int t=swap[a];
^
symbol: variable swap
location: class Main
Main.java:18: error: cannot find symbol
swap[a]=swap[b];
^
symbol: variable swap
location: class Main
Main.java:18: error: cannot find symbol
swap[a]=swap[b];
^
symbol: variable swap
location: class Main
Main.java:19: error: cannot find symbol
swap[b]=t;
^
symbol: variable swap
location: class Main
4 errors
|
s000621396
|
p00011
|
Java
|
import java.util.Scanner;
public class AOJ3_3{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i=0;i<values.length;i++){
values[i] = i + 1;
}
for(int i = 0;i<n;i++){
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) -1;
int b = Integer.parseInt(ab[1]) -1;
int temp = values[a];
values[a] = values[b];
values[b] = temp;
}
for(int i = 0;i<w;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:3: error: class AOJ3_3 is public, should be declared in a file named AOJ3_3.java
public class AOJ3_3{
^
1 error
|
s347829013
|
p00011
|
Java
|
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] values = new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
int work;
work = values[a];
values[a] = values[b];
values[b] = work;
}
for(int i=0;i<values.length;i++){
System.out.println(values[i]);
}
}
|
Main.java:23: error: reached end of file while parsing
}
^
1 error
|
s503806537
|
p00011
|
Java
|
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] values = new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
int work;
work = values[a];
values[a] = values[b];
values[b] = work;
}
for(int i=0;i<values.length;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:6: error: cannot find symbol
int[] values = new int[w];
^
symbol: variable w
location: class Main
Main.java:10: error: cannot find symbol
for(int i=0;i<n;i++){
^
symbol: variable n
location: class Main
2 errors
|
s154177906
|
p00011
|
Java
|
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc,nextInt();
int[] values = new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
int work;
work = values[a];
values[a] = values[b];
values[b] = work;
}
for(int i=0;i<values.length;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:7: error: ';' expected
int n = sc,nextInt();
^
1 error
|
s185388791
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// aとbを使ってvaluesを操作しよう
int c;
c=a;
a=b;
b=c;
}
// valuesを出力しよう
for (i=0;i<n;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:24: error: cannot find symbol
for (i=0;i<n;i++){
^
symbol: variable i
location: class Main
Main.java:24: error: cannot find symbol
for (i=0;i<n;i++){
^
symbol: variable i
location: class Main
Main.java:24: error: cannot find symbol
for (i=0;i<n;i++){
^
symbol: variable i
location: class Main
Main.java:25: error: cannot find symbol
System.out.println(values[i]);
^
symbol: variable i
location: class Main
4 errors
|
s531146088
|
p00011
|
Java
|
import java.util.Scanner;
public class Draw{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int w=sc.nextInt();
int n=sc.nextInt();
int[] values=new int[w];
for(int i=0;i<values.length;i++){
values[i]=i+1;
}
for(int i=0;i<n;i++){
String str=sc.next();
String[] ab=str.split(",");
int a=Integer.parseInt(ab[0])-1;
int b=Integer.parseInt(ab[1])-1;
int c;
c=values[a];
values[a]=values[b];
values[b]=c;
}
for(int i=0;i<values.length;i++){
System.out.println(values[i]);
}
}
}
|
Main.java:3: error: class Draw is public, should be declared in a file named Draw.java
public class Draw{
^
1 error
|
s449293777
|
p00011
|
Java
|
mport java.util.Scanner;
public class Main {
public static void main(String[] args) { // ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1; // a??¨b????????£???values??????????????????
int c = values[a];
values[a] = values[b];
values[b] = c;
}
for (int i = 0; i < w; i++) {
System.out.println(values[i]);
}
}
}
|
Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
1 error
|
s933976145
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int blank;
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
blank=values[a];
values[a]=values[b];
values[b]=blank;// a??¨b????????£???values??????????????????
}
for(int i = 0; i < values.length; i++){
println(values[i]);// values??????????????????
}
}
|
Main.java:25: error: reached end of file while parsing
}
^
1 error
|
s629556643
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int blank;
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
blank=values[a];
values[a]=values[b];
values[b]=blank;// a??¨b????????£???values??????????????????
}
for(int i = 0; i < values.length; i++){
println(values[i]);// values??????????????????
}
}
}
|
Main.java:23: error: cannot find symbol
println(values[i]);// values??????????????????
^
symbol: method println(int)
location: class Main
1 error
|
s821174974
|
p00011
|
Java
|
import java.io.*;
public class DrawLot{
public static void main(String[] args){
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
String s,t,u;
int a,b,hako;
hako=0;
String[] abc=new String[2];
int[] xyz=new int[2];
try{
s=reader.readLine();
t=reader.readLine();
a=Integer.parseInt(s);
b=Integer.parseInt(t);
int[] x=new int[a+1];
x[0]=0;
for(int j=1;j<(a+1);j++){
x[j]=j;
}
for(int i=0;i<b;i++){
u=reader.readLine();
abc=u.split(",");
for(int k=0;k<2;k++){
xyz[k]=Integer.parseInt(abc[k]);
}
hako=x[xyz[0]];;
x[xyz[0]]=x[xyz[1]];
x[xyz[1]]=hako;
}
for(int l=1;l<(a+1);l++){
System.out.println(x[l]);
}
}catch(IOException e){
System.out.println(e);
}
}
}
|
Main.java:3: error: class DrawLot is public, should be declared in a file named DrawLot.java
public class DrawLot{
^
1 error
|
s092491288
|
p00011
|
Java
|
import java.io.*;
public class main{
public static void main(String[] args){
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
String s,t,u;
int a,b,hako;
hako=0;
String[] abc=new String[2];
int[] xyz=new int[2];
try{
s=reader.readLine();
t=reader.readLine();
a=Integer.parseInt(s);
b=Integer.parseInt(t);
int[] x=new int[a+1];
x[0]=0;
for(int j=1;j<(a+1);j++){
x[j]=j;
}
for(int i=0;i<b;i++){
u=reader.readLine();
abc=u.split(",");
for(int k=0;k<2;k++){
xyz[k]=Integer.parseInt(abc[k]);
}
hako=x[xyz[0]];;
x[xyz[0]]=x[xyz[1]];
x[xyz[1]]=hako;
}
for(int l=1;l<(a+1);l++){
System.out.println(x[l]);
}
}catch(IOException e){
System.out.println(e);
}
}
}
|
Main.java:3: error: class main is public, should be declared in a file named main.java
public class main{
^
1 error
|
s674901869
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\??????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int j = 0, k = 0;
int[] a = new int[w + 1];
for (int i = 0; i <= w; i++) {
a[i] = i;
}
for (int i = 1; i <= n; i++) {
String[] str = sc.next().split(".");
j = Integer.parseInt(s[0]);
k = Integer.parseInt(s[1]);
a[0] = a[j];
a[j] = a[k];
a[k] = a[0];
}
for(int i = 1; i <= w; i++){
System.out.printf("%d?\n", a[i]);
}
sc.close();
|
Main.java:25: error: reached end of file while parsing
sc.close();
^
1 error
|
s170785646
|
p00011
|
Java
|
import java.util.Scanner;
public class DrawingLots {
public static void main(String[] args) {
// ?¨??????\??????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int j = 0, k = 0;
int[] a = new int[w + 1];
for (int i = 0; i <= w; i++) {
a[i] = i;
}
for (int i = 1; i <= n; i++) {
String[] str = sc.next().split(".");
j = Integer.parseInt(s[0]);
k = Integer.parseInt(s[1]);
a[0] = a[j];
a[j] = a[k];
a[k] = a[0];
}
for(int i = 1; i <= w; i++){
System.out.printf("%d?\n", a[i]);
}
sc.close();
|
Main.java:25: error: reached end of file while parsing
sc.close();
^
1 error
|
s210708382
|
p00011
|
Java
|
import java.util.Scanner;
public class DrawingLots {
public static void main(String[] args) {
// ?¨??????\??????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int j = 0, k = 0;
int[] a = new int[w + 1];
for (int i = 1; i <= w; i++) {
a[i] = i;
}
for (int i = 1; i <= n; i++) {
String[] s = sc.next().split(".");
j = Integer.parseInt(s[0]);
k= Integer.parseInt(s[1]);
a[0] = a[j];
a[j] = a[k];
a[k] = a[0];
}
for( i = 1; i <= w; i++){
System.out.printf("%d?\n", a[i]);
}
sc.close();
}
}
|
Main.java:2: error: class DrawingLots is public, should be declared in a file named DrawingLots.java
public class DrawingLots {
^
Main.java:22: error: cannot find symbol
for( i = 1; i <= w; i++){
^
symbol: variable i
location: class DrawingLots
Main.java:22: error: cannot find symbol
for( i = 1; i <= w; i++){
^
symbol: variable i
location: class DrawingLots
Main.java:22: error: cannot find symbol
for( i = 1; i <= w; i++){
^
symbol: variable i
location: class DrawingLots
Main.java:23: error: cannot find symbol
System.out.printf("%d?\n", a[i]);
^
symbol: variable i
location: class DrawingLots
5 errors
|
s493749281
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\??????????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int j = 0, k = 0;
int[] a = new int[w + 1];
for (int i = 1; i <= w; i++) {
a[i] = i;
}
for (int i = 1; i <= n; i++) {
String[] s = sc.next().split(".");
j = Integer.parseInt(s[0]);
k= Integer.parseInt(s[1]);
a[0] = a[j];
a[j] = a[k];
a[k] = a[0];
}
for( i = 1; i <= w; i++){
System.out.printf("%d\n", a[i]);
}
sc.close();
}
}
|
Main.java:22: error: cannot find symbol
for( i = 1; i <= w; i++){
^
symbol: variable i
location: class Main
Main.java:22: error: cannot find symbol
for( i = 1; i <= w; i++){
^
symbol: variable i
location: class Main
Main.java:22: error: cannot find symbol
for( i = 1; i <= w; i++){
^
symbol: variable i
location: class Main
Main.java:23: error: cannot find symbol
System.out.printf("%d\n", a[i]);
^
symbol: variable i
location: class Main
4 errors
|
s754161160
|
p00011
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\??????????????????????????????????????????
Scanner sc = new Scanner(System.in); int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int c;
c = values[a];
values[a] = values[b];
values[b] = c;
}
// values??????????????????
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
|
Main.java:23: error: not a statement
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: ';' expected
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: ';' expected
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: ';' expected
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: ')' or ',' expected
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: not a statement
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: ';' expected
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
Main.java:23: error: reached end of file while parsing
-uuu:**-F1 Main.java Top L1 (Java/l Abbrev)---------------------------
^
8 errors
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.