oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

fraction Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

fraction.html

Problem Description

FanPu is busy doing his math homework given by his math teacher, Squeaky the Rat. Today's math homework is on simplifying fractions.

"This is easy", FanPu thinks to himself. "2/4 simplified is 1/2."

However, suddenly, Kraw the Krow flies overhead and zaps his homework with a laser beam. Boom! The questions in FanPu's homework changed!

"332/874?!", FanPu sits back in shock. "Such large numbers, it'll take me forever to simplify these!."

FanPu knows Squeaky the Rat will be angry if he doesn't not submit his homework on time and he turns to you for help. Given a fraction A/B, help FanPu simplify the fraction.

Input

The first line of input will contain two integers A and B.

Output

Output a fraction C/D, the simplified form of the given fraction A/B.

Limits

Subtask 1 (37%): 1 ≤ A, B ≤ 1000

Subtask 2 (63%): 1 ≤ A, B ≤ 1018

Subtask 3 (0%): Sample Testcases

Sample Testcase 1

Input

2 4

Output

1/2

Sample Testcase 2

Input

332 874

Output

166/437

Sample Testcase 3

Input

3 3

Output

1/1

Sample Testcase 4

Input

16 4

Output

4/1

Tags

Math

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
137541s32MBMinimum
2631041s32MBMinimum
3041s32MBMinimum

Judge Compile Command

g++-8 ans.cpp -o fraction -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.