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 23:37:03
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
882102022211270柳叶刀*Accepted65114
1200KB
12ms
C1868 bytes2023-04-13 11:39:27
882092022211270柳叶刀*Accepted65114
1200KB
9ms
C1868 bytes2023-04-13 11:39:01
882082022211270柳叶刀Output Limit Exceed
1200KB
12ms
C1859 bytes2023-04-13 11:38:22
882002022211270柳叶刀*Accepted65114
1196KB
13ms
C1666 bytes2023-04-13 11:31:04
881972022211270柳叶刀Runtime Error
1072KB
10ms
C1498 bytes2023-04-13 11:27:58
881962022211270柳叶刀Accepted
1072KB
13ms
C1498 bytes2023-04-13 11:27:20
881882022211270柳叶刀Wrong Answer
1072KB
12ms
C1481 bytes2023-04-13 11:22:48
881872022211270柳叶刀Runtime Error
1072KB
10ms
C1481 bytes2023-04-13 11:22:29
881792022211270柳叶刀Wrong Answer
1072KB
9ms
C1480 bytes2023-04-13 11:18:06
872352022211270柳叶刀Runtime Error
1068KB
10ms
C2052 bytes2023-04-11 22:30:36
871942022211270柳叶刀*Accepted65101
1068KB
13ms
C1931 bytes2023-04-11 21:57:36
871932022211270柳叶刀Runtime Error
1068KB
11ms
C2102 bytes2023-04-11 21:57:08
871922022211270柳叶刀Runtime Error
1068KB
9ms
C2157 bytes2023-04-11 21:55:42
853232022211270柳叶刀Accepted
1196KB
10ms
C2251 bytes2023-04-08 22:31:09
853222022211270柳叶刀Time Limit Exceed
1196KB
1770ms
C2254 bytes2023-04-08 22:29:48
853202022211270柳叶刀Time Limit Exceed
1196KB
1767ms
C2337 bytes2023-04-08 22:27:58
853182022211270柳叶刀Wrong Answer
1200KB
11ms
C3937 bytes2023-04-08 22:23:27
853162022211270柳叶刀Time Limit Exceed
1200KB
12ms
C4000 bytes2023-04-08 22:21:57
851812022211270柳叶刀Time Limit Exceed
1200KB
8ms
C3260 bytes2023-04-08 19:50:51
851582022211270柳叶刀Time Limit Exceed
1072KB
8ms
C1940 bytes2023-04-08 19:18:22
851542022211270柳叶刀Time Limit Exceed
1072KB
8ms
C1936 bytes2023-04-08 19:14:01
851212022211270柳叶刀Time Limit Exceed
1072KB
9ms
C1936 bytes2023-04-08 18:34:33
851142022211270柳叶刀Compile Error
0KB
0ms
C3964 bytes2023-04-08 18:21:41
851122022211270柳叶刀Time Limit Exceed
1072KB
10ms
C1926 bytes2023-04-08 18:19:45
849972022211270柳叶刀*Accepted65101
1068KB
13ms
C1931 bytes2023-04-08 16:36:32
848522022211270柳叶刀Wrong Answer
1072KB
23ms
C1261 bytes2023-04-08 11:23:22
844262022211270柳叶刀Time Limit Exceed
1200KB
10ms
C3041 bytes2023-04-07 12:34:48
844252022211270柳叶刀Compile Error
0KB
0ms
C2656 bytes2023-04-07 12:34:24
844232022211270柳叶刀Time Limit Exceed
1200KB
10ms
C3033 bytes2023-04-07 12:24:22
837612022211270柳叶刀*Accepted65047
1196KB
11ms
C2935 bytes2023-04-06 11:34:53
837592022211270柳叶刀Time Limit Exceed
1200KB
10ms
C2780 bytes2023-04-06 11:32:07
837442022211270柳叶刀Time Limit Exceed
1200KB
10ms
C2804 bytes2023-04-06 11:23:03
829292022211270柳叶刀Accepted
1200KB
10ms
C2433 bytes2023-04-05 16:58:56
828482022211270柳叶刀*Accepted64825
1200KB
12ms
C3566 bytes2023-04-05 16:22:37
828362022211270柳叶刀Wrong Answer
1200KB
13ms
C2378 bytes2023-04-05 16:18:20
826212022211270柳叶刀Wrong Answer
1200KB
9ms
C2378 bytes2023-04-05 14:33:20
826122022211270柳叶刀Wrong Answer
1200KB
10ms
C2388 bytes2023-04-05 14:24:21
826042022211270柳叶刀Wrong Answer
1200KB
14ms
C2386 bytes2023-04-05 14:20:13
825642022211270柳叶刀Wrong Answer
1072KB
19ms
C2182 bytes2023-04-05 13:48:05
825062022211270柳叶刀Wrong Answer
1072KB
6ms
C2213 bytes2023-04-05 13:02:59
811962022211270柳叶刀Wrong Answer
1072KB
20ms
C2181 bytes2023-04-04 12:29:42
811722022211270柳叶刀Wrong Answer
1072KB
23ms
C2184 bytes2023-04-04 11:29:38
811702022211270柳叶刀Wrong Answer
1072KB
6ms
C2213 bytes2023-04-04 11:28:49