Task: | Pinot |
Sender: | TapaniS |
Submission time: | 2020-09-05 08:17:31 +0300 |
Language: | Java |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 23 |
#2 | ACCEPTED | 77 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.22 s | 1, 2 | details |
#2 | ACCEPTED | 0.22 s | 2 | details |
Code
import java.util.*;public class pinot2 {public static void main(String[] args) {Scanner input = new Scanner(System.in);int qty = input.nextInt();int[] a = new int[qty];int[] b = new int[qty];int[] ans = new int[qty];for (int i = 0; i < qty; i++) {a[i] = input.nextInt();b[i] = input.nextInt();}int test = 1;int a1 = 1;int b1 = 1;int whole = 1;int remain = 1;for (int i = 0; i < qty; i++) {ans[i] = 0;a1 = a[i];b1 = b[i];remain = 1;while (remain > 0 ) {whole = Math.max(a1, b1) / Math.min(a1, b1);remain = Math.max(a1, b1) % Math.min(a1, b1);ans[i] += whole;if (a1 > b1) a1 = a1 - (whole * b1);else b1 = b1 - (whole * a1);}System.out.println(ans[i]);}input.close();}}
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
1000 5 90 19 86 66 28 10 47 ... |
correct output |
---|
18 15 9 10 16 ... |
user output |
---|
18 15 9 10 16 ... Truncated |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
1000 1 936283842 56227247 73458046 364717918 449812461 158413382 363667122 ... |
correct output |
---|
936283842 167 116 59 158 ... |
user output |
---|
936283842 167 116 59 158 ... Truncated |