1.

/**
 *
 * Problem #11608 - NoProblem
 * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=1134

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted
 * Runtime: 0.308
 */
 
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        //aeilen einlesen

        Scanner sc = new Scanner(System.in);
        int c = 1;
       
        //aeilen durchlaufen
        for (int i = sc.nextInt(); i >= 0; i = sc.nextInt()){
       
            System.out.println("Case "+count+":");

            int[] monat = new int[12];
            for (int a = 0; a<12 ; ++a){
                monat[a] = sc.nextInt();
            }
           
            for (int a = 0; a<12 ; ++a){
                if (a != 0){

                    i = i + (monat[a-1]);
                }
                int nextInteger = sc.nextInt();
                if (i < nextInteger)
                    System.out.println("No problem. :(");

                else{
                    System.out.println("No problem! :D");
                    i = i - nextInteger;
                }
           
            }
            ++count;
        }

        return;
    }
}


2.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 11608 NoProblem
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=78&problem=2655&mosmsg=Submission+received+with+ID+7915490
*
* @author Barny Porcio
* @version 1.0, 04/22/2010
*
* Method : -
* Status : Accepted
* Runtime: 0.296
*/
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int counter = 1;
for (int i = sc.nextInt(); i >= 0; i = sc.nextInt()){
System.out.println("Case "+counter+":");
int[] aviable = new int[12];
for (int z = 0; z<12 ; ++z){
aviable[z] = sc.nextInt();
}

for (int z = 0; z<12 ; ++z){
if (z != 0){
i = i + (aviable[z-1]);
}
int need = sc.nextInt();
if (i < need)
System.out.println("No problem. :(");
else{
System.out.println("No problem! :D");
i = i - need;
}

}
++counter;
}
return;
}
}