TopCoder – SRM 503 – DIV II

  • 250 – ToastXRaspberry
public class ToastXRaspberry
{
	public int apply(int max, int n)
	{
		return (max+n -1)/max;
	}
}
  • 500 – ToastXToast
	public int bake(int[] u, int[] o)
	{
		Arrays.sort(u);
		Arrays.sort(o);

		if(u[u.length-1] < o[0])				                return 1;
		if(u[0] < o[0] && u[u.length-1] < o[o.length-1])	return 2;

		return -1;
	}
                // Inspired by Egor
Advertisements

2 thoughts on “TopCoder – SRM 503 – DIV II

  1. Islam Hamdi says:

    Nice one 🙂
    BTW i couldn’t solve the 500 😦

    • belbesy says:

      I couldn’t too 😀 😀 i prooved that it won’t exceed 2 and it appears in my code. 😀
      but after the contest i saw some codes for it and i liked this idea the most by Egor 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: