Submission #1295373
Source Code Expand
#define NMAX 50 #define IMAX 50 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> void input_data(int *n, char S[NMAX][IMAX+1]){ char buf[1000]; fgets(buf, sizeof(buf), stdin); *n = atoi(buf); int i; for(i=0;i<*n;i++){ fgets(buf, sizeof(buf), stdin); strcpy(S[i],buf); } } void count_char(char *S, int *num_char){ char *tmp = S; while(*tmp != '\0'){ if('a' <= *tmp && *tmp <= 'z'){ num_char[(int)(*tmp - 'a')]++; } tmp++; } } int main(void){ int n; int num_char[NMAX][26]; char S[NMAX][IMAX+1]; input_data(&n, S); int i,j; for(i=0;i<n;i++){ for(j=0;j<26;j++){ num_char[i][j] = 0; } count_char(S[i], num_char[i]); } int min; for(i=0;i<26;i++){ min=50; for(j=0;j<n;j++){ if(min > num_char[j][i]){ min = num_char[j][i]; } } if(min != 0){ for (j = 0; j < min;j++){ printf("%c",'a'+i); } } } printf("\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document |
User | Laurel152 |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 981 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘input_data’: ./Main.c:10:2: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(buf, sizeof(buf), stdin); ^ ./Main.c:14:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(buf, sizeof(buf), stdin); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, dec_half.txt, hand.txt, max.txt, max_10.txt, max_5.txt, maxx.txt, rnd.txt, single.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 128 KB |
0_001.txt | AC | 1 ms | 128 KB |
dec_half.txt | AC | 1 ms | 128 KB |
hand.txt | AC | 1 ms | 128 KB |
max.txt | AC | 1 ms | 128 KB |
max_10.txt | WA | 1 ms | 128 KB |
max_5.txt | WA | 1 ms | 128 KB |
maxx.txt | WA | 1 ms | 128 KB |
rnd.txt | AC | 1 ms | 128 KB |
single.txt | AC | 1 ms | 128 KB |