Skip to content

Instantly share code, notes, and snippets.

@TheoKlein
Created May 15, 2016 03:24
Show Gist options
  • Select an option

  • Save TheoKlein/eb13617774b26ca2ddae0eabe6f9ca21 to your computer and use it in GitHub Desktop.

Select an option

Save TheoKlein/eb13617774b26ca2ddae0eabe6f9ca21 to your computer and use it in GitHub Desktop.
ZeroJudge d392
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
char input[100000];
while(gets(input) != NULL){
long int sum = 0;
char *ptr;
ptr = strtok(input , " ");
while(ptr != NULL){
sum += atoi(ptr);
ptr = strtok(NULL , " ");
}
printf("%ld\n",sum);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment