CONTEST ID : 1128 - 2023春-计导课设-9-12班-文件练习

文件操作练习。注意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:25:35
Finished

STATUS : End    OPEN : Private
Start Time : 2023-03-20 20: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
755832022211331mjssssssTime Limit Exceed
1196KB
8815ms
C1765 bytes2023-03-30 23:26:37
755812022211331mjssssssWrong Answer
1196KB
10ms
C1765 bytes2023-03-30 23:26:23
755802022211331mjssssssWrong Answer
1196KB
9ms
C1765 bytes2023-03-30 23:26:09
755312022211331mjssssssAccepted
1196KB
12ms
C1765 bytes2023-03-30 23:08:28
726662022211331mjssssssAccepted
1068KB
11ms
C3419 bytes2023-03-29 13:15:13
726652022211331mjssssssAccepted
1068KB
10ms
C3431 bytes2023-03-29 13:14:38
726642022211331mjssssssAccepted
1068KB
10ms
C3431 bytes2023-03-29 13:14:09
726632022211331mjssssssWrong Answer
1068KB
10ms
C3430 bytes2023-03-29 13:13:48
726622022211331mjssssssWrong Answer
1068KB
9ms
C3430 bytes2023-03-29 13:13:38
726612022211331mjssssssWrong Answer
1068KB
12ms
C3430 bytes2023-03-29 13:13:24
726582022211331mjssssssWrong Answer
1068KB
11ms
C3430 bytes2023-03-29 13:11:49
726572022211331mjssssssAccepted
1068KB
11ms
C3431 bytes2023-03-29 13:11:28
726562022211331mjssssssWrong Answer
1068KB
10ms
C3430 bytes2023-03-29 13:10:03
726552022211331mjssssssWrong Answer
1068KB
10ms
C3430 bytes2023-03-29 13:09:39
726542022211331mjssssssWrong Answer
1068KB
10ms
C3430 bytes2023-03-29 13:08:53
726532022211331mjssssssWrong Answer
1068KB
11ms
C3405 bytes2023-03-29 13:04:15
726452022211331mjssssss*Accepted65306
1068KB
11ms
C2086 bytes2023-03-29 12:52:14
726442022211331mjssssssWrong Answer
1068KB
10ms
C3397 bytes2023-03-29 12:47:46
710422022211331mjssssssAccepted
1200KB
11ms
C2916 bytes2023-03-27 22:38:16
710332022211331mjssssss*Accepted65248
1200KB
10ms
C2086 bytes2023-03-27 22:31:28
710322022211331mjssssssOutput Limit Exceed
1200KB
8ms
C2917 bytes2023-03-27 22:31:15
710252022211331mjssssssOutput Limit Exceed
1200KB
10ms
C2933 bytes2023-03-27 22:27:19
706952022211331mjssssssOutput Limit Exceed
1200KB
10ms
C2791 bytes2023-03-27 20:00:01
702752022211331mjssssssAccepted
1196KB
11ms
C1672 bytes2023-03-27 11:49:06
702732022211331mjssssssWrong Answer
1196KB
12ms
C1672 bytes2023-03-27 11:48:19
702682022211331mjssssssWrong Answer
1196KB
10ms
C1678 bytes2023-03-27 11:45:41
702672022211331mjssssss*Accepted65117
1196KB
10ms
C1605 bytes2023-03-27 11:44:27
702662022211331mjssssssWrong Answer
1196KB
12ms
C1672 bytes2023-03-27 11:44:14
702582022211331mjssssssRuntime Error
1200KB
12ms
C1649 bytes2023-03-27 11:31:37
702572022211331mjssssssRuntime Error
1200KB
7ms
C1656 bytes2023-03-27 11:28:36
699892022211331mjssssssAccepted
1200KB
10ms
C2248 bytes2023-03-26 22:20:44
699882022211331mjssssssWrong Answer
1200KB
11ms
C2283 bytes2023-03-26 22:19:20
699872022211331mjssssssWrong Answer
1200KB
11ms
C2238 bytes2023-03-26 22:15:05
699842022211331mjssssssAccepted
1200KB
11ms
C2301 bytes2023-03-26 22:09:03
699822022211331mjssssssWrong Answer
1200KB
13ms
C2320 bytes2023-03-26 22:07:48
699782022211331mjssssssAccepted
1200KB
12ms
C2258 bytes2023-03-26 22:04:08
699752022211331mjssssssWrong Answer
1200KB
12ms
C2207 bytes2023-03-26 22:02:36
699722022211331mjssssss*Accepted64792
1192KB
11ms
C2017 bytes2023-03-26 22:00:41
699682022211331mjssssssWrong Answer
1192KB
10ms
C2004 bytes2023-03-26 21:59:48
699652022211331mjssssssWrong Answer
1192KB
10ms
C2131 bytes2023-03-26 21:57:29
699552022211331mjssssssWrong Answer
1192KB
11ms
C2157 bytes2023-03-26 21:52:34
699542022211331mjssssssCompile Error
0KB
0ms
C2159 bytes2023-03-26 21:52:14
699522022211331mjssssssWrong Answer
1192KB
13ms
C2206 bytes2023-03-26 21:50:03
699432022211331mjssssssWrong Answer
1192KB
11ms
C2204 bytes2023-03-26 21:47:37
699422022211331mjssssssWrong Answer
1192KB
10ms
C2204 bytes2023-03-26 21:46:33
699342022211331mjssssssWrong Answer
1200KB
12ms
C2232 bytes2023-03-26 21:42:43
699282022211331mjssssssWrong Answer
1200KB
10ms
C2221 bytes2023-03-26 21:40:02
699172022211331mjssssssWrong Answer
1200KB
12ms
C2111 bytes2023-03-26 21:26:34
698722022211331mjssssss*Accepted64792
1192KB
12ms
C2042 bytes2023-03-26 21:06:25
698312022211331mjssssssWrong Answer
1200KB
10ms
C2178 bytes2023-03-26 20:33:03