Skip to content

Instantly share code, notes, and snippets.

@nbarnold01
Created November 9, 2015 14:28
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 nbarnold01/4a86e55a7bf87ceb3e22 to your computer and use it in GitHub Desktop.
Save nbarnold01/4a86e55a7bf87ceb3e22 to your computer and use it in GitHub Desktop.
//
// main.m
// Angry Professor
//
// Created by Nathan Arnold on 11/9/15.
// Copyright © 2015 Nathan Arnold. All rights reserved.
//
#import <Foundation/Foundation.h>
void processTestCase() {
int numberOfStudents = 0;
int numberOfRequiredStudents = 0;
scanf("%d %d", &numberOfStudents, &numberOfRequiredStudents);
int studentsPresent = 0;
for (int i =0; i< numberOfStudents; i++) {
int arrivalTime = 0;
scanf("%d",&arrivalTime);
if (arrivalTime <= 0){
//Student enters before class starts
studentsPresent ++;
}
}
if (studentsPresent >= numberOfRequiredStudents){
printf("NO\n");
} else {
printf("YES\n");
}
}
int main(int argc, const char * argv[]) {
// @autoreleasepool {
// insert code here...
// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
int numberOfTestCases = 0;
scanf("%d", &numberOfTestCases);
for (int i = 0; i < numberOfTestCases; i++){
processTestCase();
}
// }
// [pool drain];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment