解题思路:
注意事项:
参考代码:
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 人评分
人见人爱A+B (C语言代码)浏览:789 |
【偶数求和】 (C++代码)浏览:709 |
C语言训练-计算一个整数N的阶乘 (C语言代码)浏览:936 |
人见人爱A+B (C语言代码)浏览:629 |
剪刀石头布 (C语言代码)不知道怎么直接在scanf中用枚举变量浏览:1318 |
本人酷爱递归实现很多问题,这里也是浏览:557 |
简单的a+b (C语言代码)浏览:632 |
WU-C语言程序设计教程(第三版)课后习题11.11 (C++代码)(想学链表的可以看看)浏览:1358 |
钟神赛车 (C语言代码)浏览:602 |
找出最长的字符串来 (C语言代码)浏览:1771 |