This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int n; | |
scanf("%d",&n); | |
while(n--) | |
{ | |
long long int x[1000]= {0},m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int n; | |
while (1) { | |
scanf("%d", &n); | |
if (n == 0) | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void print_answer(long long int, int); | |
int main() | |
{ | |
long long int input, count = 1; | |
while(scanf("%lld", &input) != EOF) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void checkforpockets(char [102][102], int, int, int, int); | |
int main() | |
{ | |
int rows, columns; | |
while(scanf("%d %d", &rows, &columns) != EOF && rows != 0 && columns != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* | |
Write a program myadd such that user in command line type myadd n1 [n2] [n3]…. | |
The program compute the sum of these number. | |
Basic requirement: the numbers are 32-bit integer | |
bonus: the numbers may have different types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
//clang -lm w4a.c -o w4a | |
int compare(const void *a, const void *b) | |
{ | |
return *(int *)a - *(int *)b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() | |
{ | |
int test_cases; | |
while(scanf("%d", &test_cases) != EOF) { | |
getchar(); | |
while(test_cases--) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int compare(const void *a, const void *b) | |
{ | |
return *(int *)a - *(int *)b; | |
} | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* | |
carry = add1%10 + add2%10 + carry; | |
carry /= 10; | |
add1 /= 10; | |
add2 /= 10; | |
if( carry ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() | |
{ | |
char input[1010]; | |
while(fgets(input, 1010, stdin) && !(input[0] == '0' && input[1] == '\n')) { /*WTF, the '\n' is required!!*/ | |
int i, len = strlen(input) - 1, sum_odd = 0, sum_even = 0; | |
input[len] = '\0'; |