1+ import java .util .Scanner ;
2+ public class IPA28 {
3+ public static void main (String [] args ) {
4+ Scanner sc = new Scanner (System .in );
5+ int n = sc .nextInt ();sc .nextLine ();
6+ Team [] t = new Team [n ];
7+ for (int i = 0 ; i < t .length ; i ++) {
8+ int a = sc .nextInt ();sc .nextLine ();
9+ String b = sc .nextLine ();
10+ String c = sc .nextLine ();
11+ int d = sc .nextInt ();
12+
13+ t [i ] = new Team (a ,b ,c ,d );
14+ }
15+ int r = sc .nextInt ();sc .nextLine ();
16+ String con = sc .nextLine ();
17+ Team ans = findPlayer (t ,r ,con );
18+ if (ans !=null )
19+ {
20+ System .out .println (ans .gettId ());
21+ System .out .println (ans .gettName ());
22+ System .out .println (ans .gettCountry ());
23+ System .out .println (ans .gettRun ());
24+ }
25+ else
26+ {
27+ System .out .println ("No team is found from the given country and run" );
28+ }
29+ }
30+ public static Team findPlayer (Team [] t , int r , String c )
31+ {
32+ for (int i = 0 ; i < t .length ; i ++) {
33+ if (t [i ].gettCountry ().equalsIgnoreCase (c ) && t [i ].gettRun ()>r )
34+ {
35+ return t [i ];
36+ }
37+ }
38+ return null ;
39+ }
40+ }
41+ class Team
42+ {
43+ private int tId ;
44+ private String tName ;
45+ private String tCountry ;
46+ private int tRun ;
47+ public Team (int tId , String tName , String tCountry , int tRun ) {
48+ this .tId = tId ;
49+ this .tName = tName ;
50+ this .tCountry = tCountry ;
51+ this .tRun = tRun ;
52+ }
53+ public int gettId () {
54+ return tId ;
55+ }
56+ public void settId (int tId ) {
57+ this .tId = tId ;
58+ }
59+ public String gettName () {
60+ return tName ;
61+ }
62+ public void settName (String tName ) {
63+ this .tName = tName ;
64+ }
65+ public String gettCountry () {
66+ return tCountry ;
67+ }
68+ public void settCountry (String tCountry ) {
69+ this .tCountry = tCountry ;
70+ }
71+ public int gettRun () {
72+ return tRun ;
73+ }
74+ public void settRun (int tRun ) {
75+ this .tRun = tRun ;
76+ }
77+
78+ }
0 commit comments