Skip to content

Instantly share code, notes, and snippets.

@kik
Created April 15, 2012 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kik/2391806 to your computer and use it in GitHub Desktop.
Save kik/2391806 to your computer and use it in GitHub Desktop.
GCJ 2012 Qual B
#include <iostream>
using namespace std;
int main()
{
int T;
cin >> T;
for (int cas = 1; cas <= T; cas++) {
int N, S, p;
cin >> N >> S >> p;
int res = 0;
for (int i = 0; i < N; i++) {
int ti;
cin >> ti;
if (ti >= 3 * p) res++;
else if (ti >= 3 * p - 2 && p - 1 >= 0) res++;
else if (ti >= 3 * p - 4 && p - 2 >= 0 && S > 0) res++, S--;
}
cout << "Case #" << cas << ": " << res << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment