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": []
} | CORRECT | java | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int P = sc.nextInt();
int Q = sc.nextInt();
Q /= gcd(P, Q);
int ans = 1;
for (int i = 2; i * i <= Q; i++) {
if (Q % 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": []
} | 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": []
} | CORRECT | python3 | def gcd(a, b):
while b: a, b = b, a % b
return a
a,b=map(int,input().split())
b//=gcd(a,b)
a,c=2,1
while a*a<=b:
if b%a==0:
c*=a
while b%a==0:b//=a
a+=1
print([c*b,c][b==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": []
} | CORRECT | cpp | #include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>
#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#de... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const long long int MOD = 1000000007;
const int INF = 1000000000;
int p, q;
int main(){
cin >> p >> q;
int pp = p, qq = q;
while(qq){
pp %= ... |
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": []
} | CORRECT | cpp | #include "bits/stdc++.h"
using namespace std;
//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,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": []
} | CORRECT | cpp | #include <iostream>
#include <cmath>
using std::cin;
using std::cout;
using std::endl;
int gcd(int n, int m) {
if ( n%m == 0 ) {
return m;
}
else {
return gcd(m,n%m);
}
}
int main(void) {
int p,q;
cin >> p >> q;
int n = q;
int m = p;
int l = gcd(n,m);
while ( l != 1 ) {
n = n/l;
m = m/l;
l = gcd... |
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": []
} | CORRECT | cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>
using namespace std;
long long int LCM(long long int a, long long int b){
long long int dummy1, dummy2, dummy;
dummy1 = max(a, b);
dummy2 = min(a, b);
while(true){
dummy = dummy1 % d... |
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": []
} | CORRECT | cpp | #include"bits/stdc++.h"
using namespace std;
using ll = int64_t;
ll gcd(ll a, ll b) {
return (b == 0 ? a : gcd(b, a % b));
}
bool isPrime(ll n) {
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
int main() {
ll p, q;
cin >> 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": []
} | CORRECT | java | import java.util.ArrayList;
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
ArrayList<Long> yaku = new ArrayList<Long>();
Scanner scn = new Scanner(System.in);
long p = scn.nextLong(), q = scn.nextLong();
scn.close();
long qs;
long ans = 1;
long bp = p,bq = q,buf =... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int Prime[100000]={};
void pr(){
Prime[0]=2;
int tmp=1,num=1;
while(num<100000){
num+=2;
int flag=0;
for(int i=3;i<=sqrt(num);i+=2)
if(num%i==0) flag++;
if(flag==0) Prime[tmp++]=num;
}
}
int gcd(int x,int y){
return y?gcd(y,x%y):x;
}
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": []
} | CORRECT | cpp | #include <iostream>
using namespace std;
int gcd(int a, int b) {
if (a == 0) {
return b;
}
return gcd(b % a, a);
}
int main() {
int p, q;
cin >> p >> q;
while (true) {
int g = gcd(p, q);
if (g == 1) {
break;
}
p /= g;
q /= g;
}
int t = q;
int ans = 1;
for (int 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first fi;
#define second se;
using namespace std;
typedef pair<int, int> P;
int gcd(int a, int 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": []
} | CORRECT | python3 | prime = [2]
def check(x):
for i in prime:
if x % i ==0:
return False
elif x < i * i:
break
return True
def set():
for i in range(3,10**5,2):
if check(i):
prime.append(i)
set()
#print('ok')
#print(prime)
p,q = [int(i) for i in input().split(' ')]... |
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": []
} | CORRECT | cpp | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " "
#define LLi long long int
using namespace std;
vector<LLi> pri={1, 2, 3};
void PV(vector<int> pvv) {
rep(i, pvv.size()) cout << pvv[i] SP;
cout << endl;
}
void PVL(vector<LLi> pvv) {... |
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": []
} | CORRECT | cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using namespace std;
using lli = 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": []
} | CORRECT | cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T 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": []
} | 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>
#include <limits>
#include <cfloat>... |
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": []
} | 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(){
cin.tie(0);
ios::sync_with_stdio(false);
int p,q,r=1; cin >> p >> q;
q/=gcd(p,q);
for (int i=2;i*i<=q;++i){
if (q%i==0){
r*=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": []
} | CORRECT | cpp |
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#defin... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
return b ? gcd(b, a % b) : a;
}
int main() {
int p, q;
cin >> p >> q;
p = gcd(p, q);
q /= p;
set<int> s;
for (int i = 2; i <= q;) {
if (i * i > q) {
i = q;
}
if (q % i == 0) {
q /= i;
s.insert(i);
} else {
i++;
}
}
in... |
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": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
using namespace std;
using ll = long long;
ll gcd(const ll a, const ll b)
{
if (a == 0 or b == 0) {
return (a == 0) ? b : a;
}
if (a > b) {
return gcd(b, a);
} else {
return gcd(b % a, a);
}
}
constexpr int SQRT = 100000;
bool isprime[... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long // <-----!!!!!!!!!!!!!!!!!!!
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#de... |
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": []
} | CORRECT | cpp | /* -*- coding: utf-8 -*-
*
* 2706.cc: Let's Solve Geometric Problems
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<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": []
} | CORRECT | cpp |
#include<iostream>
using namespace std;
int p,q,ans=1,j;
int so(int n){
for(int i=2;i*i<=n;i++)if(n%i==0)return 1;
return 0;
}
int main(){
cin>>p>>q;
if(so(q)){
for(int i=2;q>=i;i++){
for(j=0;q%i==0;j++){
q/=i;
if(p%i==0)p/=i,j--;
}
if(j==0)continue;
/*if(p%(i*j)==0)p/=(i*j);
e... |
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": []
} | CORRECT | cpp | #include "bits/stdc++.h"
#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP... |
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": []
} | CORRECT | cpp | #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(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": []
} | CORRECT | cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(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": []
} | CORRECT | cpp |
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 50;
int solve();
ll gcd(ll p, ll q) {
if (q == 0) { return p; }
return gcd(q, p%q);
}
int main(void) {
while (solve()) {}
return 0;
}
int solve() {
ll 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).beg... |
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": []
} | 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*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": []
} | 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": []
} | CORRECT | java |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
// TODO 自動生成されたメソッド・スタブ
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] tmpArray = br.readLine().spl... |
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": []
} | CORRECT | cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
map<long long, int> prime_factorize(long long n) {
map<long long, int> res;
for (long long p = 2; p * p <= n; ++p) {
while (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": []
} | 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;
cin>>p>>q;
gc=gcd(p,q);
p/=gc;q/=gc;
for(i=2;i<sqrt(q)+1;i++){
if(!(q%i)){
a*=i;
whil... |
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": []
} | CORRECT | cpp | #include<iostream>
#include<algorithm>
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;
q/=COU(p,q);
for(int i=2;i*i<=q;i++){
while(!(q%(i*i)))q/=i;
}
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": []
} | CORRECT | python3 | def gcd(a,b):
while b:a,b=b,a%b
return a
if __name__=="__main__":
a,b=map(int,input().split())
b//=gcd(a,b)
a,c=2,1
while a**2<=b:
if b%a==0:
c*=a
while b%a==0: b//=a
a+=1
print(c if b==1 else c*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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) {
return b ? GCD(b, a%b) : a;
}
int main()
{
int p, q, n, res = 1;
cin >> p >> q;
n = q / GCD(p, q);
for (int i = 2; i < sqrt(n) + 2; i++) {
if (n % i == 0) {
res *= i;
while (n % i == 0) {
n /= i;
}
}
}
res *= n;
if (res == ... |
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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(a) (a).begin(),(a).end()
using ll = long long;
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main(){
int p, q;
cin>>p>>q;
int g = gcd(q, p);
q /= g;
int res = 1;
for (int i = 2; i*i <= q; ++i) {
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": []
} | CORRECT | java | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
static int[][] map;
static int[][] directions8 = { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 },
{ 1, 1 } };
static int[][] directions4 = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
static int ans;
publi... |
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": []
} | CORRECT | cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int p, q, mi, ans, temp;
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 && 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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int gcd(int p,int q){
return q==0 ? p : gcd(q,p%q);
}
int main(){
int p,q;
while(cin>>p>>q,p){
int g=gcd(p,q);
p/=g;
q/=g;
long long int res=1;
for(int i=2;i<1e5;i++){
if(q%i==0){
res*=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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
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 r=gcd(q,p);
p/=r;q/=r;
int ans=1;
for(int i=2;i*i<=q;i++){
if(q%i!=0)continue;
ans*=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": []
} | CORRECT | python3 | import math
# import numpy as np # Pythonのみ!
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components # Pythonのみ!
# ↑cf. https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
d... |
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": []
} | CORRECT | cpp | #include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;
int yaku(int n,int m){
if(n%m==0){
return m;
}
return yaku(... |
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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).su... |
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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
using ll = long long;
void bunkai(vector<ll> &a,ll x){
ll temp=x;
for(ll i=2;i*i<=x;i++){
if(temp%i==0){
a.push_back(i);
while(temp%i==0){
temp/=i;
}
}
}
a.push_back(temp);
return;
}
ll gcd(ll x,ll y){
if(x%y==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": []
} | CORRECT | cpp | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;
int calc(int x,int y){
if(y == 0){
return x;
}else{
return calc(y,x%y);
}
}
int main(){
int p,q,common,limit;
scanf("%d %d",&... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double>... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
int gcd(int x, int y){
if(x % y == 0) return y;
return gcd(y, x % y);
}
bool prime(int x){
bool f = true;
for(int i=2; i*i<=x; ++i)
if(x % i == 0)
f = false;
return f;
}
int main(){
// cin.tie(0);
// ios::sync_with_stdio(false);
cin >> p >> q;
int 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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
#define REP(i,j) for(int i = 0; i < j; i++)
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int main(){
int p1,q;
cin >> p1 >> q;
int t = gcd(p1,q);
q /= t;
vector<int> pl;
pl.push_back(2);
pl.push_back(3);
for(int i = 5; i*i < 1e9; i+=2){
bool f = 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
int main() {
cin >> p >> q;
vector<int> A = {};
for (int i = 2; i * i <= q; i++) {
if(q % i == 0) {
A.push_back(i);
A.push_back(q / i);
}
}
for (auto i : A) {
while (p % i == 0 and q % i == 0) {
p /= i;
q /= i;
}
}
vector<int> pr ={};
... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#de... |
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": []
} | CORRECT | cpp | #include<iostream>
using namespace std;
int p, q; int gcd(int a, int b) { if (b == 0)return a; return gcd(b, a%b); }
int main() {
cin >> p >> q; int res = 1; int r = gcd(p, q); q /= r;
for (int i = 2; i*i <= q; i++) {
if (q%i == 0) { res *= i; while (q%i == 0)q /= i; }
}
if (q >= 2)res *= q;
cout << res << 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": []
} | CORRECT | cpp | #include<iostream>
using namespace std;
int p,q,ans=1,j;
int so(int n){
for(int i=2;i*i<=n;i++)if(n%i==0)return 1;
return 0;
}
int main(){
cin>>p>>q;
if(so(q)){
for(int i=2;q>=i;i++){
for(j=0;q%i==0;j++){
q/=i;
if(p%i==0)p/=i,j--;
}
if(j==0)continue;
ans*=i;
}
cout<<ans<<... |
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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
struct Point
{
double x,y;
Point(){x=0;y=0;}
Point(double d_x,double d_y){x=d_x,y=d_y;}
double operato... |
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": []
} | 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 /= GCD(p, q);
map<int, int> mpa;
for(int i = 2; i * i <= q; i++){
while(q % i == 0){
mpa[i]++;
q /= i;
}
}
if(q != 1) mpa[q]++;
map<int, 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": []
} | CORRECT | cpp | #include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long lon... |
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": []
} | CORRECT | cpp | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#defi... |
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": []
} | CORRECT | cpp | #include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limit... |
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": []
} | 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;
int g = gcd(p, q);
p /= g;
q /= g;
int ans = 1;
for (int i = 2; i * i <= q; i++){
if (q % i == 0){
ans *= i;
whi... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define ll long long
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;
q /= gcd(p, q);
for (int i = 2; i * i <= q; i++) {
while (q % (i * i) == 0) q /= i;
}
cout << 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": []
} | CORRECT | cpp | #include <iostream>
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);
long long int x = 1;
for(int i = 2; i * i <= q; i++){
if(q % i == 0){
x *= i;
while(q % i == 0) q /= i;
}
}
cout << x * 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef uns... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<cstring... |
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": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int gcd(int a, int b){
if(b==0) return a;
return gcd(b,a%b);
}
bool isPrime[100000];
typedef pair<int,int> P;
int main(){
int p,q;
cin>>p>>q;
int d = gcd(p,q);
p/=d; q/=d;
// cout<<p<<' '<<q<<endl;
fill(isP... |
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": []
} | CORRECT | cpp | #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
... |
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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;
int gcd(int a, int b) {
while (b > 0) { int t = a % b; a = b; b = t; }
return a;
}
int main() {
int p, q;
cin >> p >> q;
int g = gcd(p, q);
q /= g;
int ans = 1;
for (int i = 2; i * i <= 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": []
} | CORRECT | python3 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.... |
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": []
} | CORRECT | cpp | #include <iostream>
using namespace std;
int gcd(int p,int q){
int r=q%p;
while(r>0){
q=p;
p=r;
r=q%p;
}
return p;
}
int divide(int b,int i){
while(b%(i*i)==0){
b/=i;
}
return b;
}
int main(){
int p,q;
cin>>p>>q;
int b=q/gcd(p,q);
for(int i=2;i*i<=b;i++)
b=divide(b,i);
cou... |
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": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
int main(){
int p,q;
method(gcd,int,int a,int 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
int ext_gcd(int a, int b, int &x, int &y){
if(b == 0){
x = 1; y = 0; return a;
}
int q = a / b;
int g = ext_gcd(b, a-q*b, x, y);
int z = x - q * y;
x = y; y = z;
return g;
}
map<int,int> pf(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": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
long gcd(long a, long b){
if(b == 0)
return a;
return gcd(b, a%b);
}
int main(){
long p, q;
cin >> p >> q;
long tmp = gcd(q, p);
p /= tmp;
q /= tmp;
long ans = 1;
long root = sqrt(q) + 1;
vector<bool> hurui(root, tr... |
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": []
} | CORRECT | cpp | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;
int main(){
int p,q,pre_limit,limit;
scanf("%d %d",&p,&q);
pre_limit = sqrt(q);
for(int i = 2; i <= pre_limit; i++){
while(p%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": []
} | CORRECT | cpp | #include<iostream>
using namespace std;
unsigned gcd(unsigned a, unsigned b) {
if(a < b) return gcd(b, a);
unsigned r;
while ((r=a%b)) {
a = b;
b = r;
}
return b;
}
int main(){
long long p,q,t=1,gc;
cin >> p >> q;
gc = gcd(p,q);
p /= gc;
q /= gc;
for(int i=2;i*i<=q;i++){
if(q%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": []
} | CORRECT | cpp | #include<iostream>
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++)
{
while(b%(i*i)<1)b/=i;
}
cout<<b<<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": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;
typedef long long ll;
int P, Q;
bool p[1000000];
vector<int> v;
int gcd(int a, int b) {
if(b == 0) return a;
return gcd(b, a % b);
}
bool prime(int n) {
REP(i, 0, v.size()) if(n % v[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": []
} | 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 solve(int n) {
int res = 1;
for (int i = 2; i * i <= n; i++) {
if (n % i) continue;
res *= i;
while (n % i == 0) n /= i;
}
if (n != 1) res *= n;
return res;
}
int main(v... |
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": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
//#include <numeric>
using namespace std;
#define FOR(i,a,b) for (size_t i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (size_t i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define INF 1e7
long gcd(long a, long b)
{
long r;
do {
r = 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define ll long long
#define var auto
using namespace std;
ll gcd(ll a, ll b){
while(true){
if (a == 0) return b;
b %= a;
if (b == 0) return a;
a %= b;
}
}
int main(){
ll p, q;
cin >> p >> q;
var g = gcd(p, q);
p /= g;
q /= g;
ll res = 1;
for (ll i = 2; 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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int x, int y) {
if (x<=y) return gcd(y, x);
if (x%y == 0) return y;
else return gcd(y, x%y);
}
int main() {
int p, q; cin >> p >> q;
int r = q/gcd(p, q);
int s = r;
int res = 1;
for (int i = 2; i*i <= r; ++i) {
if (s%i == 0) {
re... |
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": []
} | CORRECT | cpp | #include <cstdio>
#include <utility>
int gcd(int m, int n) {
while (n) std::swap(m %= n, n);
return m;
}
int main() {
int p, q;
scanf("%d %d", &p, &q);
int m = q / gcd(p, q);
int res = 1;
for (int i = 2; i*i <= m; ++i) {
if (m % i == 0) {
res *= i;
do {
m /= i;
} while (m ... |
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": []
} | CORRECT | cpp | #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000... |
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": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll power(ll e, ll x) {
if (x == 0)
return 1;
if (x % 2 == 0)
return power(e * e, x / 2);
return e * power(e, x - 1);
}
int main() {
ll a, b;
cin >> a >> b;
a %= b;
map<ll, int> amp, bmp;
for (ll i = 2; i * i <= a; 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": []
} | CORRECT | cpp | #include<iostream>
#include<map>
#include<algorithm>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#incl... |
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": []
} | CORRECT | cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const in... |
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 lcm(long int a, long int b) {
if (a < b) {
swap(a, b);
}
if (!b) {
return a;
}
return lcm(b, a % b);
}
int main() {
long int i, p, q, lc, cl;
double lm, buf, df, m;
cin >> p >> q;
lc = lcm(p, q);
p /= lc;
q /= lc;
lm = log(q) / log(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 main() {
long x, y;
cin >> x >> y;
long z = y;
if (x < y) swap(x, y);
int sum = 0;
do {
x = x % y;
swap(x, y);
sum++;
} while (y != 0);
cout << z / 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 | 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 buf_u = q,buf_d = p,buf = 0;
while(buf_u%buf_d!=0) {
buf = buf_d;
buf_d = buf_u%buf_d;
buf_u = buf;
}
buf = ... |
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 MOD = 1000000007;
const long long INF = (long long)1000000007 * 1000000007;
const double EPS = 1e-9;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
int isp[100000] = {};
vector<int> v;
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 a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
int a, b;
cin >> a >> b;
int c = gcd(a, b);
cout << b / c << 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 | java | import java.util.ArrayList;
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
ArrayList<Long> yaku = new ArrayList<Long>();
Scanner scn = new Scanner(System.in);
long p = scn.nextLong(), q = scn.nextLong();
scn.close();
long qs;
long ans = q;
long bp = p,bq = q,buf =... |
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 prim[10000000];
int main(){
int p,q;
cin>>p>>q;
int a=__gcd(p,q);
p/=a,q/=a;
for(int i=2;i<=q;i++){
if(q%i==0&&(q/i)%i==0)q/=i,i--;;
}
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 | python3 | prime = [2]
def check(x):
for i in prime:
if x % i ==0:
return False
elif x < i * i:
break
return True
def set():
for i in range(3,10**5,2):
if check(i):
prime.append(i)
set()
#print(prime)
p,q = [int(i) for i in input().split(' ')]
for i in pr... |
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() {
cin.tie(0);
ios::sync_with_stdio(false);
long long p, q;
cin >> p >> q;
q = q / __gcd(p, q);
int ans = 1;
vector<int> primeNumbers;
vector<int> flag(q + 1, true);
for (int i = 2; i <= sqrt(q); i++) {
if (flag[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 = 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)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.