1.

import java.util.Scanner;


/**
* Angewandte Mathematik, SS11
* Problem: 11608 - No Problem
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=78&page=show_problem&problem=2655
*
* @author Benedikt Z¨nnchen
* @author Erik Wenzel
* @version 1.0, 03/24/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.348
*/

public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int[] problems = new int[13];
int source;
int requirements;
int counter = 1;

while(sc.hasNextInt() && (problems[0] = sc.nextInt()) >= 0)
{
source = 0;
System.out.println("Case "+counter+":");
int j = 1;
while(sc.hasNextInt() && j < problems.length)
{
problems[j] = sc.nextInt();
j++;
}

int i = 0;
while(sc.hasNextInt() && i < problems.length-1)
{
requirements = sc.nextInt();
source += problems[i];
if(requirements > source)
{
System.out.println("No problem. :(");
}
else
{
System.out.println("No problem! :D");
source -= requirements;
}
i++;
}
counter++;
}


}
}





---------------------------------------------------------------------------------------------------------

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;
}
}