1.

/**
* Angewandte Mathematik, ACM Training 2009
* ACM Problem #11608 - No Problem
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=78&page=show_problem&problem=2655
* @author Miesel Christoph
* @author Evgeni Pavlidis
* @version 1.0 11.08.2009
*
* Status : Accepted
* Runtime: 0.284
*/

import java.util.*;

public class NoProblem
{
private static int[] tmp = new int[12];

public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int S, created, required,was;
int cases = 0;

while((S = sc.nextInt()) >= 0)
{
cases++;
System.out.println("Case "+cases+":");

for(int i = 0; i < 12; i++)
{
tmp[i] = sc.nextInt();
}
//System.out.println(Arrays.toString(tmp));

created = S;
for(int i = 0; i < 12; i++)
{
if(i > 0)
{

was = sc.nextInt();
created += tmp[i-1];
created -= was;

}
else
{
was = sc.nextInt();
created -= was;
}
if(created >= 0)
{
System.out.println("No problem! :D");
}
else
{
created += was;
System.out.println("No problem. :(");
}
}

}
}
}

2.

/**
* ACM Training 2009
* ACM Problem #11608 No Problem
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2655
*
* @author Felix Dietrich
* @version 1.0, 08/11/2009
*
* Methode: Comparison
* Status : Accepted
* Runtime: 0.172
*/


import java.io.*;
import java.util.StringTokenizer;


public class Main
{
public static void main(String... strings ) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int caseNumber = 1;
StringTokenizer newProblems;
StringTokenizer newContests;
String input = null;

while((input=br.readLine()) != null)
{
if(input.length() < 1)
continue;

int problems = Integer.parseInt(input.trim());
if(problems < 0)
return;

newProblems = new StringTokenizer(br.readLine());
newContests = new StringTokenizer(br.readLine());

int contests = 0;
System.out.println("Case " + (caseNumber) + ":");
caseNumber++;
for(int i=0; i<12; i++)
{
contests = Integer.parseInt(newContests.nextToken());

// if there are too little problems, we cant make a contest!
if(problems < contests)
System.out.println("No problem. :(");
else
{
problems = Math.max(0, problems-contests);
System.out.println("No problem! :D");
}

problems += Integer.parseInt(newProblems.nextToken());
}
}
}
}