Skip to content

Instantly share code, notes, and snippets.

@modos
Created July 23, 2022 04:06
Show Gist options
  • Save modos/65da7f5e283bfdeb3db37558a22c303c to your computer and use it in GitHub Desktop.
Save modos/65da7f5e283bfdeb3db37558a22c303c to your computer and use it in GitHub Desktop.
جمع فوتبالی
import java.util.Scanner;
/**
* Main
*/
public class Main {
public static void calc(int a, int b, int c, int d, String[] results, int i) {
int esteghlalGoals = b + d;
int perspolisGoals = a + c;
if (esteghlalGoals > perspolisGoals) {
results[i] = "esteghlal";
}else if (perspolisGoals > esteghlalGoals) {
results[i] = "perspolis";
}else {
if (b > c) {
results[i] = "esteghlal";
}else if (c > b) {
results[i] = "perspolis";
}else {
results[i] = "penalty";
}
}
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
String[] results = new String[t];
for (int i = 0; i < t; i++) {
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
int d = input.nextInt();
calc(a,b,c,d,results, i);
}
for (int i = 0; i < t; i++) {
System.out.println(results[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment