CONTEST ID : 1134 - 2023春-计导课设-转专业-文件练习

文件操作练习。注意B题的读取不能用struct。
D和谐词汇的题,输入是若干字符串,不以空行结束. 所以 gets(line);    while (line[0]){... gets(line);}就会导致时间超限,代码在等空行,但in数据没有。应改为while(gets(line))。
/*文件练习B题. 读取一个包含7类数据的二进制文件,找到指定部分内容,并正确解释输出。
思路分析:主体框架是读取二进制文件,   while (fread(buffer, buffLen, 1, infile) > 0){...}
因为二进制文件的记录长度是固定的,所以可以计算每条记录的长度,使用fseek直接定位到指定段;
所以用fseek的话,实际只需要读一次就可以。
但是这道题的特殊之处在于,一条记录内是顺序包含7种类型数据,是分多次写入,因此带来的麻烦是
虽然每段内容结构相同,但不能用struct进行整块读取。
因为struct的成员之间有内存空隙;除非源文件本身是用struct格式写入才行。
经测试,struct {含7种变量和数组}的长度为200, 但实际7种变量和数组的总长要小一些.
因此,可以直接定位,但必须分别读取,写出的代码冗长,且容易在变量名和输出格式上出错。
一种办法是:按总长度整块读取到字节数组中,然后再逐个定义对应类型的指针,按间接访问就可格式化解释输出。
例: char buffer[LEN];
int i=0; printf("%c\n", buffer[i]); i++;
short * hdPtr=&buffer[i];  printf("%hd\n", *hdPtr); i+=sizeof(short);
*/


SERVER TIME : 2025-09-20 20:16:27
Finished

STATUS : End    OPEN : Private
Start Time : 2023-03-24 12:00:00
End Time : 2023-05-04 23:59:00


Problem ID    User    Language    Result   

RunID User Nick Name Problem ID Result Memory Time Language Code Length Submit Time
1016202022212379visirWrong Answer
1196KB
11ms
C5023 bytes2023-05-03 21:49:30
1016192022212379visirRuntime Error
1196KB
9ms
C5050 bytes2023-05-03 21:49:18
1016152022212379visirWrong Answer
1196KB
12ms
C5023 bytes2023-05-03 21:48:00
1016082022212379visirWrong Answer
1196KB
10ms
C5023 bytes2023-05-03 21:42:51
1016072022212379visirRuntime Error
1196KB
9ms
C5050 bytes2023-05-03 21:42:38
1016002022212010蔡正舟Accepted
1192KB
14ms
C1349 bytes2023-05-03 21:36:41
1015762022212442范兼玮Wrong Answer
1192KB
9ms
C913 bytes2023-05-03 21:15:57
1015722022212442范兼玮Output Limit Exceed
1192KB
9ms
C1003 bytes2023-05-03 21:12:03
1015702022212442范兼玮Output Limit Exceed
1192KB
10ms
C1002 bytes2023-05-03 21:10:15
1015692022212442范兼玮Output Limit Exceed
1192KB
8ms
C998 bytes2023-05-03 21:08:59
1015642022212442范兼玮Wrong Answer
1192KB
6ms
C1001 bytes2023-05-03 21:08:11
1015622022212442范兼玮Wrong Answer
1192KB
6ms
C999 bytes2023-05-03 21:06:02
1015422022212379visirWrong Answer
1196KB
12ms
C4826 bytes2023-05-03 20:39:07
1015402022212379visirRuntime Error
1196KB
9ms
C4853 bytes2023-05-03 20:38:51
1015252022212379visirWrong Answer
1196KB
10ms
C5338 bytes2023-05-03 20:16:56
1015232022212379visirRuntime Error
1196KB
8ms
C5365 bytes2023-05-03 20:16:31
10150620192114052019211405*Accepted64994
1068KB
11ms
C2060 bytes2023-05-03 19:53:56
10150520192114052019211405*Accepted65025
1192KB
11ms
C2029 bytes2023-05-03 19:53:11
10150420192114052019211405*Accepted64826
1192KB
11ms
C2794 bytes2023-05-03 19:52:02
10150320192114052019211405Compile Error
0KB
0ms
C3084 bytes2023-05-03 19:50:47
10150020192114052019211405*Accepted64826
1192KB
13ms
C2781 bytes2023-05-03 19:48:25
1014532022212247马梓洋Wrong Answer
1192KB
10ms
C1692 bytes2023-05-03 19:02:37
1014502022212247马梓洋Time Limit Exceed
1192KB
1769ms
C2141 bytes2023-05-03 18:59:49
1014472022212247马梓洋Wrong Answer
1192KB
12ms
C1692 bytes2023-05-03 18:57:37
1014422022212247马梓洋Wrong Answer
1192KB
12ms
C1696 bytes2023-05-03 18:55:39
1014322022212247马梓洋Wrong Answer
1192KB
11ms
C1694 bytes2023-05-03 18:49:54
1014282022212247马梓洋Wrong Answer
1192KB
11ms
C1692 bytes2023-05-03 18:43:52
1014172022212458谭超Compile Error
0KB
0ms
C1099 bytes2023-05-03 18:33:25
10141020192114052019211405Compile Error
0KB
0ms
C3076 bytes2023-05-03 18:27:32
10140820192114052019211405Compile Error
0KB
0ms
C2277 bytes2023-05-03 18:26:00
10140420192114052019211405*Accepted64996
1192KB
19ms
C4101 bytes2023-05-03 18:20:12
1014032022212458谭超Wrong Answer
1196KB
10ms
C1033 bytes2023-05-03 18:16:49
1013992022212458谭超Wrong Answer
1196KB
10ms
C1033 bytes2023-05-03 18:11:01
1013952022212458谭超Compile Error
0KB
0ms
C1027 bytes2023-05-03 18:06:02
1013912022212458谭超Compile Error
0KB
0ms
C1040 bytes2023-05-03 18:02:13
1013902022212458谭超Compile Error
0KB
0ms
C1030 bytes2023-05-03 18:01:26
1013882022212458谭超Compile Error
0KB
0ms
C1035 bytes2023-05-03 17:59:18
1013842022212458谭超Compile Error
0KB
0ms
C1039 bytes2023-05-03 17:53:59
1012372022212414greed106*Accepted65336
1068KB
13ms
C925 bytes2023-05-03 14:13:50
1012342022212414greed106*Accepted65107
1192KB
11ms
C2347 bytes2023-05-03 14:11:08
1012332022212414greed106*Accepted65117
1196KB
11ms
C1607 bytes2023-05-03 14:07:35
1012322022212414greed106*Accepted64792
1192KB
12ms
C1913 bytes2023-05-03 14:06:30
1012202022212458谭超Accepted
1196KB
59ms
C2901 bytes2023-05-03 13:41:03
1012172022212458谭超Wrong Answer
1196KB
57ms
C2900 bytes2023-05-03 13:38:06
1012102022212458谭超Wrong Answer
1196KB
54ms
C2882 bytes2023-05-03 13:29:43
1012092022212458谭超Wrong Answer
1196KB
59ms
C2982 bytes2023-05-03 13:28:32
1010672022212247马梓洋*Accepted64994
1068KB
9ms
C1907 bytes2023-05-03 09:33:58
1008212022212247马梓洋Wrong Answer
1068KB
10ms
C1038 bytes2023-05-03 00:16:03
1007432022210177牛梓帆Accepted
1192KB
11ms
C2618 bytes2023-05-02 23:14:10
1006822022212379visirWrong Answer
1196KB
14ms
C5749 bytes2023-05-02 22:30:11