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-21 00:41:51
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
876112022212511蔡逸文Wrong Answer
1192KB
10ms
C1509 bytes2023-04-12 16:11:03
875832022212111码码哈哈Wrong Answer
1072KB
11ms
C1963 bytes2023-04-12 15:23:11
875762022212111码码哈哈Wrong Answer
1072KB
11ms
C1964 bytes2023-04-12 15:18:11
875492019211315hsc*Accepted64610
1192KB
12ms
C2648 bytes2023-04-12 14:28:32
875422022213782indicationAccepted
1200KB
11ms
C1392 bytes2023-04-12 14:05:25
875332022213782indicationWrong Answer
1200KB
10ms
C1323 bytes2023-04-12 13:50:38
874372022212111码码哈哈Wrong Answer
2656KB
17ms
C1867 bytes2023-04-12 09:13:05
874362022212111码码哈哈Wrong Answer
10972KB
54ms
C1867 bytes2023-04-12 08:55:36
872872022212247马梓洋Wrong Answer
1192KB
10ms
C1356 bytes2023-04-11 22:58:59
872792022212247马梓洋Wrong Answer
1192KB
11ms
C1372 bytes2023-04-11 22:58:08
871882022212111码码哈哈Wrong Answer
10972KB
55ms
C1851 bytes2023-04-11 21:51:37
871742022212247马梓洋Runtime Error
1072KB
6ms
C471 bytes2023-04-11 21:27:47
871712022211480马耳东风Wrong Answer
1192KB
5ms
C175 bytes2023-04-11 21:23:42
871682022212247马梓洋Wrong Answer
1200KB
15ms
C7952 bytes2023-04-11 21:20:36
871612022212247马梓洋Wrong Answer
1200KB
14ms
C7950 bytes2023-04-11 21:17:45
871562022211480马耳东风Accepted
1192KB
8ms
C1324 bytes2023-04-11 21:16:08
871542022211480马耳东风Wrong Answer
1192KB
6ms
C1324 bytes2023-04-11 21:15:49
871342022212111码码哈哈Wrong Answer
1072KB
12ms
C1581 bytes2023-04-11 20:59:44
871312022212111码码哈哈Compile Error
0KB
0ms
C1585 bytes2023-04-11 20:57:40
871262022212111码码哈哈Compile Error
0KB
0ms
C1579 bytes2023-04-11 20:54:17
870672022212247马梓洋Wrong Answer
1200KB
13ms
C7948 bytes2023-04-11 20:15:28
870632022212247马梓洋Wrong Answer
1200KB
15ms
C7952 bytes2023-04-11 20:14:14
870572022212247马梓洋Wrong Answer
1200KB
14ms
C7950 bytes2023-04-11 20:12:53
870232022212511蔡逸文Wrong Answer
1192KB
11ms
C1514 bytes2023-04-11 19:53:52
868132022212702宋健Accepted
3124KB
12ms
C1638 bytes2023-04-11 15:42:22
868122022212702宋健Runtime Error
1072KB
10ms
C1632 bytes2023-04-11 15:33:46
868112022212702宋健Runtime Error
1112KB
12ms
C1650 bytes2023-04-11 15:31:58
868102022212702宋健Compile Error
0KB
0ms
C1741 bytes2023-04-11 15:31:36
867892022212702宋健Wrong Answer
17460KB
11ms
C1155 bytes2023-04-11 14:58:50
867882022212702宋健Wrong Answer
17460KB
11ms
C1145 bytes2023-04-11 14:57:51
867872022212702宋健Wrong Answer
3124KB
12ms
C1143 bytes2023-04-11 14:57:12
867862022212702宋健Runtime Error
1072KB
11ms
C1128 bytes2023-04-11 14:52:26
867672022212702宋健Runtime Error
1072KB
11ms
C1179 bytes2023-04-11 14:06:32
867652022212702宋健Runtime Error
1072KB
11ms
C1164 bytes2023-04-11 14:02:52
867592022210145JeffAccepted
1192KB
10ms
C2155 bytes2023-04-11 13:45:17
867572022210145JeffWrong Answer
1192KB
10ms
C2271 bytes2023-04-11 13:40:31
867102022212702宋健Runtime Error
1240KB
11ms
C911 bytes2023-04-11 10:25:37
866412022210145JeffWrong Answer
1192KB
10ms
C2233 bytes2023-04-10 23:45:47
866202022212702宋健Accepted
1192KB
10ms
C1625 bytes2023-04-10 23:31:02
866142022212702宋健Accepted
1192KB
13ms
C1716 bytes2023-04-10 23:27:34
863592022212247马梓洋Wrong Answer
1200KB
16ms
C7948 bytes2023-04-10 19:59:03
863482022212247马梓洋Wrong Answer
1200KB
16ms
C7950 bytes2023-04-10 19:48:29
863082022212111码码哈哈Accepted
1196KB
11ms
C1974 bytes2023-04-10 18:22:10
863072022212111码码哈哈Wrong Answer
1196KB
10ms
C1974 bytes2023-04-10 18:19:02
859592022210145Jeff*Accepted72605
1192KB
10ms
C2101 bytes2023-04-09 23:36:37
859522022210145Jeff*Accepted64826
1192KB
10ms
C2060 bytes2023-04-09 23:28:37
859352022210145JeffAccepted
1196KB
11ms
C2285 bytes2023-04-09 22:58:34
8591820222124992022212499Accepted
1068KB
11ms
C998 bytes2023-04-09 22:21:39
85872202221262520222122625*Accepted64826
1192KB
11ms
C1320 bytes2023-04-09 20:47:41
85871202221262520222122625Compile Error
0KB
0ms
C1320 bytes2023-04-09 20:44:34