50100. Impact Factor

難度:4.2/5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "compute.h"
#define MAXP 1024

// typedef struct {
// char journalName[64];
// int numCitedPaper;
// int citedPaperIndex[1024];
// } paper;

typedef struct {
char* name;
int publish_cnt;
int num_cited;
} s_helper;

s_helper helper[1024];

char* name_arr[1024];
int publish_cnt[1024] = {0};
int cnt = 0;

int num_cited[1024] = {0};

int find(char* name){
for(int i = 0; i < cnt; i++){
if(strcmp(name, name_arr[i]) == 0) return i;
}
return -1;
}

int cmp(const void* a, const void* b){
return strcmp(((s_helper*)a)->name, ((s_helper*)b)->name);
}

void compute(paper p[], int n){
for(int i = 0; i < n; i++){
int rtv = find(p[i].journalName);
if(rtv != -1){
publish_cnt[rtv]++;
}
else{
name_arr[cnt] = p[i].journalName;
publish_cnt[cnt] = 1;
cnt++;
}
}

for(int i = 0; i < n; i++){
int cited_num = p[i].numCitedPaper;
for(int j = 0; j < cited_num; j++){
int cite_id = p[i].citedPaperIndex[j];
num_cited[find(p[cite_id].journalName)]++;
}
}

for(int i = 0; i < cnt; i++){
helper[i].name = name_arr[i];
helper[i].publish_cnt = publish_cnt[i];
helper[i].num_cited = num_cited[i];
}
qsort(helper, cnt, sizeof(s_helper), cmp);

for(int i = 0; i < cnt; i++){
printf("%s %d/%d\n", helper[i].name, helper[i].num_cited, helper[i].publish_cnt);
}
return;
}

C

50100. Impact Factor
https://aaronlin1229.github.io/judgegirl_50100/
Author
Akizumi
Posted on
July 17, 2023
Licensed under