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 18:35:47
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
8400820222112362022211236*Accepted68113
1068KB
10ms
C813 bytes2023-04-06 19:53:03
8400720222112362022211236*Accepted65336
1068KB
13ms
C821 bytes2023-04-06 19:52:12
8400620222112362022211236*Accepted65336
1068KB
12ms
C884 bytes2023-04-06 19:47:48
8400520222112362022211236Runtime Error
1068KB
11ms
C882 bytes2023-04-06 19:47:30
8400420222112362022211236Compile Error
0KB
0ms
C884 bytes2023-04-06 19:46:50
8399120222112362022211236Wrong Answer
1196KB
10ms
C2363 bytes2023-04-06 19:22:44
8399020222112362022211236Accepted
1196KB
11ms
C2386 bytes2023-04-06 19:20:37
8398820222112362022211236Compile Error
0KB
0ms
C2385 bytes2023-04-06 19:20:19
8398620222112362022211236Wrong Answer
1196KB
13ms
C2239 bytes2023-04-06 19:12:45
8398520222112362022211236Wrong Answer
1196KB
11ms
C2239 bytes2023-04-06 19:12:24
8398420222112362022211236Compile Error
0KB
0ms
C2245 bytes2023-04-06 19:11:45
8397920222112362022211236*Accepted65047
1196KB
12ms
C2931 bytes2023-04-06 19:06:11
8397720222112362022211236Wrong Answer
1196KB
12ms
C2234 bytes2023-04-06 19:03:41
8397520222112362022211236Compile Error
0KB
0ms
C2258 bytes2023-04-06 19:02:29
8397020222112362022211236Wrong Answer
1196KB
12ms
C2108 bytes2023-04-06 18:57:54
8396920222112362022211236Wrong Answer
1196KB
10ms
C2172 bytes2023-04-06 18:57:35
8396620222112362022211236Wrong Answer
1196KB
11ms
C2147 bytes2023-04-06 18:55:04
8396520222112362022211236Wrong Answer
1196KB
12ms
C2152 bytes2023-04-06 18:53:34
8298120222112362022211236Wrong Answer
1196KB
12ms
C2152 bytes2023-04-05 17:17:29
8297920222112362022211236Wrong Answer
1196KB
11ms
C2140 bytes2023-04-05 17:16:57
8297720222112362022211236Wrong Answer
1196KB
12ms
C2150 bytes2023-04-05 17:16:36
8297420222112362022211236Wrong Answer
1196KB
14ms
C2097 bytes2023-04-05 17:15:08
8297020222112362022211236Time Limit Exceed
1196KB
7003ms
C2107 bytes2023-04-05 17:12:26
8296520222112362022211236Wrong Answer
1196KB
12ms
C2067 bytes2023-04-05 17:10:31
8296120222112362022211236Wrong Answer
1196KB
10ms
C2023 bytes2023-04-05 17:08:12
8295820222112362022211236Compile Error
0KB
0ms
C1489 bytes2023-04-05 17:07:33
8295420222112362022211236Output Limit Exceed
1200KB
12ms
C2679 bytes2023-04-05 17:05:46
8294720222112362022211236Compile Error
0KB
0ms
C2276 bytes2023-04-05 17:03:44
8293720222112362022211236*Accepted65047
1196KB
10ms
C2851 bytes2023-04-05 17:01:34
8293220222112362022211236Output Limit Exceed
1200KB
10ms
C1657 bytes2023-04-05 17:00:22
8292720222112362022211236Output Limit Exceed
1200KB
11ms
C1657 bytes2023-04-05 16:58:07
8292420222112362022211236Output Limit Exceed
1200KB
11ms
C1657 bytes2023-04-05 16:57:38
8292320222112362022211236Output Limit Exceed
1200KB
11ms
C1643 bytes2023-04-05 16:56:33
8292120222112362022211236Output Limit Exceed
1200KB
14ms
C1639 bytes2023-04-05 16:55:38
8291320222112362022211236Output Limit Exceed
1200KB
10ms
C1648 bytes2023-04-05 16:54:24
8290920222112362022211236Output Limit Exceed
1200KB
10ms
C1632 bytes2023-04-05 16:53:13
7536420222112362022211236*Accepted65114
1196KB
11ms
C1511 bytes2023-03-30 22:17:59
7536220222112362022211236Compile Error
0KB
0ms
C1513 bytes2023-03-30 22:17:14
7511720222112362022211236Accepted
1196KB
10ms
C1678 bytes2023-03-30 21:10:51
7511220222112362022211236Wrong Answer
1196KB
10ms
C1677 bytes2023-03-30 21:10:14
7509320222112362022211236Wrong Answer
1196KB
12ms
C1609 bytes2023-03-30 21:07:36
7508720222112362022211236Wrong Answer
1196KB
12ms
C1588 bytes2023-03-30 21:06:58
7508520222112362022211236Compile Error
0KB
0ms
C1587 bytes2023-03-30 21:06:35
7507720222112362022211236Wrong Answer
1196KB
12ms
C1549 bytes2023-03-30 21:04:10
7506520222112362022211236Wrong Answer
1196KB
10ms
C1545 bytes2023-03-30 21:02:35
7505720222112362022211236Wrong Answer
1196KB
9ms
C1615 bytes2023-03-30 21:01:10
7505520222112362022211236Wrong Answer
1196KB
10ms
C1616 bytes2023-03-30 21:00:54
7504720222112362022211236Wrong Answer
1196KB
14ms
C1616 bytes2023-03-30 20:59:50
7504320222112362022211236Wrong Answer
1196KB
11ms
C1617 bytes2023-03-30 20:59:09
7504120222112362022211236Wrong Answer
1196KB
7ms
C1621 bytes2023-03-30 20:58:34