submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s327352062
p00004
C++
#include <iostream> using namespace std; int main() { double a, b, c, d, e, f, x, y, t; while(cin >> a >> b >> c >> d >> e >> f) { t = 1.0 / (a*e - b*d); x = (e*c - b*f) * t; y = (a*f - d*c) * t; cout << x << setprecision(3) << y << setprecision(3) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:30: error: 'setprecision' was not declared in this scope 11 | cout << x << setprecision(3) << y << setprecision(3) << endl; | ^~~~~~~~~~~~ a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>' 1 | #include <iostream> +++ |+#include <iomanip> 2 |
s512317149
p00004
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"*/ void init() { #ifdef _WIN32 freopen("1.txt", "r", stdin); #endif } void func(); int main() { init(); func(); return 0; } #define MyAbs(a) ((a)>0?(a):-(a)) #define MyEqualDoule(a,b) (MyAbs(a,b)<1e-6) void func() { double a,b,c,d,e,f, x, y; while(~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)) { if(MyEqualDoule(a*e-b*d,0)) x = 0; else x = (c*e-f*b)/(a*e - b*d); if(MyEqualDoule(b*d - a*e),0) y = 0; else y = (c*d-a*f)/(b*d - a*e); printf("%.3lf %.3lf\n", x, y); } }
a.cc:43:42: error: macro "MyAbs" passed 2 arguments, but takes just 1 43 | if(MyEqualDoule(a*e-b*d,0)) | ^ a.cc:35:9: note: macro "MyAbs" defined here 35 | #define MyAbs(a) ((a)>0?(a):-(a)) | ^~~~~ a.cc:48:42: error: macro "MyEqualDoule" requires 2 arguments, but only 1 given 48 | if(MyEqualDoule(b*d - a*e),0) | ^ a.cc:36:9: note: macro "MyEqualDoule" defined here 36 | #define MyEqualDoule(a,b) (MyAbs(a,b)<1e-6) | ^~~~~~~~~~~~ a.cc: In function 'void func()': a.cc:36:28: error: 'MyAbs' was not declared in this scope 36 | #define MyEqualDoule(a,b) (MyAbs(a,b)<1e-6) | ^~~~~ a.cc:43:20: note: in expansion of macro 'MyEqualDoule' 43 | if(MyEqualDoule(a*e-b*d,0)) | ^~~~~~~~~~~~ a.cc:48:20: error: 'MyEqualDoule' was not declared in this scope 48 | if(MyEqualDoule(b*d - a*e),0) | ^~~~~~~~~~~~
s716447114
p00004
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) void init() { #ifdef _WIN32 freopen("1.txt", "r", stdin); #endif } void func(); int main() { init(); func(); return 0; } void func() { double a,b,c,d,e,f, x, y; while(~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)) { if(MyEqualDoule(a*e-b*d,0)) x = 0; else x = (c*e-f*b)/(a*e - b*d); if(MyEqualDoule(b*d - a*e),0) y = 0; else y = (c*d-a*f)/(b*d - a*e); printf("%.3lf %.3lf\n", x, y); } }
a.cc:49:42: error: macro "MyEqualDoule" requires 2 arguments, but only 1 given 49 | if(MyEqualDoule(b*d - a*e),0) | ^ a.cc:19:9: note: macro "MyEqualDoule" defined here 19 | #define MyEqualDoule(a,b) (MyAbs(a-b)<1e-6) | ^~~~~~~~~~~~ a.cc: In function 'void func()': a.cc:49:20: error: 'MyEqualDoule' was not declared in this scope 49 | if(MyEqualDoule(b*d - a*e),0) | ^~~~~~~~~~~~
s293954648
p00004
C++
#include<iostream> #include<string> #include<sstream> using namespace std; string toStr(int n); string intToToStr(int n); int main() { int a, b, c, d, e, f; while(cin >> a >> b >> c >> d >> e >> f) { a = a * 10000; b = b * 10000; c = c * 10000; d = d * 10000; e = e * 10000; f = f * 10000; int x, y; int det = a * e - b * d; x = ( e * c - b * f) / det; y = (-d * c + a * f) / det; cout << toStr(x) << " " << toStr(y) << endl; } } string toStr(int n) { int ipart = n / 10000; int fpart = (n - ipart * 10000) + 5; return intToString(ipart) + "." + intToString(fpart).substr(0, 3); } string intToString(int n) { string stream ss; ss << n; return ss.str; }
a.cc: In function 'std::string toStr(int)': a.cc:33:10: error: 'intToString' was not declared in this scope 33 | return intToString(ipart) + "." + intToString(fpart).substr(0, 3); | ^~~~~~~~~~~ a.cc: In function 'std::string intToString(int)': a.cc:37:17: error: expected initializer before 'ss' 37 | string stream ss; | ^~ a.cc:38:3: error: 'ss' was not declared in this scope 38 | ss << n; | ^~
s883283869
p00004
C++
#include<iostream> #include<string> #include<sstream> using namespace std; string toStr(int n); string intToToString(int n); int main() { int a, b, c, d, e, f; while(cin >> a >> b >> c >> d >> e >> f) { a = a * 10000; b = b * 10000; c = c * 10000; d = d * 10000; e = e * 10000; f = f * 10000; int x, y; int det = a * e - b * d; x = ( e * c - b * f) / det; y = (-d * c + a * f) / det; cout << toStr(x) << " " << toStr(y) << endl; } } string toStr(int n) { int ipart = n / 10000; int fpart = (n - ipart * 10000) + 5; return intToString(ipart) + "." + intToString(fpart).substr(0, 3); } string intToString(int n) { stringstream ss; ss << n; return ss.str; }
a.cc: In function 'std::string toStr(int)': a.cc:33:10: error: 'intToString' was not declared in this scope; did you mean 'intToToString'? 33 | return intToString(ipart) + "." + intToString(fpart).substr(0, 3); | ^~~~~~~~~~~ | intToToString a.cc: In function 'std::string intToString(int)': a.cc:39:13: error: cannot resolve overloaded function 'str' based on conversion to type 'std::string' {aka 'std::__cxx11::basic_string<char>'} 39 | return ss.str; | ^~~
s808084163
p00004
C++
#include<iostream> #include<string> #include<sstream> using namespace std; string toStr(int n); string intToString(int n); int main() { int a, b, c, d, e, f; while(cin >> a >> b >> c >> d >> e >> f) { a = a * 10000; b = b * 10000; c = c * 10000; d = d * 10000; e = e * 10000; f = f * 10000; int x, y; int det = a * e - b * d; x = ( e * c - b * f) / det; y = (-d * c + a * f) / det; cout << toStr(x) << " " << toStr(y) << endl; } } string toStr(int n) { int ipart = n / 10000; int fpart = (n - ipart * 10000) + 5; return intToString(ipart) + "." + intToString(fpart).substr(0, 3); } string intToString(int n) { stringstream ss; ss << n; return ss.str; }
a.cc: In function 'std::string intToString(int)': a.cc:39:13: error: cannot resolve overloaded function 'str' based on conversion to type 'std::string' {aka 'std::__cxx11::basic_string<char>'} 39 | return ss.str; | ^~~
s857662388
p00004
C++
#include<iostream> using namespace std; int main(){ double a,b,c,d,e,f; while(cin >> a >> b >> c >> d >> e >> f){ double x = (e*c - b*f)/(e*a - b*d) + 1e-10; double y = (d*c - a*f)/(d*b - a*e) + 1e-10; cout << fixed << setprecision(3) << x << " " << y << endl; } }
a.cc: In function 'int main()': a.cc:9:22: error: 'setprecision' was not declared in this scope 9 | cout << fixed << setprecision(3) << x << " " << y << endl; | ^~~~~~~~~~~~ a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>' 1 | #include<iostream> +++ |+#include <iomanip> 2 | using namespace std;
s616662364
p00004
C++
#include<iostream> using namespace std; int main(){ double a,b,c,d,e,f; while(cin >> a >> b >> c >> d >> e >> f){ double x = (e*c - b*f)/(e*a - b*d) + 1e-10; double y = (d*c - a*f)/(d*b - a*e) + 1e-10; cout << fixed << setprecision(3) << x << " " << y << endl; } }
a.cc: In function 'int main()': a.cc:9:22: error: 'setprecision' was not declared in this scope 9 | cout << fixed << setprecision(3) << x << " " << y << endl; | ^~~~~~~~~~~~ a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>' 1 | #include<iostream> +++ |+#include <iomanip> 2 | using namespace std;
s397176157
p00004
C++
#include <iostream> #include <cstdio> using namespace std; int main() { double a,b,c,d,e,f; double x,y; while(cin >> a >> b >> c >> d >> e >> f){ if(b*d - a*e != 0) double tmp1 = (c*e - b*f),tmp2 = (a*e - b*d),tmp3 = (c*d - a*f),tmp4=(b*d - a*e); tmp1 = tmp1/tmp2; tmp2 = tmp3/tmp4; x = tmp1; y = tmp2; printf("%.3f %.3f",x,y); } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'tmp1' was not declared in this scope; did you mean 'tm'? 15 | tmp1 = tmp1/tmp2; | ^~~~ | tm a.cc:15:21: error: 'tmp2' was not declared in this scope; did you mean 'tm'? 15 | tmp1 = tmp1/tmp2; | ^~~~ | tm a.cc:16:16: error: 'tmp3' was not declared in this scope; did you mean 'tm'? 16 | tmp2 = tmp3/tmp4; | ^~~~ | tm a.cc:16:21: error: 'tmp4' was not declared in this scope; did you mean 'tm'? 16 | tmp2 = tmp3/tmp4; | ^~~~ | tm
s338241831
p00004
C++
#include<cstdio> #include<iostream> #include<iomanip> using namespace std; int main(){ double a,b,c,d,e,f,x,y; while( cin >>a>>b>>c>>d>>e>>f){ x = (c*e - b*f)/(a*e - b*d); y = (a*f - c*d)/(a*e - b*d); cout <<fixed<<setorecision(3)<<x<<" "<<y<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:19: error: 'setorecision' was not declared in this scope 12 | cout <<fixed<<setorecision(3)<<x<<" "<<y<<endl; | ^~~~~~~~~~~~
s611182213
p00004
C++
#include<iostream> #include<cstdio> using namespace std; int main() { int a,b,p,c,d,q; float x,y; while(cin >> a >> b >> c >> d >> e >> f) { x=(float)(d*p-b*q) / (a*d - b*c); y=(float)(a*q-c*p) / (a*d - b*c); x *= 1000; x +=0,5; x = (int)x; x /= 1000; y *= 1000; y +=0,5; y = (int)x; y /= 1000; printf("%.3f %.3f\n" ,x,y); } return 0; }
a.cc: In function 'int main()': a.cc:8:37: error: 'e' was not declared in this scope 8 | while(cin >> a >> b >> c >> d >> e >> f) | ^ a.cc:8:42: error: 'f' was not declared in this scope 8 | while(cin >> a >> b >> c >> d >> e >> f) | ^
s033938486
p00005
Java
import java.util.Arrays; import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin=new Scanner(System.in); int a,b; while(cin.hasNext()){ a=cin.nextInt(); b=cin.nextInt(); System.out.printf("%d\n%d\n",GCD(a,b),LCM(a,b)); } } int GCD(int a,int b){ if(a<b){ int temp=a;a=b;b=temp; } if(b==0) return a; return GCD(b,a%b); } int LCM(int a,int b){ return a*b/GCD(a,b); } }
Main.java:17: error: non-static method GCD(int,int) cannot be referenced from a static context System.out.printf("%d\n%d\n",GCD(a,b),LCM(a,b)); ^ Main.java:17: error: non-static method LCM(int,int) cannot be referenced from a static context System.out.printf("%d\n%d\n",GCD(a,b),LCM(a,b)); ^ 2 errors
s111786769
p00005
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(scan.hasNext()) { long a,b,a1,b1; a=sc.nextInt(); b=sc.nextInt(); a1=a; b1=b; if(b>a) { long tmp=b; b=a; a=tmp; } while(a%b!=0) { long tmp=b; b=a%b; a=tmp; } System.out.println(b+" "+((a1*b1)/b)); } } }
Main.java:6: error: cannot find symbol while(scan.hasNext()) ^ symbol: variable scan location: class Main 1 error
s865316520
p00005
Java
public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a =scan.nextInt(); int b =scan.nextInt(); int gcd; if(a>b){ gcd = gcd(a,b); }else{ gcd = gcd(b, a); } int gld = a*b/gcd; System.out.println(gcd + " " + gld); scan.close(); } private static int gcd(int m,int n){ if(n==0){ return m; } int o = n; n = m%n; m = o; if(m>n){ return gcd(m,n); }else{ return gcd(n,m); } } }
Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s282627275
p00005
Java
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] arg) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); while (line != null) { String[] sl = line.split(" "); double a = Double.parseDouble(sl[0]); double b = Double.parseDouble(sl[1]); int gcd = getGCD(a, b); getLCM(a, b, gcd); line = br.readLine(); } } private static void getLCM(double a, double b, int gcd) { double tmp = a / gcd * b; int tmp2 = (int) tmp; System.out.println(tmp2); } private static int getGCD(double a, double b) { List<Integer> ls = new ArrayList<>(); int gcd = 0; for (int i = 1; i < a; i++) { if ((a % i) == 0) ls.add(i); } for (int i = 0; i < ls.size(); i++) { if ((b % ls.get(i)) == 0) gcd = ls.get(i); } System.out.println(gcd); return gcd; } }
Main.java:12: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 1 error
s258789234
p00005
Java
package sample; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] arg) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); ArrayList<Integer> ls = new ArrayList<Integer>(); while (line != null) { String[] sl = line.split(" "); double a = Double.parseDouble(sl[0]); double b = Double.parseDouble(sl[1]); int gcd = getGCD(a, b, ls); getLCM(a, b, gcd); line = br.readLine(); } } private static void getLCM(double a, double b, int gcd) { double tmp = a / gcd * b; int tmp2 = (int) tmp; System.out.println(tmp2); } private static int getGCD(double a, double b, ArrayList<Integer> ls) { int gcd = 0; for (int i = 1; i < a; i++) { if ((a % i) == 0) ls.add(i); } for (int i = 0; i < ls.size(); i++) { if ((b % ls.get(i)) == 0) gcd = ls.get(i); } System.out.println(gcd); ls.clear(); return gcd; } }
Main.java:14: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 1 error
s175586099
p00005
Java
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner ab = new Scanner(System.in); while( ab.hasNext()) { long n,x,y,a,b,c,p; a = ab.nextLong(); x = a; b = ab.nextLong(); y = b; while( a!=0 ) { c = a; a = b % a; b = c; } p = (x*y)/b; System.out.printf("%d ",b); System.out.println( p ); } } }
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s601471764
p00005
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNextInt()){ int a=sc.nextInt(); int b=sc.nextInt(); int c=gcd(a,b); System.out.printf("%d %d%n",c,a*b/c); } } int gcd(int x,inty){ int max=Math.max(x,y); int min=Math.min(x,y); if(max%min==0){return min;} return gcd(min,max%min); } }
Main.java:13: error: <identifier> expected int gcd(int x,inty){ ^ 1 error
s828026138
p00005
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNextInt()){ int a=sc.nextInt(); int b=sc.nextInt(); int c=gcd(a,b); System.out.printf("%d %d%n",c,a*b/c); } } public static int gcd(int x,inty){ int max=Math.max(x,y); int min=Math.min(x,y); if(max%min==0){return min;} return gcd(min,max%min); } }
Main.java:13: error: <identifier> expected public static int gcd(int x,inty){ ^ 1 error
s942967854
p00005
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNextInt()){ int a=sc.nextInt(); int b=sc.nextInt(); int c=gcd(a,b); int d=a*b/c; System.out.println(c+" "+d); } } public static int gcd(int x,int y){ int max=Math.max(x,y); int min=Math.min(x,y); int amari=max%min if(amari==0){return min;} else{return gcd(min,amari);} } }
Main.java:17: error: ';' expected int amari=max%min ^ 1 error
s753539334
p00005
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNextLong()){ long a=sc.nextLong(); long b=sc.nextLong(); long c=gcd(a,b); long d=(a*b)/c; System.out.println(c+" "+d); } } public static long gcd(int x,int y){ long max=Math.max(x,y); long min=Math.min(x,y); long amari=max%min; if(amari==0){return min;} else{return gcd(min,amari);} } }
Main.java:9: error: incompatible types: possible lossy conversion from long to int long c=gcd(a,b); ^ Main.java:19: error: incompatible types: possible lossy conversion from long to int else{return gcd(min,amari);} ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 2 errors
s189533636
p00005
Java
import java.util.Scanner; public class GCDandLCM { /** * ???????????\????????£?????´??° a, b ?????\???????????¨??????a ??¨ b ????????§??¬?´???°??¨????°???¬?????°???????????????????????????????????°????????????????????????????????? ????????????a ??¨ * b ???????°???¬?????°??? 20 ???????¶??????????????????¨???????????? * * @param args */ public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(greatestcommondivisor(a, b)); System.out.println(leastcommonmultiple(a, b)); } } /** * ?????§??¬?´???°????????¨?????????????????? * * @param a * @param b */ public static int greatestcommondivisor(int a, int b) { for (int i = b; 1 <= b; i--) { if (a % i == 0 && b % i == 0) { return i; // System.out.println(i); } } return b; } /** * ????°???¬?????°????????¨?????????????????? * * @param a * @param b */ public static int leastcommonmultiple(int a, int b) { // ?????° A , B ????????§??¬?´???°??? G ????°???¬?????°??? L ??¨????????¨ // AB=GL???????????????????????????????????§??????????????? int c = greatestcommondivisor(a, b); int d = a * b / c; return d; } }
Main.java:3: error: class GCDandLCM is public, should be declared in a file named GCDandLCM.java public class GCDandLCM { ^ 1 error
s865412193
p00005
Java
import java.util.Scanner; public class HelloWorld{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = scanner.nextInt(); int n = scanner.nextInt(); int gcd = getGCD(m, n); while(m <= 2000000000 && n <= 2000000000){ System.out.println(getLCM(m, n, gcd)); System.out.println(gcd); m = scanner.nextInt(); n = scanner.nextInt(); } } private static int getGCD(int m, int n) { return n == 0 ? m : getGCD(n, m % n); } private static int getLCM(int m, int n, int gcd) { return m * n / gcd; } }
Main.java:3: error: class HelloWorld is public, should be declared in a file named HelloWorld.java public class HelloWorld{ ^ 1 error
s704962918
p00005
Java
import java.util.Scanner; public class HelloWorld{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = scanner.nextInt(); int n = scanner.nextInt(); int gcd = getGCD(m, n); while(m <= 2000000000 && n <= 2000000000){ System.out.print(getLCM(m, n, gcd)); System.out.println(gcd); m = scanner.nextInt(); n = scanner.nextInt(); } } private static int getGCD(int m, int n) { return n == 0 ? m : getGCD(n, m % n); } private static int getLCM(int m, int n, int gcd) { return m * n / gcd; } }
Main.java:3: error: class HelloWorld is public, should be declared in a file named HelloWorld.java public class HelloWorld{ ^ 1 error
s878421400
p00005
Java
public class Lesson1_2 { public static void main(String args[]){ int x; int y; System.out.println("2 number input..."); x = new java.util.Scanner(System.in).nextInt(); y = new java.util.Scanner(System.in).nextInt(); final int OVER = 2000000000; int end = 0; int ov = 0; if(x < y){ ov = y; }else{ ov = x; } for(int n = 1; n < ov; n++){ if((x <= ov)&&(y <= ov)){ if((x%n == 0)&&(y%n == 0)){ end = n; } } } int smoll = 0; for(int n = ov; n < OVER; n++){ if((x <= OVER)&&(y <= OVER)){ if((n%x == 0)&&(n%y == 0)){ smoll = n; break; } } } System.out.println(end + " " + smoll); } }
Main.java:1: error: class Lesson1_2 is public, should be declared in a file named Lesson1_2.java public class Lesson1_2 { ^ 1 error
s727178202
p00005
Java
import java.util.NoSuchElementException; import java.util.Scanner; public class AOJ_0005 { private static Scanner sc; static int getGCD(int a,int b){ if(b>a){ int tmp=a; a=b; b=tmp; } while(b!=0){ int tmp=b; b=a%b; a=tmp; } return a; } static int getLCM(int a,int b){ return a/getGCD(a,b)*b; } public static void main(String[] args){ sc=new Scanner(System.in); while(true){ try{ int a=sc.nextInt(); int b=sc.nextInt(); System.out.print(getGCD(a,b)+" "); System.out.println(getLCM(a,b)); }catch(NoSuchElementException e){ break; } } } }
Main.java:4: error: class AOJ_0005 is public, should be declared in a file named AOJ_0005.java public class AOJ_0005 { ^ 1 error
s244559097
p00005
Java
import java.util.*; public class R48p1 { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); long x, y; while (in.hasNext()) { x = in.nextLong(); y = in.nextLong(); System.out.println(gcd(x, y) + " " + lcm(x, y)); } } static long gcd(long x, long y) { if (y == 0) return x; return gcd(y, x%y); } static long lcm(long a, long b) { return (a*b)/gcd(a, b); } }
Main.java:2: error: class R48p1 is public, should be declared in a file named R48p1.java public class R48p1 { ^ 1 error
s214596111
p00005
Java
import java.math.BigInteger; import java.util.*; public class Main { public static void main (String [] args){ Scanner input = new Scanner (System.in); while(input.hasNextInt()){ int a,b; a=input.nextInt(); b=input.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } } static int gcd (int a, int b){ if (b==0) return a; else return gcd(b, a%b); } static BigInteger lcm (int a,int b){ BigInteger num1=BigInteger.valueOf(a); BigInteger num2=BigInteger.valueOf(b); return num1.multiply(num2).divide(BigInteger.valueOf(gcd(a,b))); }
Main.java:24: error: reached end of file while parsing } ^ 1 error
s830091402
p00005
Java
import java.io.*; class Main { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); while (str != null) { String[] strArrays = str.split("\\s", 0); long a = Long.parseLong(strArrays[0]); long b = Long.parseLong(strArrays[1]); long tmp, r = 1; long num = (Long.parseLong(strArrays[0]) * Long.parseLong(strArrays[1])) / r; if (a < b) { tmp = a; b = a; a = tmp; } r = a % b; while (r != 0) { a = b; b = r; r = a % b; } System.out.print(b + " " + num); Str = br.readLine(); } } }
Main.java:26: error: cannot find symbol Str = br.readLine(); ^ symbol: variable Str location: class Main 1 error
s565900137
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner s = new Scanner(System.in); int max,min; int a,b; String str ; String[] result; int counter = 0; while(true){ str = s.nextLine(); if(str.length() == 0) { break; } result = str.split(" "); a = Integer.parseInt(result[0]); b = Integer.parseInt(result[1]); int x = a; int y = b; while(x!=y){ if(x>y){ y += b; }else{ x += a; } } min = x; max = (int)((long)a * b / min); System.out.println(max+" "+min); } }
Main.java:43: error: reached end of file while parsing } ^ 1 error
s209947942
p00005
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class LCMextended { public static int numint[]; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); while (str != null) { String numstr[] = str.split(" ", 0); numint = new int[2]; numint[0] = Integer.parseInt(numstr[0]); numint[1] = Integer.parseInt(numstr[1]); int gcm = Euclid(); int lcm = numint[0] * numint[1] / gcm; System.out.println(gcm + " " + lcm); str = br.readLine(); } } public static int Euclid() { int x = numint[0]; int y = numint[1]; while (x != y) { if (x < y) { y = y - x; } else { x = x - y; } } return x; } }
Main.java:5: error: class LCMextended is public, should be declared in a file named LCMextended.java public class LCMextended { ^ 1 error
s532448976
p00005
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); ArrayList<String> ans = new ArrayList<>(); while(sc.hasNext()){ int a = sc.nextInt(),b = sc.nextInt(); ans.add(String.format("%d %d",getGCD(a,b),getLCM(a,b))); } for(Int i = 0,size = ans.size();i < size;i++){ System.out.println(ans.get(i)); } } static int getGCD(int a,int b){ while(a != b){ if(a > b) a -= b; else b -= a; } return a; } static int getLCM(int a,int b){ return a * b / getGCD(a,b); } }
Main.java:11: error: cannot find symbol for(Int i = 0,size = ans.size();i < size;i++){ ^ symbol: class Int location: class Main 1 error
s284627640
p00005
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static long gcd(long a, long b){ if(a < b){ long tmp = a; a = b; b = tmp; } while(b > 0){ int r = a % b; a = b; b = r; } return a; } public static long lcm(long a, long b, long g){ long v = a / g; long w = b / g; long l = v * w * g; return l; } public static void main(String[] args){ while(scan.hasNext()){ long a = scan.nextLong(); long b = scan.nextLong(); long g = gcd(a, b); long l = lcm(a, b, g); System.out.printf("%d %d\n", g, l); } } }
Main.java:13: error: incompatible types: possible lossy conversion from long to int int r = a % b; ^ 1 error
s825716219
p00005
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static void main(String[] args){ List<Integer> listG = new ArrayList<Integer>(); List<Integer> listL = new ArrayList<Integer>(); while(scan.hasNext()){ int a = scan.nextInt(); int b = scan.nextInt(); int g = gcd(a, b); int l = lcm(a, b, g); listG.add(g); listL.add(l); } Iterator<Integer> itG = listG.iterator(); Iterator<Integer> itL = listL.iterator(); while(itG.hasNext()){ int g = itG.next(); int l = itL.next(); System.out.printf("%d %d\n", g, l); } } public static int gcd(int a, int b){ if(b != 0)return gcd(b, a % b) else return a; } public static int lcm(int a, int b, int g){ int v = a / g; int l = v * b; return l; } }
Main.java:27: error: ';' expected if(b != 0)return gcd(b, a % b) ^ 1 error
s131466335
p00005
Java
class Main { public static void main( String[] args ) { java.util.Scanner sc = new java.util.Scanner( System.in ); int a = sc.nextInt(); int b = sc.nextInt(); System.out.printf( "%d %d\n" , ??¬?´???°??????( a, b ), ??¬?????°??????( a, b ) ); } static int ??¬?????°??????( int a, int b ) { int ac = a; int bc = b; while( a != b ) { if( a < b )a += ac; if( a > b )b += bc; } return a; } static int ??¬?´???°??????( int a, int b ) { int yakusu = 0; if( a > b ) { for( int i = 1 ; i <= b ; i++ ){ if( a%i == 0 && b%i == 0 )yakusu = i; } }else{ for( int i = 1 ; i <= a ; i++ ){ if( a%i == 0 && b%i == 0 )yakusu = i; } } return yakusu; } }
Main.java:10: error: illegal start of expression System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: illegal start of expression System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: illegal character: '\u00ac' System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: illegal character: '\u00b4' System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: illegal character: '\u00b0' System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: not a statement System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: ';' expected System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: not a statement System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: ';' expected System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: illegal character: '\u00ac' System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: illegal character: '\u00b0' System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: not a statement System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: ';' expected System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: not a statement System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:10: error: ';' expected System.out.printf( "%d %d\n" , ???????????????( a, b ), ???????????????( a, b ) ); ^ Main.java:12: error: <identifier> expected static int ???????????????( int a, int b ) ^ Main.java:12: error: illegal character: '\u00ac' static int ???????????????( int a, int b ) ^ Main.java:12: error: illegal character: '\u00b0' static int ???????????????( int a, int b ) ^ Main.java:12: error: <identifier> expected static int ???????????????( int a, int b ) ^ Main.java:12: error: ';' expected static int ???????????????( int a, int b ) ^ Main.java:24: error: <identifier> expected static int ???????????????( int a, int b ) ^ Main.java:24: error: illegal character: '\u00ac' static int ???????????????( int a, int b ) ^ Main.java:24: error: illegal character: '\u00b4' static int ???????????????( int a, int b ) ^ Main.java:24: error: illegal character: '\u00b0' static int ???????????????( int a, int b ) ^ Main.java:24: error: <identifier> expected static int ???????????????( int a, int b ) ^ Main.java:24: error: ';' expected static int ???????????????( int a, int b ) ^ 26 errors
s045524307
p00005
Java
import java.util.Scanner; public class GCDandLCM { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNextLine()) { String inputData = scan.nextLine(); if ("".equals(inputData)) { scan.close(); break; } String[] inputDataSP = inputData.split(" "); long a = Integer.parseInt(inputDataSP[0]); long b = Integer.parseInt(inputDataSP[1]); long gcd = gcd(a, b); long lcm = (a * b) / gcd; System.out.println(gcd + " " + lcm); } } private static long gcd(long a, long b) { a = (a < b) ? b : a; b = (a < b) ? a : b; long mod = -1; while ((mod = a % b) != 0) { a = b; b = mod; } return b; } }
Main.java:3: error: class GCDandLCM is public, should be declared in a file named GCDandLCM.java public class GCDandLCM { ^ 1 error
s228709640
p00005
Java
import java.util.Scanner; public class GCDandLCM { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String inputData; while ((inputData = scan.nextLine()) != null || !"".equals(inputData)) { String[] inputDataSP = inputData.split(" "); long a = Long.parseLong(inputDataSP[0]); long b = Long.parseLong(inputDataSP[1]); long gcd = gcd(a, b); long lcm = (a * b) / gcd; System.out.println(gcd + " " + lcm); } scan.close(); } private static long gcd(long a, long b) { a = (a < b) ? b : a; b = (a < b) ? a : b; long mod = -1; while ((mod = a % b) != 0) { a = b; b = mod; } return b; } }
Main.java:3: error: class GCDandLCM is public, should be declared in a file named GCDandLCM.java public class GCDandLCM { ^ 1 error
s093317525
p00005
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] a) throws IOException{ String strLine =""; BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in)); int i = 0; int max = 50; String[] result = new String [max]; int[] kouyaku = new int[max]; int[] koubai = new int[max]; while ( i <= max && ((strLine = stdReader.readLine()) != null) ){ //??????????????§????????? String[] temp = strLine.split(" ",-10); int[] tempInt = new int[2]; if(temp[0].equals("")){ break; } tempInt[0] = Integer.parseInt(temp[0]); tempInt[1] = Integer.parseInt(temp[1]); //?????§??¬?´???°????±????????????????????´??????? kouyaku[i] = calcKouyaku(tempInt); //????°???¬?????°????±????????????????????´??????? koubai[i] = calcKoubai(tempInt); i++; } //????????????????????? for(int j = 0; j < i; j++){ System.out.println(kouyaku[j] +" "+koubai[j]); } } public static int calcKouyaku(int[] tempInt){ java.util.Arrays.sort(tempInt); int maxYakusu = 1; for(int k = tempInt[0]-1 ; k > 1 ; k--){ if((tempInt[0]%k == 0)&&(tempInt[1]%k == 0)){ tempInt[0] = tempInt[0]/k; tempInt[1] = tempInt[1]/k; maxYakusu = maxYakusu * k; } } return maxYakusu; } public static int calcKoubai(int[] tempInt){ java.util.Arrays.sort(tempInt); int[] tempAmari = new int[2]; int maxYakusu= 1; for(int k = tempInt[0]-1 ; k > 1 ; k--){ if((tempInt[0]%k == 0)&&(tempInt[1]%k == 0)){ tempInt[0] = tempInt[0]/k; tempInt[1] = tempInt[1]/k; //tempAmari[0] = tempAmari[0]%k; //tempAmari[1] = tempAmari[1]%k; maxYakusu = maxYakusu * k; } } return maxYakusu*tempInt[0]*tempInt[1]; }
Main.java:99: error: reached end of file while parsing } ^ 1 error
s900777448
p00005
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] a) throws IOException{ String strLine =""; BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in)); int i = 0; int max = 50; int[] tempInt = new int[2]; while ( i <= max && ((strLine = stdReader.readLine()) != null) ){ //??????????????§????????? String[] temp = strLine.split(" ",-10); tempInt[0] =Integer.parseInt(temp[0]); tempInt[1] = Integer.parseInt(temp[1]); int maxYakusu = 1; for(int k = tempInt[1]-1 ; k > 1 ; k--){ if((tempInt[0]%k == 0)&&(tempInt[1]%k == 0)){ tempInt[0] = tempInt[0]/k; tempInt[1] = tempInt[1]/k; maxYakusu = maxYakusu * k; } } //????°???¬?????°????±????????????????????´??????? int maxBaisu = maxYakusu * temp1 * temp2; System.out.println(maxYakusu+" "+maxBaisu); i++; } } }
Main.java:42: error: cannot find symbol int maxBaisu = maxYakusu * temp1 * temp2; ^ symbol: variable temp1 location: class Main Main.java:42: error: cannot find symbol int maxBaisu = maxYakusu * temp1 * temp2; ^ symbol: variable temp2 location: class Main 2 errors
s468125015
p00005
Java
import java.util.Scanner; import java.math.BigDecimal; public class Gcd{ public static long saidai(long a , long b){ long c,s,t; s = a; t = b; while(true){ if(s == t){ c = s; break; }else if(s == 0){ c = t; break; }else if(t == 0){ c = s; break; }else if(s > t){ s = s % t; }else{ t = t % s; } } return c; } public static long saishou(long a , long b){ long c,s,t; s = a; t = b; while(true){ if(s == t){ c = s; break; }else if(s < t){ s = s+a; }else{ t = t+b; } } return c; } public static void main(String[] args){ int i,j; long a,b,c,d,e,f; long[] x = new long[60]; long[] y = new long[60]; Scanner scan = new Scanner(System.in); i = 0; while(scan.hasNextLong()){ a = scan.nextLong(); b = scan.nextLong(); x[i] = saidai(a,b); y[i] = saishou(a,b); i++; } j = 0; while(j < i){ System.out.println(x[j] + " " + y[j]); j++; } } }
Main.java:4: error: class Gcd is public, should be declared in a file named Gcd.java public class Gcd{ ^ 1 error
s492523088
p00005
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String tmp = br.readLine(); List<Long> list = Arrays.asList(tmp.split(" ")).stream().map(i -> Long.valueOf(i)).sorted().collect(Collectors.toList()); long koyakusu = getKoyakusu(list.get(0), list.get(1)); long kobaisu = getKobaisu(list.get(0), list.get(1)); System.out.printf("%d %d", koyakusu, kobaisu); } catch (Exception e) { System.exit(0); } } // ??¬?´???°????????? private static long getKoyakusu(long a, long b) { int candidate = a; while (b % a != 0) { candidate = b % a; b = a; a = candidate; } return candidate; } // ??¬?????°????????? private static long getKobaisu(long a, long b) { return a * b / getKoyakusu(a, b); } }
Main.java:25: error: incompatible types: possible lossy conversion from long to int int candidate = a; ^ Main.java:27: error: incompatible types: possible lossy conversion from long to int candidate = b % a; ^ 2 errors
s440584271
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ //?????°??£?¨? Scanner sc; int a; //??\???????????° int b; int c=1; int d; //???????????????????????? int i = 0; //???????????? //int[] haco; //??¨?????¨????????? //String haco = iter.next(); //int [][] haco = new int [2][50]; int y=1; //???????????? int z=0; int h=0; int j=1; sc = new Scanner(System.in); //?????????????????§??\????????? while(sc.hasNext()){ a = sc.nextInt();//??\???????????????????????°?????\?????? b = sc.nextInt(); //haco = new int[100]; while(0 != c%a || 0 != c%b){ c++; } //haco[h][1] = c; //h = h + 1; if(a==0){ break; }else if(b==0){ b = a; break; }else{ d = a%b; } while(true){ d = a%b; if(d == 0){ break; }else{ a = b; b = d; if(a%b == 0){ break; } } //System.out.println(b + " " + c); //haco[j][0] = b; //j = j+ 1; } //System.out.println(z + " " + y); if(i > 50){ break; } i = i + 1; System.out.println(b + " " + c); } //z = 0; //y = 1; h = 0; j = 0; //while(haco.hasNext()){ //???????????????????????????????????§?????? while(true){ System.out.print(haco[j][0] + " "); j = j + 1; System.out.println(haco[0][h]); h = h + 1; } //if(haco[j][0] == null){ //int g = 0; //for(g= 0; g < 2; g++){ //if(g==1){ //haco.hasNext(); //} //int in = haco.next(); //??????????????????in?????\?????? //if(g==0){ //System.out.print(haco + " "); //break; //}else{ //System.out.println(haco); //} //} //System.out.println(y); //z = z + 2; //y = y + 2; } }
Main.java:84: error: cannot find symbol System.out.print(haco[j][0] + " "); ^ symbol: variable haco location: class Main Main.java:87: error: cannot find symbol System.out.println(haco[0][h]); ^ symbol: variable haco location: class Main 2 errors
s765434831
p00005
Java
import java.util.Scanner; public Main{ public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int[] a = new int[50]; int[] b = new int[50]; int[] newA = new int[50]; int[] newB = new int[50]; int[] gcd = new int[50]; int[] lcm = new int[50]; int num = 0; System.out.println("How Many Data set? > "); num = stdin.nextInt(); for(int cnt = 0; cnt < num; cnt++) { System.out.print("a[cnt][" + cnt + "] = "); a[cnt] = stdin.nextInt(); System.out.print("b[cnt][" + cnt + "] = "); b[cnt] = stdin.nextInt(); newA[cnt] = a[cnt]; newB[cnt] = b[cnt]; } for(int cnt = 0; cnt < num; cnt++) { if(a[cnt] > b[cnt]) { int r = 0; while((r = a[cnt] % b[cnt]) != 0) { a[cnt] = b[cnt]; b[cnt] = r; } gcd[cnt] = b[cnt]; } else if( b[cnt] > a[cnt]) { int r = 0; while((r = b[cnt] % a[cnt]) != 0) { b[cnt] = a[cnt]; a[cnt] = r; } gcd[cnt] = a[cnt]; } else { gcd[cnt] = a[cnt]; System.out.print(a[cnt]); } lcm[cnt] = (newA[cnt] * newB[cnt]) / gcd[cnt]; } for(int cnt = 0; cnt < num; cnt++) { System.out.println("?????§??¬?´???° :" + gcd[cnt] + ", ????°???¬?????° : " + lcm[cnt] ); } } }
Main.java:3: error: class, interface, enum, or record expected public Main{ ^ Main.java:5: 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) Main.java:76: error: class, interface, enum, or record expected } ^ 3 errors
s176157239
p00005
Java
import java.util.Scanner; public class Main public static void main(String[] args) { Scanner stdin = new Scanner(System.in); long a = 0; long b = 0; long ab = 0; long r = 0; long gcd = 0; long lcm = 0; long temp = 0; while(stdin.hasNext()) { a = stdin.nextInt(); b = stdin.nextInt(); ab = a * b; if(a < b) { temp = a; a = b; b = temp; } if(a >= b) { do { r = a % b; if(r == 0) { break; } else { a = b; b = r; } }while(r != 1); gcd = b; lcm = ab / b; System.out.println(gcd + " " + lcm); } } } }
Main.java:3: error: '{' expected public class Main ^ Main.java:4: 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) Main.java:43: error: class, interface, enum, or record expected } ^ 3 errors
s186076399
p00005
Java
package P2_6_Exer_1; import java.util.Scanner; public class A0005 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = ""; while((line=sc.nextLine())!=null&&!(line.trim().equals(""))) { String[] temp = line.split(" "); int a = Integer.parseInt(temp[0]); int b = Integer.parseInt(temp[1]); int gcd = commonDiv(a,b); System.out.println(gcd+" "+(a*(b/gcd))); } } public static int commonDiv(int a, int b) { while(b>0) { int temp = b; b = a%b; a = temp; } return a; } }
Main.java:5: error: class A0005 is public, should be declared in a file named A0005.java public class A0005 { ^ 1 error
s768732521
p00005
Java
#include<stdio.h> int main(void){ long int a,b,k,r,ab; while(scanf("%ld %ld",&a,&b)!=EOF){ if(a<b){//a>b k=a; a=b; b=k; } //最小公倍数*最大公約数=a*b ab=a*b; while((r=a%b)!=0){ a=b; b=r; } printf("%ld %ld\n",b,ab/b); } return 0; }
Main.java:1: error: illegal character: '#' #include<stdio.h> ^ Main.java:1: error: class, interface, enum, or record expected #include<stdio.h> ^ Main.java:6: error: class, interface, enum, or record expected while(scanf("%ld %ld",&a,&b)!=EOF){ ^ Main.java:9: error: class, interface, enum, or record expected a=b; ^ Main.java:10: error: class, interface, enum, or record expected b=k; ^ Main.java:11: error: class, interface, enum, or record expected } ^ Main.java:14: error: class, interface, enum, or record expected while((r=a%b)!=0){ ^ Main.java:16: error: class, interface, enum, or record expected b=r; ^ Main.java:17: error: class, interface, enum, or record expected } ^ Main.java:19: error: class, interface, enum, or record expected } ^ Main.java:21: error: class, interface, enum, or record expected } ^ 11 errors
s108226373
p00005
Java
#include<stdio.h> int main(void){ long int a,b,k,r,ab; while(scanf("%ld %ld",&a,&b)!=EOF){ if(a<b){ k=a; a=b; b=k; } ab=a*b; while((r=a%b)!=0){ a=b; b=r; } printf("%ld %ld\n",b,ab/b); } return 0; }
Main.java:1: error: illegal character: '#' #include<stdio.h> ^ Main.java:1: error: class, interface, enum, or record expected #include<stdio.h> ^ Main.java:6: error: class, interface, enum, or record expected while(scanf("%ld %ld",&a,&b)!=EOF){ ^ Main.java:9: error: class, interface, enum, or record expected a=b; ^ Main.java:10: error: class, interface, enum, or record expected b=k; ^ Main.java:11: error: class, interface, enum, or record expected } ^ Main.java:13: error: class, interface, enum, or record expected while((r=a%b)!=0){ ^ Main.java:15: error: class, interface, enum, or record expected b=r; ^ Main.java:16: error: class, interface, enum, or record expected } ^ Main.java:18: error: class, interface, enum, or record expected } ^ Main.java:20: error: class, interface, enum, or record expected } ^ 11 errors
s982689214
p00005
Java
import java.io.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); while(true){ String s = r.readLine(); if(s == null) break; int i = s.indexOf(" "); System.out.println(gcd(Integer.valueOf(s.substring(0, i))) + " " + lcm(Integer.valueOf(s.substring(i+1)))); } } private int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a % b); } private int lcm(int a, int b) { return b * a / gcd(a, b); } }
Main.java:9: error: method gcd in class Main cannot be applied to given types; System.out.println(gcd(Integer.valueOf(s.substring(0, i))) + " " + lcm(Integer.valueOf(s.substring(i+1)))); ^ required: int,int found: Integer reason: actual and formal argument lists differ in length Main.java:9: error: method lcm in class Main cannot be applied to given types; System.out.println(gcd(Integer.valueOf(s.substring(0, i))) + " " + lcm(Integer.valueOf(s.substring(i+1)))); ^ required: int,int found: Integer reason: actual and formal argument lists differ in length 2 errors
s355744672
p00005
Java
import java.io.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); while(true){ String s = r.readLine(); if(s == null) break; int i = s.indexOf(" "); int a = Integer.valueOf(s.substring(0, i)); int b = Integer.valueOf(s.substring(i+1)); System.out.println(gcd(a, b) + " " + lcm(a, b)); } } private int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a % b); } private int lcm(int a, int b) { return b * a / gcd(a, b); } }
Main.java:11: error: non-static method gcd(int,int) cannot be referenced from a static context System.out.println(gcd(a, b) + " " + lcm(a, b)); ^ Main.java:11: error: non-static method lcm(int,int) cannot be referenced from a static context System.out.println(gcd(a, b) + " " + lcm(a, b)); ^ 2 errors
s369016390
p00005
Java
public class Main { /** * @param args */ public static void main(String[] args) throws IOException { // System.out.println("Hello world"); InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); while(true){ int n = 2; String c = br.readLine(); if(c.equals("")) break; long[] arr = new long[n]; for(int i = 0; i < n; i++){ if(c.indexOf(" ") != -1){ String str = c.substring(0, c.indexOf(" ")); arr[i] = Long.parseLong(str); c = c.substring(c.indexOf(" ") + 1); } else{ arr[i] = Long.parseLong(c); } } if(arr[1] < arr[0]){ long re = arr[1]; arr[1] = arr[0]; arr[0] = re; } long[] arr2 = arr.clone(); long amari = 1; while(arr2[0] !=0){ amari = arr2[1] % arr2[0]; if(amari == 0) break; arr2[1] = arr2[0]; arr2[0] = amari; } long i = 1; while((arr[0]*i) % arr[1] != 0){ i++; } System.out.println(arr2[0] + " " + arr[0]*i); } } }
Main.java:6: error: cannot find symbol public static void main(String[] args) throws IOException { ^ symbol: class IOException location: class Main Main.java:8: error: cannot find symbol InputStreamReader is = new InputStreamReader(System.in); ^ symbol: class InputStreamReader location: class Main Main.java:8: error: cannot find symbol InputStreamReader is = new InputStreamReader(System.in); ^ symbol: class InputStreamReader location: class Main Main.java:9: error: cannot find symbol BufferedReader br = new BufferedReader(is); ^ symbol: class BufferedReader location: class Main Main.java:9: error: cannot find symbol BufferedReader br = new BufferedReader(is); ^ symbol: class BufferedReader location: class Main 5 errors
s232620676
p00005
Java
public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a,b; int gcd = 0; int lcm = 0; while ((scan.hasNext())) { a = Integer.parseInt(scan.next()); b = Integer.parseInt(scan.next()); for (int i = 2; i <= Math.min(a, b); i++) { //Å‘åŒö–ñ” if((a % i == 0) && (b % i == 0)){ gcd = i; } } // Å¬Œö”{” lcm = a * b / gcd; System.out.println(gcd+" "+lcm); } } }
Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s905685927
p00005
Java
public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a, b, goc; while (in.hasNext()) { a = in.nextInt(); b = in.nextInt(); System.out.print(goc = goc(a, b)); System.out.print(" "); System.out.println(a / goc * b); } } static int goc(int a, int b) { if (b != 0) return goc(b, a % b); else return a; } }
Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s162373971
p00005
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ int gcd,lcm; BufferedReader br= new BufferedReader (new InputStreamReader(System.in)); String buf; while(true){ if((buf=br.readLine())==null)break; if(buf.length()==0)break; String[] data=buf.split(" "); int[] dat =new int[2]; for(int i=0;i<2;i++){ dat[i]=Integer.parseInt(data[i]); } int x=dat[0],y=dat[1]; while(true){ if(x==y)break; if(x > y) x-=y; else y-=x; } lcm=x; while(true){ int q=x/y; int r= x - q *y; if(r == 0)break; x=y; y=r; } lcm=y; System.out.println(lcm+" "+gcd); } } }
Main.java:32: error: variable gcd might not have been initialized System.out.println(lcm+" "+gcd); ^ 1 error
s949509257
p00005
Java
import java.util.Scanner; import java.math.BigDecimal; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()) { BigDecimal bda = new BigDecimal(sc.nextDouble()); BigDecimal bdb = new BigDecimal(sc.nextDouble()); BigDecimal gcd = bda.gcd(bdb); BigDecimal lcm = bda.multyply(bdb).divide(gcd); System.out.println(gcd+" "+lcm); } } }
Main.java:9: error: cannot find symbol BigDecimal gcd = bda.gcd(bdb); ^ symbol: method gcd(BigDecimal) location: variable bda of type BigDecimal Main.java:10: error: cannot find symbol BigDecimal lcm = bda.multyply(bdb).divide(gcd); ^ symbol: method multyply(BigDecimal) location: variable bda of type BigDecimal 2 errors
s974195221
p00005
Java
import java.util.Scanner; import java.math.BigInteger; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()) { BigInteger bda = new BigInteger(sc.nextDouble()); BigInteger bdb = new BigInteger(sc.nextDouble()); BigInteger gcd = bda.gcd(bdb); BigInteger lcm = bda.multyply(bdb).divide(gcd); System.out.println(gcd+" "+lcm); } } }
Main.java:7: error: no suitable constructor found for BigInteger(double) BigInteger bda = new BigInteger(sc.nextDouble()); ^ constructor BigInteger.BigInteger(byte[]) is not applicable (argument mismatch; double cannot be converted to byte[]) constructor BigInteger.BigInteger(int[]) is not applicable (argument mismatch; double cannot be converted to int[]) constructor BigInteger.BigInteger(String) is not applicable (argument mismatch; double cannot be converted to String) constructor BigInteger.BigInteger(long) is not applicable (argument mismatch; possible lossy conversion from double to long) Main.java:8: error: no suitable constructor found for BigInteger(double) BigInteger bdb = new BigInteger(sc.nextDouble()); ^ constructor BigInteger.BigInteger(byte[]) is not applicable (argument mismatch; double cannot be converted to byte[]) constructor BigInteger.BigInteger(int[]) is not applicable (argument mismatch; double cannot be converted to int[]) constructor BigInteger.BigInteger(String) is not applicable (argument mismatch; double cannot be converted to String) constructor BigInteger.BigInteger(long) is not applicable (argument mismatch; possible lossy conversion from double to long) Main.java:10: error: cannot find symbol BigInteger lcm = bda.multyply(bdb).divide(gcd); ^ symbol: method multyply(BigInteger) location: variable bda of type BigInteger Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 3 errors
s897955204
p00005
Java
import java.util.Scanner; import java.math.BigInteger; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()) { BigInteger bda = new BigInteger(sc.nextInt()); BigInteger bdb = new BigInteger(sc.nextInt()); BigInteger gcd = bda.gcd(bdb); BigInteger lcm = bda.multiply(bdb).divide(gcd); System.out.println(gcd+" "+lcm); } } }
Main.java:7: error: no suitable constructor found for BigInteger(int) BigInteger bda = new BigInteger(sc.nextInt()); ^ constructor BigInteger.BigInteger(byte[]) is not applicable (argument mismatch; int cannot be converted to byte[]) constructor BigInteger.BigInteger(int[]) is not applicable (argument mismatch; int cannot be converted to int[]) constructor BigInteger.BigInteger(String) is not applicable (argument mismatch; int cannot be converted to String) constructor BigInteger.BigInteger(long) is not applicable (BigInteger(long) has private access in BigInteger) Main.java:8: error: no suitable constructor found for BigInteger(int) BigInteger bdb = new BigInteger(sc.nextInt()); ^ constructor BigInteger.BigInteger(byte[]) is not applicable (argument mismatch; int cannot be converted to byte[]) constructor BigInteger.BigInteger(int[]) is not applicable (argument mismatch; int cannot be converted to int[]) constructor BigInteger.BigInteger(String) is not applicable (argument mismatch; int cannot be converted to String) constructor BigInteger.BigInteger(long) is not applicable (BigInteger(long) has private access in BigInteger) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 2 errors
s720364122
p00005
Java
import java.io.* class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:1: error: ';' expected import java.io.* ^ 1 error
s719858260
p00005
Java
import java.io.* class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:1: error: ';' expected import java.io.* ^ 1 error
s909478138
p00005
Java
import java.io.* class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:1: error: ';' expected import java.io.* ^ 1 error
s336697364
p00005
Java
import java.io.*; class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:6: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:8: error: cannot find symbol int a =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:9: error: cannot find symbol int b = nextInt(); ^ symbol: method nextInt() location: class Main 4 errors
s220066951
p00005
Java
import java.io.*; class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:6: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:8: error: cannot find symbol int a =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:9: error: cannot find symbol int b = nextInt(); ^ symbol: method nextInt() location: class Main 4 errors
s445677909
p00005
Java
import java.io.*; import java.util.* class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:2: error: ';' expected import java.util.* ^ 1 error
s566958017
p00005
Java
import java.io.*; import java.util.*; class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:9: error: cannot find symbol int a =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:10: error: cannot find symbol int b = nextInt(); ^ symbol: method nextInt() location: class Main 2 errors
s631976212
p00005
Java
import java.io.*; import java.util; class Main{ public static void main(String args[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int a =nextInt(); int b = nextInt(); System.out.println(gcd(a,b)+" "+a*b/gcd(a,b)); } } public static long gcd(int a,int b){ if(b==0)return a; return gcd(b,a%b); } }
Main.java:2: error: cannot find symbol import java.util; ^ symbol: class util location: package java Main.java:7: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:7: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:9: error: cannot find symbol int a =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:10: error: cannot find symbol int b = nextInt(); ^ symbol: method nextInt() location: class Main 5 errors
s764444048
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ long numA = stdIn.nextLong(); long numB = stdIn.nextLong(); long GCD = getGCD(numA,numB); long GCD = getGCD(numA,numB); System.out.println(GCD + " " + LCM); } } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最大公約数(GCD)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getGCD(long numA,long numB){ long GCD = 1; if(numA == numB){ GCD = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } long bigNum = numB; while(0 < bigNum){ if(NumA % bigNum == 0 && NumB % bigNum == 0){ GCD = bigNum; break; } bigNum--; } } return GCD; } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最小公倍数(LCM)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getLCM(long numA,long numB){ long LCM = 0; if(numA == numB){ LCM = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } while(LCM < 2000000000){ LCM += numB; if(LCM % numA == 0){ break; } } return LCM; } } }
Main.java:11: error: variable GCD is already defined in method main(String[]) long GCD = getGCD(numA,numB); ^ Main.java:12: error: cannot find symbol System.out.println(GCD + " " + LCM); ^ symbol: variable LCM location: class Main Main.java:24: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumA location: class Main Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumB location: class Main Main.java:50: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ 6 errors
s813485300
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ long numA = stdIn.nextLong(); long numB = stdIn.nextLong(); long GCD = getGCD(numA,numB); long LCM = getLCM(numA,numB); System.out.println(GCD + " " + LCM); } } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最大公約数(GCD)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getGCD(long numA,long numB){ long GCD = 1; if(numA == numB){ GCD = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } long bigNum = numB; while(0 < bigNum){ if(NumA % bigNum == 0 && NumB % bigNum == 0){ GCD = bigNum; break; } bigNum--; } } return GCD; } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最小公倍数(LCM)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getLCM(long numA,long numB){ long LCM = 0; if(numA == numB){ LCM = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } while(LCM < 2000000000){ LCM += numB; if(LCM % numA == 0){ break; } } return LCM; } } }
Main.java:24: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumA location: class Main Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumB location: class Main Main.java:50: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ 4 errors
s020032782
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ long numA = stdIn.nextLong(); long numB = stdIn.nextLong(); long GCD = getGCD(numA,numB); long LCM = getLCM(numA,numB); System.out.println(GCD + " " + LCM); } } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最大公約数(GCD)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getGCD(long numA,long numB){ long GCD = 1; if(numA == numB){ GCD = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } long bigNum = numB; while(0 < bigNum){ if(NumA % bigNum == 0 && NumB % bigNum == 0){ GCD = bigNum; break; } bigNum--; } } return GCD; } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最小公倍数(LCM)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getLCM(long numA,long numB){ long LCM = 0; if(numA == numB){ LCM = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } while(LCM < 2000000000){ LCM += numB; if(LCM % numA == 0){ break; } } } return LCM; } }
Main.java:24: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumA location: class Main Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumB location: class Main Main.java:50: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ 4 errors
s648296790
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ long numA = stdIn.nextLong(); long numB = stdIn.nextLong(); long GCD = getGCD(numA,numB); long LCM = getLCM(numA,numB); System.out.println(GCD + " " + LCM); } } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最大公約数(GCD)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getGCD(long numA,long numB){ long GCD = 1L; if(numA == numB){ GCD = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } long bigNum = numB; while(0 < bigNum){ if(NumA % bigNum == 0 && NumB % bigNum == 0){ GCD = bigNum; break; } bigNum--; } } return GCD; } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最小公倍数(LCM)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getLCM(long numA,long numB){ long LCM = 0L; if(numA == numB){ LCM = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } while(LCM < 2000000000){ LCM += numB; if(LCM % numA == 0){ break; } } } return LCM; } }
Main.java:24: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumA location: class Main Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumB location: class Main Main.java:50: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ 4 errors
s079678831
p00005
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ long numA = stdIn.nextLong(); long numB = stdIn.nextLong(); long GCD = getGCD(numA,numB); long LCM = getLCM(numA,numB); System.out.println(GCD + " " + LCM); } } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最大公約数(GCD)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getGCD(long numA,long numB){ long GCD = 1L; if(numA == numB){ GCD = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } long bigNum = numB; while(0 < bigNum){ if(NumA % bigNum == 0 && NumB % bigNum == 0){ GCD = bigNum; break; } bigNum--; } } return GCD; } //++++++++++++++++++++++++++++++++++++++++++++++++++ //最小公倍数(LCM)取得メソッド //++++++++++++++++++++++++++++++++++++++++++++++++++ public static long getLCM(long numA,long numB){ long LCM = 0L; if(numA == numB){ LCM = numA; }else{ if(numA > numB){ int temp= numA; numA = numB; numB = temp; } while(LCM < 2000000000){ LCM += numB; if(LCM % numA == 0){ break; } } } return LCM; } }
Main.java:24: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumA location: class Main Main.java:31: error: cannot find symbol if(NumA % bigNum == 0 && NumB % bigNum == 0){ ^ symbol: variable NumB location: class Main Main.java:50: error: incompatible types: possible lossy conversion from long to int int temp= numA; ^ 4 errors
s566941461
p00005
Java
import java.util.Scanner; &#160; //GCD and LCM public class Main{ &#160; &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;b = tmp; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;while(b!=0){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long r = a%b; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;b = r; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return a; &#160;&#160;&#160;&#160;} &#160; &#160;&#160;&#160;&#160;public static void main(String[] args) { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Scanner sc = new Scanner(System.in); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;while(sc.hasNext()){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int a = sc.nextInt(); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int b = sc.nextInt(); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long g = gcd(a, b); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.out.println(g+" "+a/g*b); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;} }
Main.java:2: error: class, interface, enum, or record expected &#160; ^ Main.java:2: error: illegal character: '#' &#160; ^ Main.java:5: error: illegal start of type &#160; ^ Main.java:5: error: illegal character: '#' &#160; ^ Main.java:6: error: illegal start of type &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal character: '#' &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal start of type &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal character: '#' &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal start of type &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal character: '#' &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal start of type &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:6: error: illegal character: '#' &#160;&#160;&#160;&#160;public static long gcd(long a, long b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:7: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(a < b){ ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:8: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long tmp = a; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal start of expression &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;a = b; ^ Main.java:9: error: illegal character: '#' &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#
s714282757
p00005
Java
public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while(true){ Long m = scan.nextLong(); Long n = scan.nextLong(); Long g = gcd(m, n); System.out.println(g+" "+(m*n/g)); } } private static Long gcd(Long a, Long b){ if(b == 0){ return a; }else{ return gcd(b, a%b); } } }
Main.java:4: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s466445498
p00005
Java
import java.util.Scanner; public class Main0005 { public static void main(String[] args) { long n, m, k; Scanner in = new Scanner(System.in); while (true) { n = in.nextInt(); m = in.nextInt(); k=Math.max(n, m); m=Math.min(n, m); n=k; System.out.println(gcd(n, m) + " " + (n * m) / gcd(n, m)); } } private static long gcd(long n,long m){ if(n-m>0) return gcd(m, n-m); else return n; } }
Main.java:3: error: class Main0005 is public, should be declared in a file named Main0005.java public class Main0005 { ^ 1 error
s116694360
p00005
Java
import java.util.Scanner; public class GCDandLCM { private GCDandLCM() { try(Scanner in = new Scanner(System.in)){ long a,b; while(in.hasNext()){ a = in.nextInt(); b = in.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } } } public final long gcd(long a, long b) { if(a==b){ return a; } else if(a>b) { return gcd(b,a-b); } else { return gcd(a,b-a); } } public final long lcm(long a, long b) { return a*b/gcd(a,b); } public static void main(String[] args) { new GCDandLCM(); } }
Main.java:3: error: class GCDandLCM is public, should be declared in a file named GCDandLCM.java public class GCDandLCM { ^ 1 error
s761237155
p00005
Java
import java.util.Scanner; public class GCDandLCM { private GCDandLCM() { Scanner in = new Scanner(System.in) long a,b; while(in.hasNext()){ a = in.nextInt(); b = in.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } } public final long gcd(long a, long b) { if(a==b){ return a; } else if(a>b) { return gcd(b,a-b); } else { return gcd(a,b-a); } } public final long lcm(long a, long b) { return a*b/gcd(a,b); } public static void main(String[] args) { new GCDandLCM(); } }
Main.java:6: error: ';' expected Scanner in = new Scanner(System.in) ^ 1 error
s065362860
p00005
Java
import java.util.Scanner; public class GCDandLCM { private GCDandLCM() { Scanner in = new Scanner(System.in); long a,b; while(in.hasNext()){ a = in.nextInt(); b = in.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } } /** * 最大公約数の計算 * @param a * @param b * @return */ public final long gcd(long a, long b) { if(a==b){ return a; } else if(a>b) { return gcd(b,a-b); } else { return gcd(a,b-a); } } /** * 最小公倍数の計算 * @param a * @param b * @return */ public final long lcm(long a, long b) { return a*b/gcd(a,b); } public static void main(String[] args) { new GCDandLCM(); } }
Main.java:3: error: class GCDandLCM is public, should be declared in a file named GCDandLCM.java public class GCDandLCM { ^ 1 error
s069268420
p00005
Java
import java.util.Scanner; public class GCDandLCM { private GCDandLCM() { Scanner in = new Scanner(System.in); long a,b; while(in.hasNext()){ a = in.nextInt(); b = in.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } } public long gcd(long a, long b) { if(a==b){ return a; } else if(a>b) { return gcd(b,a-b); } else { return gcd(a,b-a); } } public long lcm(long a, long b) { return a*b/gcd(a,b); } public static void main(String[] args) { new GCDandLCM(); } }
Main.java:3: error: class GCDandLCM is public, should be declared in a file named GCDandLCM.java public class GCDandLCM { ^ 1 error
s225223502
p00005
Java
import java.util.Scanner; public class aoj0005{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { long a = sc.nextLong(); long b = sc.nextLong(); long d = a * b; long r = 0; for(;a%b != 0;) { r = a % b; a=b; b=r; } System.out.println(r +" "+ (d/r)); } } }
Main.java:3: error: class aoj0005 is public, should be declared in a file named aoj0005.java public class aoj0005{ ^ 1 error
s098067781
p00005
Java
#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <queue> #include <cstring> #include <cmath> #define cl(x) memset(x , 0 , sizeof(x)) typedef long long ll; using namespace std; const int N = 100010; int n,m,k; int w[N]; int t[N]; int pre[N]; void sol() { scanf("%d%d%d",&n,&m,&k); for(int i = 1 ; i <= n; ++i) { scanf("%d",&w[i]); } for(int i = 1 ; i <= m ; ++i) { scanf("%d",&t[i]); } int pos = 1; pre[1] = 1; int sum = 0; for(int i = 2; i <= n ; ++i) { sum += w[i]; while(sum > k) { pos ++; sum -= w[pos]; } pre[i] = pos; } for(int i = 1 ;i <= n; ++i) { pre[i] --; //pre[i] = max(1 , pre[i]); } int preid = 0; int ans = 0; t[0] = 0; for(int i = 1 ; i <= m; ++i) { int tmp = t[i] - t[i-1] - 1; int cur = preid + tmp; if(cur >= n ) { ans += n - preid; break; } ans += tmp; preid = pre[cur]; } printf("%d\n",ans); } int main() { freopen("input.txt","r",stdin); sol(); return 0; }
Main.java:1: error: illegal character: '#' #include <iostream> ^ Main.java:2: error: illegal character: '#' #include <cstdio> ^ Main.java:3: error: illegal character: '#' #include <algorithm> ^ Main.java:4: error: illegal character: '#' #include <cstdlib> ^ Main.java:5: error: illegal character: '#' #include <queue> ^ Main.java:6: error: illegal character: '#' #include <cstring> ^ Main.java:7: error: illegal character: '#' #include <cmath> ^ Main.java:9: error: illegal character: '#' #define cl(x) memset(x , 0 , sizeof(x)) ^ Main.java:11: error: class, interface, enum, or record expected using namespace std; ^ Main.java:12: error: class, interface, enum, or record expected const int N = 100010; ^ Main.java:13: error: class, interface, enum, or record expected int n,m,k; ^ Main.java:14: error: class, interface, enum, or record expected int w[N]; ^ Main.java:16: error: class, interface, enum, or record expected int t[N]; ^ Main.java:17: error: class, interface, enum, or record expected int pre[N]; ^ Main.java:19: error: unnamed classes are a preview feature and are disabled by default. void sol() { ^ (use --enable-preview to enable unnamed classes) Main.java:20: error: illegal start of expression scanf("%d%d%d",&n,&m,&k); ^ Main.java:20: error: illegal start of expression scanf("%d%d%d",&n,&m,&k); ^ Main.java:20: error: illegal start of expression scanf("%d%d%d",&n,&m,&k); ^ Main.java:22: error: illegal start of expression scanf("%d",&w[i]); ^ Main.java:25: error: illegal start of expression scanf("%d",&t[i]); ^ 20 errors
s491065259
p00005
Java
8 6 50000000 30000000
Main.java:1: error: class, interface, enum, or record expected 8 6 ^ 1 error
s063140433
p00005
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true){ String str = br.readLine(); if(str == null || str == "") String[] str1Ary = str.split(" "); long a = Integer.parseInt(str1Ary[0]); long b = Integer.parseInt(str1Ary[1]); System.out.println(getGCD(a, b) + " " + getLCM(a, b)); } } private static long getGCD(long a, long b){ long r; while ((r = a % b) != 0) { a = b; b = r; } return b; } private static long getLCM(long a, long b) { return a * b / getGCD(a, b); } }
Main.java:14: error: variable declaration not allowed here String[] str1Ary = str.split(" "); ^ 1 error
s774975029
p00005
Java
#include <iostream> using namespace std; long gcd(long a, long b) { if(b == 0) return(a); return(gcd(b, a % b)); } long lcm(long m, long n) { if(m == 0 || n == 0) return(0); return((m * n) / gcd(m, n)); } int main(void) { long a, b; while(scanf("%ld %ld", &a, &b) != EOF) { cout << gcd(a, b) << " " << lcm(a, b) << endl; } return(0); }
Main.java:1: error: illegal character: '#' #include <iostream> ^ Main.java:1: error: class, interface, enum, or record expected #include <iostream> ^ Main.java:4: error: unnamed classes are a preview feature and are disabled by default. long gcd(long a, long b) { ^ (use --enable-preview to enable unnamed classes) Main.java:17: error: not a statement cout << gcd(a, b) << " " << lcm(a, b) << endl; ^ Main.java:14: error: <identifier> expected int main(void) { ^ Main.java:16: error: illegal start of expression while(scanf("%ld %ld", &a, &b) != EOF) { ^ Main.java:16: error: illegal start of expression while(scanf("%ld %ld", &a, &b) != EOF) { ^ 7 errors
s884433620
p00005
Java
import java.io.IOException; import java.util.Scanner; public class GCD_and_LCM { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { long a = scan.nextLong(); long b = scan.nextLong(); long gcd = divide(a, b); long lcm = a * b / gcd; System.out.println(gcd + " " + lcm); } } public static long divide(long a, long b) { long r; if (a < b) { long temp = b; b = a; a = temp; } r = a % b; return r == 0 ? b : divide(b, r); } }
Main.java:7: error: class GCD_and_LCM is public, should be declared in a file named GCD_and_LCM.java public class GCD_and_LCM { ^ 1 error
s297382588
p00005
C
#include<iostream> #include<cstdio> #include<cmath> using namespace std; int gcd(int a ,int b){ if(b==0) return a; return gcd(b,a%b); } int lcm(int a,int b,int c){ return b/c*a; } int main(){ int a; int b; cin>>a>>b; cout<<gcd(a,b)<<' '<<lcm(a,b,gcd(a,b)); return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s753212058
p00005
C
#include<bits/stdc++.h> using namespace std; int n,m; int gcd(int a,int b){ return b?gcd(b,a%b):a; } int main() { while(cin>>n>>m){ int d=gcd(n,m); int lcm=n/d*m; cout<<d<<" "<<lcm<<endl; } return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s853752843
p00005
C
#include<iostream> #include<cstdio> using namespace std; int a,b,temp; int main() { while(cin>>a>>b) { temp=0; if(a>b) { for(int i=1;i<=a;i++) { if(a%i==0&&b%i==0) { temp=i; } } cout<<temp<<" "; for(int i=a;;i++) { if(i%a==0&&i%b==0) { cout<<i; break; } } } else { for(int i=1;i<=b;i++) { if(a%i==0&&b%i==0) { temp=i; } } cout<<temp<<" "; for(int i=b;;i++) { if(i%a==0&&i%b==0) { cout<<i; break; } } } cout<<endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s458972163
p00005
C
#include <stdio.h> using namespace std; int gcd(long num1,long num2) { if (num2 == 0) { return num1; }return gcd(num2, num1 % num2); } int lcm(long num1,long num2) { return num1 / (double)gcd(num1, num2) * num2; } int main() { long a, b; while (~scanf("%d %d",&a,&b)) { if (b > a) { int tmp = b; b = a; a = tmp; } printf("%d %d\n", gcd(a, b),(long)lcm(a,b)); } }
main.c:2:1: error: unknown type name 'using' 2 | using namespace std; | ^~~~~ main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' 2 | using namespace std; | ^~~
s546361338
p00005
C
#include<stdio.h> int main(void){ int a, b, n; int i; int c, d; //最大公約数,最小公倍数 while (scanf("%d %d", &a, &b) != EOF){ //Ctrl+Zが押されるまで繰り返す if (a < b){ //a>bになるように入れ替える n = a; a = b; b = n; } for (i = a; i>0; i--){ //最大公約数を求める if (a / i == double(a) / double(i)){ if (b / i == double(b) / double(i)){ c = i; break; } } } i = 1; while (1){ //最小公倍数を求める if (a*i / b == double(a*i) / double(b)){ d = i; break; } i++; } printf("%d %d\n", c, a*d); } return 0; }
main.c: In function 'main': main.c:15:38: error: expected expression before 'double' 15 | if (a / i == double(a) / double(i)){ | ^~~~~~ main.c:16:46: error: expected expression before 'double' 16 | if (b / i == double(b) / double(i)){ | ^~~~~~ main.c:24:40: error: expected expression before 'double' 24 | if (a*i / b == double(a*i) / double(b)){ | ^~~~~~
s845586844
p00005
C
#include<stdio.h> int main(void){ int a, b, n,a1,a2,b1; int i; int c, d; //最大公約数,最小公倍数 while (scanf("%d %d", &a, &b) != EOF){ //Ctrl+Zが押されるまで繰り返す if (a < b){ //a>bになるように入れ替える n = a; a = b; b = n; } for (i = a; i>0; i--){ //最大公約数を求める a1 = a / i; a2 = double(a) / double(i); if (a1==a2){ if (b / i == double(b) / double(i)){ c = i; break; } } } i = 1; while (1){ //最小公倍数を求める if (a*i / b == double(a*i) / double(b)){ d = i; break; } i++; } printf("%d %d\n", c, a*d); } return 0; }
main.c: In function 'main': main.c:16:30: error: expected expression before 'double' 16 | a2 = double(a) / double(i); | ^~~~~~ main.c:18:46: error: expected expression before 'double' 18 | if (b / i == double(b) / double(i)){ | ^~~~~~ main.c:26:40: error: expected expression before 'double' 26 | if (a*i / b == double(a*i) / double(b)){ | ^~~~~~
s947389330
p00005
C
#include<stdio.h> int main(void){ int a, b, n, a1, a2, b1; int i; int c, d; //最大公約数,最小公倍数 while (scanf("%d %d", &a, &b) != EOF){ //Ctrl+Zが押されるまで繰り返す if (a < b){ //a>bになるように入れ替える n = a; a = b; b = n; } for (i = a; i>0; i--){ //最大公約数を求める a1 = a / i; a2 = double(a) / i; if (a1 == a2){ if (b / i == double(b) / double(i)){ c = i; break; } } } i = 1; while (1){ //最小公倍数を求める if (a*i / b == double(a*i) / double(b)){ d = i; break; } i++; } printf("%d %d\n", c, a*d); } return 0; }
main.c: In function 'main': main.c:16:30: error: expected expression before 'double' 16 | a2 = double(a) / i; | ^~~~~~ main.c:18:46: error: expected expression before 'double' 18 | if (b / i == double(b) / double(i)){ | ^~~~~~ main.c:26:40: error: expected expression before 'double' 26 | if (a*i / b == double(a*i) / double(b)){ | ^~~~~~
s545598428
p00005
C
#include<stdio.h> a;main(b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b); }
main.c:2:1: warning: data definition has no type or storage class 2 | a;main(b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b); | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:2:3: error: return type defaults to 'int' [-Wimplicit-int] 2 | a;main(b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b); | ^~~~ main.c: In function 'main': main.c:2:3: error: type of 'b' defaults to 'int' [-Wimplicit-int] main.c:2:54: error: implicit declaration of function '__gcd' [-Wimplicit-function-declaration] 2 | a;main(b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b); | ^~~~~
s381737160
p00005
C
include<stdio.h> int main(){ long long a,b,c,d,e,ans2,ans1,i; while(scanf("%lld %lld",&a,&b)!=EOF){ if(b>a){ c=a; a=b; b=c; } for(i=a;i<=a*b;i++){ if(i%a==0 && i%b==0){ ans2=i; break; } } while(1){ c=a%b; a=b; b=c; if(c==0){ break; } } ans1=a; printf("%lld %lld\n",ans1,ans2); a=b=c=ans1=0; ans2=0; } return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^
s981804962
p00005
C
#include <stdio.h> #define D(fmt,...) fprintf(stderr, fmt, ##__VA_ARGS__) #define P(fmt,...) fprintf(stdout, fmt, ##__VA_ARGS__) int gcd (int a, int b) { int min = a < b ? a : b; int gcd = 1; int i = 0; for (i = 1; i < min; i++) { if (a % i == 0 && b % i == 0) { a /= i; b /= i; gcd *= i; } } return gcd; } int lcm (int a, int b, int g) { int lcm = 0; int min = a < b ? a : b; int x = a / g; int y = b / g; return g * x * y; } int main (int ac, char **av) { while(feof(stdin) == 0) { int a, b = 0; fscanf(stdin, "%d %d\n", &a, &b); int g = gcd(a, b); P("%d %d\n", g, l
main.c: In function 'main': main.c:32:22: error: unterminated argument list invoking macro "P" 32 | P("%d %d\n", g, l | ^ main.c:32:5: error: 'P' undeclared (first use in this function) 32 | P("%d %d\n", g, l | ^ main.c:32:5: note: each undeclared identifier is reported only once for each function it appears in main.c:32:6: error: expected ';' at end of input 32 | P("%d %d\n", g, l | ^ | ; main.c:32:5: error: expected declaration or statement at end of input 32 | P("%d %d\n", g, l | ^ main.c:32:5: error: expected declaration or statement at end of input
s807783649
p00005
C
#include <stdio.h> int rest(int x, int y); int get_gcd(int x, int y); int main(void) { int x, y, gcd, lcm; while(scanf("%d %d", &x, &y)==2) { gcd = get_gcd(x, y); lcm = x * y gcd; printf("%d %d", gcd, lcm); } return 0; } int get_gcd(int x, int y) { if(x<y) { y = y % x; } while(x >= 1 && y >= 1) { x = x % y; if(x == 0) break; y = y % x; } return (x + y); }
main.c: In function 'main': main.c:13:28: error: expected ';' before 'gcd' 13 | lcm = x * y gcd; | ^~~~ | ;
s133440503
p00005
C
#include <stdio.h> int gcd(int,int); int lcm(int,int); int main(){ int a,b; while(scanf("%d %d",&a,&b) != EOF){ printf("%d %d\n",gcm(a,b),lcm(a,b)); } return 0; } int gcd(int m, int n){ if(m == 0 || n == 0) return 0; while(n != m){ if (m > n) m -= n; else n -= m; } return n; } int lcm(int m, int n){ return m / gcd(m, n) * n; }
main.c: In function 'main': main.c:9:34: error: implicit declaration of function 'gcm'; did you mean 'lcm'? [-Wimplicit-function-declaration] 9 | printf("%d %d\n",gcm(a,b),lcm(a,b)); | ^~~ | lcm
s257766681
p00005
C
int main(){ int a,b,g,l,i; while (scanf("%d %d",&a,&b) !=EOF) { g=1; if (a<b) {i=a; a=b; b=i;} for (i=1;i<=a;i++) { if (a%i==0 && b%i==0) {g=i;} } for (i=a*b;i>=a;i--) { if (i%a==0 && i%b==0) {l=i;} } printf("%d %d\n",g,l); } return 0; }
main.c: In function 'main': main.c:3:8: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 3 | while (scanf("%d %d",&a,&b) !=EOF) { | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(){ main.c:3:8: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 3 | while (scanf("%d %d",&a,&b) !=EOF) { | ^~~~~ main.c:3:8: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:3:31: error: 'EOF' undeclared (first use in this function) 3 | while (scanf("%d %d",&a,&b) !=EOF) { | ^~~ main.c:3:31: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:3:31: note: each undeclared identifier is reported only once for each function it appears in main.c:14:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 14 | printf("%d %d\n",g,l); | ^~~~~~ main.c:14:1: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:14:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:14:1: note: include '<stdio.h>' or provide a declaration of 'printf'
s390409765
p00005
C
#include<stdio.h> int main(void){ int a,b,i,gcm=1,lcm=1; while(scanf("%d %d",&a,&b) != EOF){ gcm=1;lcm=1; for(i=2;(i<=a)||(i<=b);i++){ if(a%i==0&&b%i==0){ gcm*=i; } if(a%i==0||b%i==0){ lcm*=i; } if(a%i==0){ a=a/i; } if(b%i==0){ b=b/i; } if(a%i==0||b%i==0){ i=2; } } printf("%d %d",gcm,lcm); /* }*/ return 0; }
main.c: In function 'main': main.c:26:1: error: expected declaration or statement at end of input 26 | } | ^
s837318314
p00005
C
#include <stdio.h> #include <math.h> int main(void){ int a,b,c,d,e; while(scanf("%d %d",&a,&b) != EOF){ c = a*b; while(1){ fmax(a,b) = fmax(a,b)%fmin(a,b); if(fmin(a,b) == 0){ break; } } printf("%d %d",fmax(a,b),c/fmax(a,b)); } return 0; }
main.c: In function 'main': main.c:10:38: error: invalid operands to binary % (have 'double' and 'double') 10 | fmax(a,b) = fmax(a,b)%fmin(a,b); | ~~~~~~~~~^~~~~~~~~~ | | | | double double
s138495288
p00005
C
#include <iostream> #include<math.h> using namespace std; int main() { long long int flag,a1,b1,t,k,a,b; while(cin>>a>>b){ a1=a,b1=b; if(a<b) t=a,a=b,b=t; for(;;){ k=a%b; if(k==0) break; flag=k; a=b; b=k; } cout<<flag<<" "<<(a1/flag)*b1<<endl; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s758617596
p00005
C
#include <stdio.h> int gcd(int a, int b){ if(a<b){ int temp=a; a=b; b=temp; } int c; do{ c=a%b; a=b; b=c; }while(c!=0); return a; } int lcm(int a, int b){ int c, va, vb; c=gcm(a,b); va=a/c; vb=b/c; return c*va*vb; } int main(void){ int a, b; while(scanf("%d %d", &a, &b)!=-1){ printf("%d %d", gcd(a,b), lcm(a,b)); } return 0; }
main.c: In function 'lcm': main.c:26:3: error: implicit declaration of function 'gcm'; did you mean 'lcm'? [-Wimplicit-function-declaration] 26 | c=gcm(a,b); | ^~~ | lcm
s114333551
p00005
C
#include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> int gcd(int a, b) { if(a == 0 || b == 0) return 0; while(a != b) { if(a > b) a -= b; else b -= a; } return a; } int lcm(int a, int b) { if(a == 0 || b == 0) return 0; return (a / gcd(a, b)) * b; } int main() { int a, b; while(scanf("%d %d", &a, &b) != EOF) { printf("%d %d\n", gcd(a, b), lcm(a, b)); } }
main.c:7:16: error: unknown type name 'b' 7 | int gcd(int a, b) { | ^ main.c: In function 'lcm': main.c:18:21: error: implicit declaration of function 'gcd' [-Wimplicit-function-declaration] 18 | return (a / gcd(a, b)) * b; | ^~~