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 05:35:46
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
1022972022212434HealthyWrong Answer
1068KB
12ms
C1593 bytes2023-05-04 22:37:52
1022952022212434HealthyWrong Answer
1192KB
11ms
C2686 bytes2023-05-04 22:37:21
1022932022212434HealthyCompile Error
0KB
0ms
C1617 bytes2023-05-04 22:36:29
1022912022212922sherryTime Limit Exceed
1068KB
8815ms
C1503 bytes2023-05-04 22:35:39
1022772022210177牛梓帆Accepted
1196KB
11ms
C4207 bytes2023-05-04 22:22:50
1022762022210177牛梓帆Presentation Error
1196KB
10ms
C4211 bytes2023-05-04 22:21:35
1022722017211617赵鹏飞*Accepted65050
1068KB
12ms
C1863 bytes2023-05-04 22:18:03
1022712017211617赵鹏飞*Accepted64956
1192KB
12ms
C2211 bytes2023-05-04 22:17:25
1022692017211617赵鹏飞*Accepted64954
1192KB
13ms
C2048 bytes2023-05-04 22:16:38
1022662017211617赵鹏飞Compile Error
0KB
0ms
C2491 bytes2023-05-04 22:15:52
1022632017211617赵鹏飞*Accepted64610
1192KB
11ms
C2655 bytes2023-05-04 22:13:53
1022572017211617赵鹏飞Compile Error
0KB
0ms
C2795 bytes2023-05-04 22:11:40
1022552017211617赵鹏飞*Accepted64825
1200KB
11ms
C3511 bytes2023-05-04 22:08:47
1022522021211214黃洪力Wrong Answer
1192KB
9ms
C2539 bytes2023-05-04 22:07:34
1022482021211214黃洪力Runtime Error
1192KB
6ms
C2535 bytes2023-05-04 22:06:34
1022442021211214黃洪力Runtime Error
1192KB
6ms
C2537 bytes2023-05-04 22:03:39
1022432021211214黃洪力Runtime Error
1192KB
5ms
C2538 bytes2023-05-04 22:02:51
1022392022212922sherryWrong Answer
1192KB
11ms
C1387 bytes2023-05-04 22:00:20
1022382022210177牛梓帆*Accepted64826
1192KB
11ms
C2136 bytes2023-05-04 22:00:02
1022352021211214黃洪力Runtime Error
1192KB
6ms
C2464 bytes2023-05-04 21:58:23
1022332022211637爱做梦的露西亚Accepted
1072KB
13ms
C1835 bytes2023-05-04 21:58:09
1022312021211214黃洪力Runtime Error
1192KB
5ms
C2460 bytes2023-05-04 21:57:10
1022282022210177牛梓帆*Accepted64826
1192KB
10ms
C2172 bytes2023-05-04 21:56:19
1022272021211214黃洪力Runtime Error
1192KB
6ms
C2464 bytes2023-05-04 21:55:03
1022262021211214黃洪力Runtime Error
1192KB
7ms
C2466 bytes2023-05-04 21:54:27
1022242021211214黃洪力Compile Error
0KB
0ms
C1865 bytes2023-05-04 21:53:31
1022222021211214黃洪力Compile Error
0KB
0ms
C1869 bytes2023-05-04 21:52:38
1022202022212442范兼玮Accepted
1068KB
12ms
C1460 bytes2023-05-04 21:51:39
1022172022211637爱做梦的露西亚Memory Limit Exceed
196608KB
137ms
C1833 bytes2023-05-04 21:50:58
1022062022210177牛梓帆Accepted
1068KB
12ms
C1040 bytes2023-05-04 21:45:22
1022042022212442范兼玮Wrong Answer
1068KB
11ms
C1843 bytes2023-05-04 21:44:28
1021612021211127xinxin*Accepted65101
1068KB
11ms
C1898 bytes2023-05-04 21:11:18
1021602021211127xinxinRuntime Error
1068KB
9ms
C1746 bytes2023-05-04 21:10:32
1021592021211127xinxin*Accepted65248
1200KB
12ms
C1573 bytes2023-05-04 21:09:28
1021562021211127xinxinWrong Answer
1200KB
10ms
C1572 bytes2023-05-04 21:09:09
1021542021211127xinxinWrong Answer
1200KB
12ms
C1579 bytes2023-05-04 21:08:25
1021512021211127xinxin*Accepted65248
1200KB
12ms
C1616 bytes2023-05-04 21:06:20
1021492021211127xinxinWrong Answer
1200KB
9ms
C1544 bytes2023-05-04 21:04:51
1021472021211127xinxinCompile Error
0KB
0ms
C1552 bytes2023-05-04 21:00:57
1021422021211127xinxin*Accepted65233
1196KB
10ms
C1534 bytes2023-05-04 20:56:21
1021392021211127xinxin*Accepted64996
1192KB
19ms
C4036 bytes2023-05-04 20:50:03
1021342021211127xinxin*Accepted64996
1192KB
21ms
C4139 bytes2023-05-04 20:43:09
1021092022211637爱做梦的露西亚Accepted
1192KB
12ms
C1864 bytes2023-05-04 20:15:17
1021052022211637爱做梦的露西亚Wrong Answer
1192KB
13ms
C1864 bytes2023-05-04 20:12:34
1020982022212922sherryOutput Limit Exceed
1192KB
12ms
C1404 bytes2023-05-04 20:02:22
1020962021211124zzz*Accepted65033
1072KB
13ms
C1854 bytes2023-05-04 19:52:45
1020902021211124zzz*Accepted65047
1196KB
11ms
C2926 bytes2023-05-04 19:44:47
1020832021211124zzz*Accepted65114
1196KB
12ms
C1662 bytes2023-05-04 19:38:02
1020702021211124zzz*Accepted65116
1192KB
14ms
C3066 bytes2023-05-04 19:13:02
1020682022211637爱做梦的露西亚*Accepted53456
1192KB
13ms
C1705 bytes2023-05-04 19:00:02