
Untitled
By: a guest on
Sep 21st, 2012 | syntax:
None | size: 1.01 KB | hits: 17 | expires: Never
class Funcionario{
int num,horai,horaf;
Funcionario(int n, int i, int f){
num=n;
horai=i;
horaf=f;
}
public void checkTime(int newI, int newF){
if(horai>newI){
horai=newI;
}
if(horaf<newF){
horaf= newF;
}
}
}
public class Topas_A {
public static void main (String arg[]){
Scanner in = new Scanner(System.in);
int k=0;
int virusI, virusF;
int nFuncionarios;
int n,newI, newF;
virusI = in.nextInt();
virusF = in.nextInt();
nFuncionarios = in.nextInt();
Funcionario funcionarios[] = new Funcionario[100];
for(int i = 0; i<nFuncionarios; i++){
n = in.nextInt();
newI=in.nextInt();
newF= in.nextInt();
if(funcionarios[n-1]!= null){
funcionarios[n-1].checkTime(newI, newF);
}else{
funcionarios[n-1]= new Funcionario(n,newI,newF);
}
}
for(int i = 0; i<100;i++){
if(funcionarios[i]!=null){
if((funcionarios[i].horai<virusI) && (funcionarios[i].horaf > virusF)){
k++;
}
}
}
System.out.print(k);
}
}