Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package amanda_tian_cccl1_test2;
- import java.util.Scanner;
- import java.util.Stack;
- /**
- *
- * @author amand
- */
- public class ItsColdHere {
- public static void main(String[]args){
- Scanner input = new Scanner(System.in);
- String ncity = "";
- int temperature = 0;
- int min = 200;
- int count = 0;
- Stack<Integer> temp = new Stack<Integer>();
- Stack<String> city = new Stack<String>();
- do{
- ncity = input.next();
- temperature = input.nextInt();
- city.push(ncity);
- temp.push(temperature);
- }
- while(!city.peek().equals("Waterloo"));
- if(temp.peek() < min){
- min = temp.peek();
- temp.pop();
- count++;
- }
- for(int i = 0; i < city.size() - count + 1; i++){
- city.pop();
- }
- System.out.print(city.peek());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement