QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#345210 | #3417. Grachten | PetroTarnavskyi# | AC ✓ | 0ms | 3724kb | C++20 | 646b | 2024-03-06 16:26:13 | 2024-03-06 16:26:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int ab, ac, bd;
while (cin >> ab >> ac >> bd)
{
int num = ab * ac, den = bd - ac, g = gcd(num, den);
cout << num / g << "/" << den / g << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
143 715 923 143 715 924 143 715 925 143 715 926 143 715 927 143 715 928 143 715 929 143 715 930
output:
7865/16 9295/19 20449/42 102245/211 102245/212 102245/213 102245/214 20449/43
result:
ok 8 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
997 997 998 997 998 999 997 999 1000 998 997 998 998 998 999 998 999 1000 999 997 998 999 998 999 999 999 1000 1000 997 998 1000 998 999 1000 999 1000
output:
994009/1 995006/1 996003/1 995006/1 996004/1 997002/1 996003/1 997002/1 998001/1 997000/1 998000/1 999000/1
result:
ok 12 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
670 226 928 930 513 956 708 537 893 773 708 995 984 88 1000 871 771 890 115 93 666 532 516 615 436 797 992 983 400 998 337 442 941 798 60 818 804 255 911 926 606 994 110 488 782 808 702 967 140 70 853 647 467 885 990 245 993 757 844 986 847 489 911 106 149 670 960 341 971 668 440 989 847 874 1000 66...
output:
75710/351 477090/443 95049/89 547284/287 1804/19 671541/119 3565/191 91504/33 347492/195 196600/299 148954/499 23940/379 51255/164 140289/97 26840/147 567216/265 9800/783 302149/418 11025/34 319454/71 414183/422 15794/521 10912/21 293920/549 52877/9 22113/25 3972/101 131537/187 627324/17 157537/128 ...
result:
ok 109 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
5 3 7 5 3 8 1 2 3 23 42 47 500 500 1000 1 1 1000
output:
15/4 3/1 2/1 966/5 500/1 1/999
result:
ok 6 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
1 1 2 1 2 3 2 1 2 2 2 3
output:
1/1 2/1 2/1 4/1
result:
ok 4 lines