解题思路:
注意事项:
参考代码:
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
import java.util.Stack;
class Node{
int l,r,c;
public Node(int l, int r, int c) {
this.l = l;
this.r = r;
this.c = c;
}
}
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Stack<Node> stack = new Stack<Node>();
int n = sc.nextInt();
int m = sc.nextInt();
for(int i=0; i<m; i++){
stack.add(new Node(sc.nextInt(), sc.nextInt(), sc.nextInt()));
}
int x = sc.nextInt();
while(!stack.isEmpty()){
Node t = stack.pop();
if(x>=t.l && x<=t.r){
System.out.println(t.c);
return;
}
}
System.out.println(0);
}
}
0.0分
0 人评分
【计算两点间的距离】 (C语言代码)浏览:1121 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:738 |
C语言考试练习题_排列 (C语言代码)浏览:719 |
剪刀石头布 (C语言代码)浏览:1748 |
1126题解浏览:584 |
关于float,double变量的几点说明浏览:1810 |
1054题解浏览:463 |
妹子杀手的故事 (C语言代码)浏览:1050 |
C语言程序设计教程(第三版)课后习题8.2 (C语言代码)浏览:1031 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:550 |