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-19 15:47:24
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
871712022211480马耳东风Wrong Answer
1192KB
5ms
C175 bytes2023-04-11 21:23:42
871562022211480马耳东风Accepted
1192KB
8ms
C1324 bytes2023-04-11 21:16:08
871542022211480马耳东风Wrong Answer
1192KB
6ms
C1324 bytes2023-04-11 21:15:49
724402022211480马耳东风Accepted
1072KB
9ms
C2183 bytes2023-03-29 01:28:57
724352022211480马耳东风Wrong Answer
1072KB
13ms
C1171 bytes2023-03-29 01:23:26
724312022211480马耳东风Wrong Answer
1072KB
12ms
C774 bytes2023-03-29 01:10:32
724292022211480马耳东风Wrong Answer
1068KB
13ms
C717 bytes2023-03-29 01:05:18
724282022211480马耳东风Wrong Answer
1072KB
10ms
C735 bytes2023-03-29 01:03:56
724262022211480马耳东风Wrong Answer
1072KB
11ms
C735 bytes2023-03-29 01:02:50
724242022211480马耳东风Wrong Answer
1072KB
12ms
C734 bytes2023-03-29 01:00:07
724232022211480马耳东风Wrong Answer
1068KB
11ms
C736 bytes2023-03-29 00:58:42
724222022211480马耳东风Wrong Answer
1068KB
8ms
C739 bytes2023-03-29 00:48:01
724212022211480马耳东风Wrong Answer
1068KB
11ms
C738 bytes2023-03-29 00:44:28
724192022211480马耳东风Wrong Answer
1072KB
10ms
C735 bytes2023-03-29 00:37:26
724182022211480马耳东风Wrong Answer
1072KB
12ms
C736 bytes2023-03-29 00:37:13
724172022211480马耳东风Wrong Answer
1072KB
9ms
C730 bytes2023-03-29 00:36:50
724152022211480马耳东风Wrong Answer
1072KB
13ms
C736 bytes2023-03-29 00:28:58
723892022211480马耳东风Accepted
1192KB
10ms
C1016 bytes2023-03-28 23:52:30
723792022211480马耳东风Wrong Answer
1192KB
10ms
C977 bytes2023-03-28 23:43:16
723772022211480马耳东风Wrong Answer
1192KB
13ms
C994 bytes2023-03-28 23:42:54
722012022211480马耳东风Accepted
1196KB
9ms
C4444 bytes2023-03-28 22:28:07
721902022211480马耳东风Output Limit Exceed
1196KB
10ms
C4469 bytes2023-03-28 22:24:19
721592022211480马耳东风Wrong Answer
1196KB
11ms
C4454 bytes2023-03-28 22:15:47
721582022211480马耳东风Wrong Answer
1196KB
11ms
C4448 bytes2023-03-28 22:15:24
721562022211480马耳东风Wrong Answer
1196KB
11ms
C4442 bytes2023-03-28 22:14:42
721212022211480马耳东风Wrong Answer
1196KB
10ms
C4447 bytes2023-03-28 22:00:53
720982022211480马耳东风Wrong Answer
1192KB
12ms
C3203 bytes2023-03-28 21:53:52
720902022211480马耳东风Wrong Answer
1192KB
11ms
C3215 bytes2023-03-28 21:51:48
720872022211480马耳东风Wrong Answer
1192KB
12ms
C3213 bytes2023-03-28 21:51:22
720802022211480马耳东风Wrong Answer
1192KB
10ms
C3210 bytes2023-03-28 21:49:13
720782022211480马耳东风Wrong Answer
1192KB
10ms
C3214 bytes2023-03-28 21:48:59
720672022211480马耳东风Wrong Answer
1192KB
9ms
C3210 bytes2023-03-28 21:47:20
720612022211480马耳东风Runtime Error
1192KB
9ms
C3220 bytes2023-03-28 21:46:45
720392022211480马耳东风Wrong Answer
1192KB
12ms
C2843 bytes2023-03-28 21:36:43
720372022211480马耳东风Wrong Answer
1192KB
10ms
C2845 bytes2023-03-28 21:36:31
720342022211480马耳东风Wrong Answer
1192KB
10ms
C2851 bytes2023-03-28 21:35:34
719822022211480马耳东风Wrong Answer
1192KB
11ms
C2441 bytes2023-03-28 21:19:13
719652022211480马耳东风Wrong Answer
1192KB
11ms
C2432 bytes2023-03-28 21:15:15
719292022211480马耳东风Wrong Answer
1192KB
10ms
C2267 bytes2023-03-28 21:03:39
718382022211480马耳东风Accepted
1192KB
11ms
C1324 bytes2023-03-28 20:13:01
718372022211480马耳东风Wrong Answer
1192KB
10ms
C1326 bytes2023-03-28 20:10:20
718352022211480马耳东风Wrong Answer
1192KB
10ms
C1326 bytes2023-03-28 20:09:52
718342022211480马耳东风Wrong Answer
1192KB
11ms
C1325 bytes2023-03-28 20:09:20
718322022211480马耳东风Wrong Answer
1192KB
12ms
C1324 bytes2023-03-28 20:08:07
718302022211480马耳东风Wrong Answer
1192KB
10ms
C1323 bytes2023-03-28 20:06:32
718292022211480马耳东风Wrong Answer
1192KB
12ms
C1323 bytes2023-03-28 20:06:01
718192022211480马耳东风Wrong Answer
1192KB
13ms
C1324 bytes2023-03-28 20:01:03
718052022211480马耳东风Wrong Answer
1192KB
12ms
C1290 bytes2023-03-28 19:54:40
715522022211480马耳东风Wrong Answer
1192KB
9ms
C1255 bytes2023-03-28 16:23:29