Search is not available for this dataset
name stringlengths 2 88 | description stringlengths 31 8.62k | public_tests dict | private_tests dict | solution_type stringclasses 2
values | programming_language stringclasses 5
values | solution stringlengths 1 983k |
|---|---|---|---|---|---|---|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;
#define repl(i,a,b) for(i... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int P, Q;
int main() {
cin >> P >> Q;
int v = Q / gcd(P, Q);
for (int d = 2; d * d <= v; ++d) {
while ((v / d) % d == 0) {
v /= d;
}
}
cout << max(2, v) << endl;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
import java.util.ArrayList;
public class Main {
Scanner sc = new Scanner(System.in);
public void run(){
int p = sc.nextInt();
int q = sc.nextInt();
calc(p, q);
}
public void calc(int p, int q){
int a = q;
int b = p;
int max = 0;
while(true){
int c = a % b;
if(c == 0){
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
import java.util.ArrayList;
public class Main {
Scanner sc = new Scanner(System.in);
public void run(){
int p = sc.nextInt();
int q = sc.nextInt();
calc(p, q);
}
public void calc(int p, int q){
int a = q;
int b = p;
int max = 0;
while(true){
int c = a % b;
if(c == 0){
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q, r;
cin >> p >> q;
for (size_t i = p + 1 - 1; i >= 1; i--) {
if (!(p % i | q % i)) {
r = i;
break;
}
}
cout << q / r << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | // ?????¬???????????¬??????
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#inclu... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
#include<vector>
using namespace std;
int gcd(int a, int b){
if(b==0) return a;
else return gcd(b, a%b);
}
int main(){
int p, q;
cin>> p>> q;
q=q/gcd(p, q);
vector<int> v;
for(int i=2; i*<=q; i++){
if(q%i==0){
v.push_back(i);
while(q%i=... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
using namespace std:
int main(){
int p, q;
cin >> p >> q;
cout << q/__gcd(p, q) << endl;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
for (auto&& x : vec) is >> x;
return is;
}
template <typename T>
ostream& operator<<(ostream&... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
if (y == 0) return x;
return gcd(y, x % y);
}
int main() {
int p, q;
cin >> p >> q;
int d = gcd(p, q);
cout << q / d << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
int p, q;
cin >> p >> q;
q = q / gcd(p, q);
vector<int> v;
for (int i = 2; i * i <= q; i++) {
if (q % i == 0) {
v.push_back(i);
while (q % i == 0) q... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | using System;
using System.Linq;
namespace _2706
{
class Program
{
static void Main(string[] args)
{
int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
int a = x[0]; int b = x[1];
while (a != 0)
{
int z = b % a;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
vector<int> primes;
const int MA = 30000000;
bool t[MA * 2];
void eratosu() {
t[1] = 1;
for (int i = 2; i <= MA; i++) {
if (t[i] == 0) {
primes.push_back(i);
for (int j = i * 2; j <= MA; j += i) t[j] = 1;
}
}
}
bool check(int x) {
int a... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100005;
map<int, int> mp;
int prime[MAX_N];
bool is_prime[MAX_N];
int sieve(int n) {
int p = 0;
for (int i = 0; i <= n; i++) {
is_prime[i] = true;
}
is_prime[0] = is_prime[1] = false;
for (int i = 2; i <= n; i++) {
if (is_prime[i]) {
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e9 + 10;
const long long linf = (long long)1e18 + 10;
const long long mod = (long long)(1e9 + 7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1,... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX, MOD = 1e9 + 7;
int gcd(int x, int y) {
if (x < y) swap(x, y);
if (!(x % y))
return y;
else
return gcd(y, x % y);
}
int main() {
int p, q;
cin >> p >> q;
int div = gcd(p, q);
cout << q / div << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
bool isPrime[100000];
int main() {
int p, q;
cin >> p >> q;
int d = gcd(p, q);
q /= d;
fill(isPrime, isPrime + 100000, true);
isPrime[0] = isPrime[1] = false;
for (int i = 2; i < 100000;... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
if (y == 0) return x;
return gcd(y, x % y);
}
int main() {
int p, q;
cin >> p >> q;
int d = gcd(p, q);
q /= d;
for (long long i = 2; i * i < q; i++) {
long long x = i * i;
while (x < q) x *= i;
if (x == q) {
q = i;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const double EPS = (1e-10);
using namespace std;
using Int = long long;
const Int MOD = 1000000007;
void fast_input() {
cin.tie(0);
ios::sync_with_stdio(false);
}
template <typename T>
T gcd(T a, T b) {
return b != 0 ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
return ... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | # -*- coding: utf-8 -*-
p, q = map(int, input().split())
ret = q
for b in range(1, 100000):
if b ** 1000 * p % q == 0:
ret = min(ret, b)
print(ret) |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const double EPS = (1e-10);
using namespace std;
using Int = long long;
const Int MOD = 1000000007;
void fast_input() {
cin.tie(0);
ios::sync_with_stdio(false);
}
template <typename T>
T gcd(T a, T b) {
return b != 0 ? gcd(b, a % b) : a;
}
int main(void) {
int p, q;
cin >> p >> q;
w... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int p, q;
cin >> p >> q;
cout << q/__gcd(p, q) << endl;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | # -*- coding: utf-8 -*-
import math
p, q = map(int, input().split())
g = math.gcd(p, q)
p, q = p // g, q // g;
ret = q
for b in range(1, 40000):
if b ** 1000 * p % q == 0:
ret = min(ret, b)
print(ret) |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
if (x < y) swap(x, y);
int z;
while (y) {
z = x % y;
x = y;
y = z;
}
return x;
}
int main() {
int p, q;
cin >> p >> q;
cout << q / gcd(p, q) << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
long long int a, b;
cin >> a >> b;
long long int c = b / gcd(a, b);
long long int ans = 1;
long long int ma = c;
for (long long int ... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
unsigned int p, q;
vector<int> yakusuu;
int main() {
cin >> p >> q;
for (int i = 1; i <= p / 2; i++) {
if (p % i == 0) {
yakusuu.push_back(i);
}
}
yakusuu.push_back(p);
for (int j = 0; j < yakusuu.size(); j++) {
if (q % yakusuu[j] == 0) q = q / y... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int p,q;
cin>>p>>q;
int a=__gcd(p,q);
p/=a,q/=a;
int ans=q;
if(q%p==0) {
int ans=2;
while(q%ans)ans++;
}
cout <<ans<<endl;
return 0;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <iostream>
#include <cmath>
using namespace std;
int gcd(int a,int b){
if(a<b){swap(a,b);}
if(!b){return a;}
return gcd(b,a%b);
}
int main(){
int a=1,p,q,i,gc;
vector<int> cds;
cin>>p>>q;
gc=gcd(p,q);
p/=gc;q/=gc;
for(i=2;i<sqrt(q)+1;i++){
if(!(q%i)){
a... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
int p, q;
cin >> p >> q;
int g = __gcd(p, q);
int b = q / g;
int ans = 1;
rep(i, 1000006... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q;
cin >> p >> q;
int x = 1, a = p, b = q;
for (int i = 2; i <= p; ++i) {
if (a % i == 0 && b % i == 0)
while (a % i == 0 && b % i == 0) {
x *= i;
a /= i, b /= i;
cout << x << ' ' << i << endl;
}
}
cout... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q, x;
cin >> p >> q;
if (p < q) swap(p, q);
int a = p;
while (1) {
if (p % q != 0) {
x = p % q;
p = q;
q = x;
continue;
}
break;
}
cout << a / q << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
queue<long long int> q;
vector<bool> prime(1000000000 + 1, true);
void make(long long int M) {
prime[0] = prime[1] = false;
long long int i;
for (i = 2... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
int p, q;
cin >> p >> q;
q /= gcd(p, q);
for (int i = 2; i < 32000; i++) {
long long int x = i;
while (x <= q) {
if (x == q) {
cout << i << endl;
return 0;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool sosu(int n) {
if (n <= 1) return false;
for (int i = 2; i * i <= n; i++)
if (n % i == 0) return false;
return true;
}
long long gcd(long long a, long long b) {
while (b) b ^= a ^= b ^= a %= b;
return a;
}
int main() {
long long A, B, i = 2;
cin >> A >... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
using namespace std;
#define ll long long
#define ld long dou... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
public class Main {
static PrintWriter out;
static InputReader ir;
static void solve() {
int p = ir.nextInt();
if(p==0)... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
long long gcd;
long long c = max(a, b);
long long d = min(a, b);
while (true) {
if (c % d == 0) {
gcd = d;
goto C;
} else {
c -= d;
if (c <= d) {
swap(c, d);
}
}
}
C:... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
long long c;
while (a != 0) {
c = a;
a = b % a;
b = c;
}
return b;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long long p, q;
cin >> p >> q;
long long g = gcd(p, q);
long long res = q / g... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
using ll = long long;
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; ... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
unsigned int p, q;
vector<int> yakusuu;
int main() {
cin >> p >> q;
for (int i = 1; i <= p / 2; i++) {
if (p % i == 0) {
yakusuu.push_back(i);
}
}
for (int j = 0; j < yakusuu.size(); j++) {
if (q % yakusuu[j] == 0) q = q / yakusuu[j];
}
cout <<... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N=1e2; // 1e8=x, 1e7=? 1e6=o
int n[MAX_N+1]={};
vector <int> prime;
void eratos_sieve(){
for(int i=2;i<=MAX_N;i++){
if(!n[i]){
prime.push_back(i);
for(int j=i;j<=MAX_N;j+=i) n[j]=1;
}
}
}
int main(){
eratos_sieve();
int p,q,r=1... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long p, q;
int main() {
cin >> p >> q;
for (long long i = 2; i <= 1000; i++) {
if (p * i % q == 0) {
cout << i << endl;
break;
}
}
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
int gcd(int a, int b) {
int t;
while (b) {
t = a % b;
a = b;
b = t;
}
return a;
}
int main(void) {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", b / gcd(a, b));
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q;
cin >> p >> q;
int x = 1, a = p, b = q;
for (int i = 2; i <= p; ++i) {
if (a % i == 0 && b % i == 0)
while (a % i == 0 && b % i == 0) {
x *= i;
a /= i, b /= i;
}
}
cout << q / x << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
vector<int> primes;
const int MA = 10000000;
bool t[MA * 2];
void eratosu() {
t[1] = 1;
for (int i = 2; i <= MA; i++) {
if (t[i] == 0) {
primes.push_back(i);
for (int j = i * 2; j <= MA; j += i) t[j] = 1;
}
}
}
int main() {
eratosu();
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 29;
const long long INF = 1ll << 62;
const double pi = acos(-1);
const double eps = 1e-7;
const long long mod = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long gcd(long long a, long long b) {
if (!b) return a;
return gcd(b... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int p,q;
cin>>p>>q;
p=q/__gcd(p,q);
int f=0;
for(int i=2;i*i<p;i++){
if(p%i)continue;
f=i;
break;
}
if(f==0){
cout<<p<<endl;
return 0;
}
int t=p;
while(t%f==0&&t!=1)t/=f;
if(t==1)cout<<f<<endl;
else cout<<p<<endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
#define N 100005
using namespace std;
int p,q,t,ans,prime[N];
set<int> s;
int main(){
for(int i=0;i<N;i++)prime[i]=1;
prime[0]=prime[1]=0;
for(int i=0;i*i<N;i++){
if(!prime[i])continue;
for(int j=i*2;j<N;j+=i)
prime[j]=0;
}
cin>>p>>q;
t=q/__gcd(p,q);
for(int i=0;i*i<... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
queue<long long int> q;
vector<bool> prime(1000000000 + 1, true);
void make(long long int M) {
prime[0] = prime[1] = false;
for (long long int i = 2; i *... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | //
// Created by 拓真 on 2018/06/30.
//
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define int long long
int era[112345678];
void eratos(){
for(int i=0;i<112345;i++)era[i]=1;
era[0]=0;
era[1]=0;
for(int tar=2;tar<112345;tar++){
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
c = a % b
return gcd(b, c)
p, q = map(int, input().split())
g = gcd(p, q)
p //= g
q //= g
ret = q
for b in range(1, 40000):
if b ** 1000 * p % q == 0:
ret = min(ret, b)
print(ret) |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
long long p, q;
cin >> p >> q;
long long m = 1;
for (int i = 1; i <= p; i++) {
if (p % i == 0 && q % i == 0) {
m = i;
}
}
cout << q / m << endl;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
class Point {
public:
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y) {}
Point operator+(Point p) { return Point(x + p.x, y + p.y); }
Point operator-(Point p) { return Point(x - p.x, y - p.y); }
Point operator*(double a) { return Point(x * a, y * a); ... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | #import math
p, q = map(int, input().split())
#g = math.gcd(p, q)
#p //= g
#q //= g
ret = q
for b in range(1, 40000):
if b ** 1000 * p % q == 0:
ret = min(ret, b)
print(ret) |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q;
cin >> p >> q;
for (int i = 2; i < 1e9; i++) {
if (q % i == 0 && p % (q / i) == 0) {
cout << i << endl;
break;
}
}
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 50;
int solve();
long long gcd(long long p, long long q) {
if (q == 0) {
return p;
}
return gcd(q, p % q);
}
int main(void) {
while (solve()) {
}
return 0;
}
int solve() {
long long p, q, g;
cin >> p >> q;
g = gcd(max(p, q)... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.Scanner;
public class Main{
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
long p = scn.nextLong(), q = scn.nextLong();
scn.close();
long qs;
long ans;
long bp = p,bq = q,buf = p;
while(bq % bp != 0) {
buf = bq % bp;
bq = bp;
bp = buf;
}
an... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
int gcd(int p, int q) {
if (q > p) std::swap(p, q);
while (p % q != 0) {
int r = p % q;
p = q;
q = r;
}
return q;
}
int main(void) {
cout << std::fixed << std::setprecision(10);
cin.tie(0);
std::ios::sy... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
int p, q;
cin >> p >> q;
int ans = 1;
for (int i = 2; i <= q; i++) {
if (q % i != 0) continue;
ans *= i;
while (q % i == 0) q /= i;
}
cout << ans << endl;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
int main()
{
int p,q;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define Get(t... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int p,q;
cin>>p>>q;
int a=__gcd(p,q);
p/=a,q/=a;
for(int i=2;i*i<=q;i++){
if(q%i!=0)continue;
int b=q/i;
while(q%(i*i)==0)q/=i;
while(q%(b*b)==0)q/=b;
}
cout <<q<<endl;
return 0;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vecto... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
while (a && b) {
if (a >= b)
a %= b;
else
b %= a;
}
return a + b;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int p, q;
cin >> p >> q;
int x = gcd(p, q);
cout << q / x << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
if (y == 0) return x;
return gcd(y, x % y);
}
void solve() {
int p, q;
cin >> p >> q;
int r = sqrt(p);
while (p != 1 && r * r == p) {
p = r;
r = sqrt(r);
}
r = sqrt(q);
while (q != 1 && r * r == q) {
q = r;
r = sqrt(... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
public class Main {
static PrintWriter out;
static InputReader ir;
static void solve() {
int p = ir.nextInt();
if(p==0)... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long solve(long long a, long long b) {
long long x = max(a, b), y = min(a, b);
if (x % y == 0)
return y;
else
return solve(x % y, y);
}
int main() {
long long p, q, r, ans;
vector<long long> prime(100000);
cin >> p >> q;
r = solve(p, q);
p /= r;... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.BitSet;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
public class Main {
static PrintWriter out;
static InputReader ir;
static void solve() {
int p=ir.nextInt();
int q=ir.n... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
int gcd(int p, int q) {
int p_temp;
while (1) {
if (q == 0) {
break;
}
p_temp = p;
p = q;
q = p_temp % q;
}
return p;
}
int main(void) {
int p;
int q;
cin >> p >> q;
cout << q / gcd(p, q) << endl;
retu... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long solve(long long a, long long b) {
long long x = max(a, b), y = min(a, b);
if (x % y == 0)
return y;
else
return solve(x % y, y);
}
int main() {
long long p, q, r, ans;
vector<long long> prime(100000);
cin >> p >> q;
r = solve(p, q);
p /= r;... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
void solve() {
int p, q;
cin >> p >> q;
cout << q / gcd(p, q) << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie();
solve();
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
long a, b;
int main() {
cin >> a >> b;
b /= gcd(a, b);
for (long i = 2; i * i <= b; i++) {
for (long j = i * i; j <= b; j *= i) {
if (b == j) {
cout << i << endl;
return 0;
}
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long p, q;
vector<int> yakusuu;
int main() {
cin >> p >> q;
for (int i = 1; i <= p / 2; i++) {
if (p % i == 0) {
yakusuu.push_back(i);
}
}
for (int j = 0; j < yakusuu.size(); j++) {
if (q % yakusuu[j] == 0) q = q / yakusuu[j];
}
cout << q << en... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
int p, q;
cin >> p >> q;
q = q / gcd(p, q);
vector<int> v;
cout << q << endl;
for (int i = 2; i * i <= q; i++) {
if (q % i == 0) {
v.push_back(i);
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
queue<long long int> q;
vector<bool> prime(1000000000 + 1, true);
void make(long long int M) {
prime[0] = prime[1] = false;
long long int i;
for (i = 2... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 50;
int solve();
long long gcd(long long p, long long q) {
if (q == 0) {
return p;
}
return gcd(q, p % q);
}
int main(void) {
while (solve()) {
}
return 0;
}
int solve() {
long long p, q, g;
cin >> p >> q;
g = gcd(max(p, q)... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int euclid(int x, int y) {
int t;
while (x % y) {
x %= y;
t = x;
x = y;
y = t;
}
return y;
}
int main() {
int p, q, n, m, t = 2, ans = 1;
cin >> p >> q;
n = q / euclid(p, q);
m = n;
map<int, int> f;
while (n > 1 && t < sqrt(m)) {
if (... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.*;
public class Main{
public static void main(String args[]){
try(Scanner sc = new Scanner(System.in)){
long p = sc.nextLong(), q = sc.nextLong();
long memo = q/gcd(p,q);
long ans = memo;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
/**
* Let's Solve Geometric Problems
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamRea... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int q,p,t,ans=1,i,j,c=0;
cin>>q>>p;t=p;
p/=__gcd(q,p);
if(p!=t)for(i=2;i*i<=t;i++){
if(p%i==0){
p/=i;
ans*=i;
i--;
}
}
else ans=t;
cout<<ans<<endl;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 50;
int solve();
long long gcd(long long p, long long q) {
if (q == 0) {
return p;
}
return gcd(q, p % q);
}
int main(void) {
while (solve()) {
}
return 0;
}
int solve() {
long long p, q, g;
cin >> p >> q;
g = gcd(max(p, q)... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q, mi;
cin >> p >> q;
mi = (p, q);
while (p % q == 0) {
if (q == 1) break;
p /= q;
q /= q;
}
for (int i = 2; i * i <= mi; i++) {
while (p % i == 0 && q % i == 0) {
p /= i;
q /= i;
}
while (q % (mi / i) == 0... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
long long p, q;
cin >> p >> q;
long long m = 1;
for (int i = 1; i <= p; i++) {
if (p % i == 0 && q % i == 0) {
m = i;
}
}
cout << q / m << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, q, x, test;
cin >> p >> q;
if (p < q) swap(p, q);
test = p;
while (1) {
if (p % q != 0) {
x = p % q;
p = q;
q = x;
continue;
}
break;
}
cout << test / q << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int euclid(int x, int y) {
int t;
while (x % y) {
x %= y;
t = x;
x = y;
y = t;
}
return y;
}
int main() {
int p, q, n, m, t = 2, ans = 1;
cin >> p >> q;
n = q / euclid(p, q);
m = n;
map<int, int> f;
while (n > 1 && t < sqrt(m) + 1) {
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::fixed;
using std::list;
using std::make_pair;
using std::map;
using std::pair;
using std::priority_queue;
using std::queue;
using std::set;
using std::setprecision;
using std::stack;
using std::string;
using std::vector;
int gcd(int p... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
long long int p, q;
cin >> p >> q;
q /= gcd(p, q);
for (int i = 2; i < 32000; i++) {
double x = log(q) / log(i);
if (ceil(x) == floor(x)) {
cout << i << endl;
return 0;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
vector<long long> prime;
long long gcd(long long a, long long b) {
if (a == 1) {
return b;
} else {
return gcd(b, b % a);
}
}
void pri() {
vector<bool> state(5001, false);
for (long long i = 2; i < 5000; i++) {
if (!state[i]) {
prime.push_back(i)... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int p,q,t,ans=1,num;
set<int> s;
cin>>p>>q;
num=t=q/__gcd(p,q);
for(int i=2;i<=num;i++){
if(!(num%i)){
s.insert(i);
while(!(num%i))num/=i;
}
}
set<int>::iterator ite=s.begin();
while(ite!=s.end())ans*=*ite,ite++;
if(ans==1)a... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int p,q,t,ans;
cin>>p>>q;
ans=t=q/__gcd(p,q);
for(int i=2;i*i<=t;i++)
if(i*i==t)ans=i;
cout<<ans<<endl;
return 0;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
int in(void) {
int i;
scanf("%d", &i);
return i;
}
long long llin(void) {
long long i;
scanf("%lld", &i);
return i;
}
void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
long long max(long... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
vector<int> primes;
const int MA = 30000000;
bool t[MA * 2];
void eratosu() {
t[1] = 1;
for (int i = 2; i <= MA; i++) {
if (t[i] == 0) {
primes.push_back(i);
for (int j = i * 2; j <= MA; j += i) t[j] = 1;
}
}
}
bool check(int x) {
int a... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
#define N 100005
using namespace std;
int p,q,t,ans,prime[N];
set<int> s;
int main(){
for(int i=0;i<N;i++)prime[i]=1;
prime[0]=prime[1]=0;
for(int i=0;i*i<N;i++){
if(!prime[i])continue;
for(int j=i*2;j<N;j+=i)
prime[j]=0;
}
cin>>p>>q;
t=q/__gcd(p,q);
for(int i=0;i*i<... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int COU(int a, int b) {
if (a == b || a == 0) return 1;
while (true) {
if (a < b) {
int t = a;
a = b, b = t;
}
if (b == 0) return a;
a %= b;
}
}
int main() {
int p, q;
cin >> p >> q;
cout << q / COU(p, q) << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
struct UnionFind {
vector<int> v;
UnionFind(int n) : v(n) {
for (int i = 0; i < n; i++) v[i] = i;
}
int find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
void unite(int x, int y) { v[find(... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
int p, q;
cin >> p >> q;
int g = __gcd(p, q);
int b = q / g;
rep(i, 100005) if (i > 1) {
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
int p, q;
cin >> p >> q;
int d = gcd(p, q);
cout << q / d << endl;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return (y == 0 ? x : gcd(y, x % y)); }
int main() {
int P, Q;
cin >> P >> Q;
int G = gcd(P, Q);
cout << std::max(2, Q / G) << endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.